Permalink
Browse files

Initial commit

Open source of script
  • Loading branch information...
0 parents commit fe55d6faad1dc75086c4362f8ab59945dad6e193 @v3l0c1r4pt0r committed Feb 26, 2016
Showing with 86 additions and 0 deletions.
  1. +9 −0 xml2csv.xsl
  2. +77 −0 xtract-burp.sh
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:output method="text"/>
+<xsl:template match="/"><xsl:apply-templates select="/items/item" /></xsl:template>
+<xsl:template match="/items/item">
+ <xsl:value-of select="path" />,<xsl:value-of select="response" />
+ <xsl:text>&#xa;</xsl:text>
+</xsl:template>
+</xsl:stylesheet>
@@ -0,0 +1,77 @@
+#!/bin/sh
+# extract files from burp item exporter
+if [ $# -lt 1 ]; then
+ echo "Error: Insufficient arguments!";
+ echo "Usage $0 input [.extension]";
+ exit;
+fi;
+INPUT=$1
+PORT=31337
+OUTSUFFIX=.html
+if [ $# -ge 2 ]; then
+ OUTSUFFIX=$2;
+fi;
+FAILCLR=
+OKCLR=
+ENDCLR=
+
+if [ $(tput colors) -ge 8 ]; then
+ FAILCLR="\e[38;5;1m"
+ OKCLR="\e[38;5;2m"
+ ENDCLR="\e[0m"
+fi;
+
+function step {
+ if [ $# -lt 1 ]; then
+ echo -ne "\t Unnamed operation\r"
+ fi;
+ echo -ne "\t $1\r"
+}
+
+function ok {
+ echo -ne "[$OKCLR OK $ENDCLR]\n";
+}
+
+function fail {
+ echo -ne "[$FAILCLR FAIL $ENDCLR]\n";
+}
+
+step "Generating CSV file";
+CSV=$(xsltproc xml2csv.xsl $INPUT 2>/dev/null);
+if [ -z "$CSV" ]; then
+ fail;
+ exit 1;
+fi;
+ok;
+
+step "Extracting responses from CSV file";
+mkdir base64 2>/dev/null;
+i=0;
+for line in $CSV; do
+ let i++;
+ CONTENT=$(echo $line | cut -d',' -f2);
+ echo $CONTENT > base64/$i.base64;
+done;
+ok;
+
+step "Decoding base64 files";
+mkdir http 2>/dev/null;
+for file in $(ls -1 base64/*.base64); do
+ fn=$(echo $file | sed 's/^.*\/\(.*\)\..*$/\1/g');
+ cat $file | base64 -d > http/$fn.http;
+done;
+ok;
+
+step "Downloading files";
+mkdir output 2>/dev/null;
+for file in $(ls -1 http/*.http); do
+ fn=$(echo $file | sed 's/^.*\/\(.*\)\..*$/\1/g');
+ nc -l $PORT < $file &>/dev/null &
+ wget http://localhost:$PORT/ -Ooutput/$fn$OUTSUFFIX &>/dev/null;
+done
+ok;
+
+step "Cleaning working directory";
+rm -fr base64/;
+rm -fr http/;
+ok;

0 comments on commit fe55d6f

Please sign in to comment.