Permalink
Browse files

added random proxy list and static proxy support

  • Loading branch information...
urule99
urule99 committed Aug 5, 2010
1 parent a4aab25 commit 23f06aa8c5675d62f187743609c061b980921bb2
Showing with 26 additions and 2 deletions.
  1. +2 −0 CHANGELOG
  2. +21 −2 jsunpackn.py
  3. +3 −0 options.config
View
@@ -5,6 +5,8 @@ This is Beta release of jsunpack-network (jsunpackn) version 0.3.2c
RELEASE NOTES:
1) added -p (proxy) and -P (currentproxy) command line arguments (used during active fetching)
Updates 2010-07-02 version 0.3.2c
1) encrypted PDF handling and various PDF parsing improvements
View
@@ -24,7 +24,7 @@
from BeautifulSoup import BeautifulSoup
import sys, os, re, time, subprocess, struct
import StringIO, string, gzip, signal, urllib2, socket
import ConfigParser
import ConfigParser, random
from optparse import OptionParser
from hashlib import sha1
@@ -886,10 +886,23 @@ def fetch(self,url):
try:
hostname,dstport = self.hostname_from_url(url)
if self.OPTIONS.proxy and (not self.OPTIONS.currentproxy):
proxies = self.OPTIONS.proxy.split(',')
self.OPTIONS.currentproxy = proxies[random.randint(0,len(proxies)-1)]
if not self.OPTIONS.quiet:
print '[fetch config] random proxy %s' % (self.OPTIONS.currentproxy)
request = urllib2.Request('http://'+url)
request.add_header('Referer', 'http://'+refer)
request.add_header('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)')
opener = urllib2.build_opener()
if self.OPTIONS.currentproxy:
if not self.OPTIONS.quiet:
print '[fetch config] currentproxy %s' % (self.OPTIONS.currentproxy)
proxyHandler = urllib2.ProxyHandler({'http': 'http://%s' % (self.OPTIONS.currentproxy) })
opener = urllib2.build_opener(proxyHandler)
else:
opener = urllib2.build_opener()
remote = opener.open(request).read()
if len(remote) > 0:
@@ -1169,6 +1182,12 @@ def main():
parser.add_option('-a', '--active', dest='active',
help='actively fetch URLs (only for use with pcap/file/url as input)', #default=False,
action='store_true')
parser.add_option('-p', '--proxy', dest='proxy',
help='use a random proxy from this list (comma separated)',
action='store')
parser.add_option('-P', '--currentproxy', dest='currentproxy',
help='use this proxy and ignore proxy list from --proxy',
action='store')
parser.add_option('-q', '--quiet', dest='quiet',
help='limited output to stdout', #default=False,
action='store_true')
View
@@ -17,6 +17,9 @@ decoded:./decoded.log
#log_ips:./$CURDATE-files/malicious_ips
#decoded:./$CURDATE-files/decoded.log
#### You can use a randomized proxy list or a currentProxy (ignores randomness)
#proxy:a.b.c.d:8080,e.f.g.h:80
#currentproxy:i.j.k.l:8000
[decoding]
#You can also override the default decoding options using the following options

0 comments on commit 23f06aa

Please sign in to comment.