Intent
stringlengths
13
680
Script
stringlengths
7
352
Except do nothing
except: \n pass
Except call the function exit with argument 0 of sys
except: \n sys.exit(0)
Check if the images contain Exif data, if it does then for each tuple tag and value in it decode it
try: \n exifData = {} \n imgFile = Image.open(imgFileName) \n info = imgFile._getexif() \n if info: \n for (tag, value) in info.items(): \n decoded = TAGS.get(tag, tag) \n exifData[decoded] = value \n exifGPS = exifData['GPSInfo'] \n except: \n pass \n
If url is None then exit with argument 0
if url == None: \n exit
Else assign to skypeDB the path of main.db inside the pathName
else: \n skypeDB = os.path.join(pathName, 'main.db')
If lport is equal to None then assign to lport the value '1337'
if lport == None: \n lport = '1337'
If state is equal to 'open' then call the method append with argument host of tgtHosts
if state == 'open': \n tgtHosts.append(host)
If passwdFile is not equal to None then call the function smbBrute with arguments configFile, tgtHost, passwdFile, lhost and lport
if passwdFile != None: \n smbBrute(configFile,tgtHost,passwdFile,lhost,lport)
For each sid in dirList call the function listDir with argument recycleDir concatenated to sid of os and assign it to files and call the function sid2user with argument sid and assign it to user
for sid in dirList: \n files = os.listdir(recycleDir + sid) \n user = sid2user(sid)
Try Attempt to process network data using dpkt library, Parse Ethernet and IP headers from input buffer buf, extract source and destination IP addressese, convert them to readable format using socket.inet_ntoa(), retrieve KML representations for source and destination IPs via retKML() function
try: \n eth = dpkt.ethernet.Ethernet(buf) \n ip = eth.data \n src = socket.inet_ntoa(ip.src) \n srcKML = retKML(src) \n dst = socket.inet_ntoa(ip.dst) \n dstKML = retKML(dst) \n kmlPts = kmlPts + srcKML + dstKML \n
Except exit function with value ''
except: \n return ''
If the method isdir with argument recycleDir of path of os returns True then Exit the function with value recycleDir
if os.path.isdir(recycleDir): \n return recycleDir
For each image in image_tags assign to filename the result of the method lstrip with argument 'http://' of image with key 'src', assign to filename the function join of path of os with arguments dir and the method replace with arguments '/' and '_' of filename, assign to filename the function join of path of os with arguments dir and the method replace with arguments '/' and '_' of filename, assign to data the method read with no argument of the method open with argument image with key 'src' of ab, call the method back with no argument of ab, open the filename with option 'wb' and assign it to save, call the method write with argument data of save and close the save file
for image in image_tags: \n filename = image['src'].lstrip('http://') \n filename = os.path.join(dir,filename.replace('/', '_')) \n data = ab.open(image['src']).read() \n ab.back() \n save = open(filename, 'wb') \n save.write(data) \n save.close() \n
If the substring message is in the function str with argument row exit function with argument True
if 'message' in str(row): \n return True
Except call exit function with argument 0
except: \n exit(0)
Get the image from imgTag, download it into a file and return it
try: \n imgSrc = imgTag['src'] \n imgContent = urllib2.urlopen(imgSrc).read() \n imgFileName = basename(urlsplit(imgSrc)[2]) \n imgFile = open(imgFileName, 'wb') \n imgFile.write(imgContent) \n imgFile.close() \n return imgFileName \n
If value Fails is more than 5 then call the function exit with argument 0
if Fails > 5: \n exit(0)
Scan the tgtHost on tgtPort with nmap and calculate the state
def nmapScan(tgtHost,tgtPort): \n nmScan = nmap.PortScanner() \n nmScan.scan(tgtHost,tgtPort) \n state=nmScan[tgtHost]['tcp'][int(tgtPort)]['state' \n
For each row in c assign to host the value of the function str with argument row at the position 0, assign to name the value of the function str with argument row at the position 1 and assign to value the value of the function str with argument row at the position 2
for row in c: \n host = str(row[0]) \n name = str(row[1]) \n value = str(row[2] \n
Else assign to count the count of options
else: \n iface = options.iface
Else assign to iface the value iface of options
else: \n iface = options.iface
If thresh of options is not None assign to THRESH the value thresh of options
if options.thresh != None: \n THRESH = options.thresh
Else Assign to msgDirection the concatenation of From, the function str with argument row at position 1 and :
else: \n
Exit with value 0
exit(0)
except call method Call method acquire on screenLock with no arguments
except: \n screenLock.acquire()
Else Call the function printNets with arguments username and password
else: \n printNets(username, password)
If pcapFile of options is equal to None Call the exit function with argument 0
if options.pcapFile == None: \n exit(0)
If pktCount contains the key stream increment of one the pktCount at the key stream
if pktCount.has_key(stream): \n pktCount[stream] = pktCount[stream] + 1
Define the method __init__ with arguments self, title, text and url and return the title of self
def __repr__(self): \n return self.title
For each result in response with keys 'responseData' and 'results', assign to url the result with key 'url', assign to title the result with key 'titleNoFormatting', assign to text the result with key 'content', assign to new_gr the result of the function Google_result with arguments title, text, url and append the new_gr to the list results
for result in objects['responseData']['results']: \n url = result['url'] \n title = result['titleNoFormatting'] \n text = result['content'] \n new_gr = Google_Result(title, text, url) \n results.append(new_gr) \n
If keyword of options is equal to None call the function exit with argument 0
if options.keyword == None: \n exit(0)
Else assign to results the result of the function google with argument keyword
else: \n results = google(keyword)
Given a string, make a google research with the ajax apis and get the response
def google(search_term): \n ab = anonBrowser() \n \n search_term = urllib.quote_plus(search_term) \n response = ab.open('http://ajax.googleapis.com/'+ 'ajax/services/search/web?v=1.0&q='+ search_term) \n
Define the function __init__ with arguments self and handle, assign to handle of self handle and assign to tweets of self the result of the method get_tweets with no argument of self
def __init__(self, handle): \n self.handle = handle \n self.tweets = self.get_tweets() \n
For each result in json_objects with key 'results' assign to new_result an empty dictionary, assign to new_result with key 'from_user' the value of result with key 'from_user_name', assign to new_result with key 'geo' the value of result with key 'geo', assign to new_result with key 'tweet' the value of result with key 'text'and append to tweets the new_result
for result in json_objects['results']: \n new_result = {} \n new_result['from_user'] = result['from_user_name'] \n new_result['geo'] = result['geo'] \n new_result['tweet'] = result['text'] \n tweets.append(new_result) \n
If link at position 0 exists assign to link the link at the position 0
if link[0]: \n link = link[0]
Else continue
else: \n continue
Except do nothing
except: \n pass
For each line in the method readlines called with no arguments of the opened file cityFile assign to city the string stripped of '\n' and '\r' in low case and append to the list cities the city
for line in open(cityFile).readlines(): \n city = line.strip('\n').strip('\r').lower() \n cities.append(city)
If tweet with key 'geo' is not equal to None append to locations the tweet with key 'geo' and increment locCnt of 1
if tweet['geo'] != None: \n locations.append(tweet['geo']) \n locCnt += 1
If the substring city is in tweetsText append to locations the value city and increment cityCnt of 1
if city in tweetsText: \n locations.append(city) \n cityCnt += 1
For each line in the method readlines with no argument of the opened file cityFile assign the line stripped of '\n' and '\r' in lower case to city and append city to cities
for line in open(cityFile).readlines(): \n city=line.strip('\n').strip('\r').lower() \n cities.append(city) \n
If tweet with key 'geo' is not equal to None append the tweet with key 'geo' to locations and increment locCnt of 1
if tweet['geo'] != None: \n locations.append(tweet['geo']) \n locCnt += 1 \n
If the substring city is in tweetsText append the city to locations and increment cityCnt of 1
if city in tweetsText: \n locations.append(city) \n cityCnt+=1 \n
If cityFile is not equal to None, call the function load_cities with argument cityFile and assign the result to cities
if (cityFile!=None): \n cities = load_cities(cityFile)
For each result in json_objects with key 'result' assign to new_result an empty dictionary, assign to new_result with key 'from_user' the variable result with key 'from_user_name', assign to new_result with key 'geo' the variable result with key 'geo', assign to new_result with key 'tweet' the variable result with key 'text' and append to tweets the new_result
for result in json_objects['results']: \n new_result = {} \n new_result['from_user'] = result['from_user_name'] \n new_result['geo'] = result['geo'] \n new_result['tweet'] = result['text'] \n tweets.append(new_result) \n
If link in position 0 exists, assign link in position 0 to link
if link[0]: \n link = link[0]
Else if link in position 1 exists, assign link in position 1 to link
elif link[1]: \n link = link[1]
Else continue
else: \n continue
Start try block assign the result of the function urlopen with argument link of urllib2, assign the response of url to full_link, append full_link to interests with key links
try: \n response = urllib2.urlopen(link) \n full_link = response.url \n interests['links'].append(full_link) \n
Except do nothing
except: \n pass
If handle is equal to None call the function exit to 0
if (handle==None): \n exit(0)
Define the function __init__ with arguments self, first_name, last_name, job equals to '' and social media equals to {}, assign to first_name of self the value first_name, assign to last_name of self the value last_name, assign to job of self the value job and assign to social_media of self the value social_media
def __init__(self,first_name,last_name, job='',social_media={}): \n self.first_name = first_name \n self.last_name = last_name \n self.job = job \n self.social_media = social_media \n
Define the method __repr__ with argument self and return the concatenation of first_name of self, ' ', last_name of self + ' has job ' + job of self
def __repr__(self): \n return self.first_name + ' ' + self.last_name + ' has job ' + self.job \n
If the variable social_media of self has the key media_name return the variable social_media with key media_nameof self
if self.social_media.has_key(media_name): \n return self.social_media[media_name] \n
For each result in json_object with key response assign an empty dictionary to new_result, assign result with key 'from_user_name' to new_result with key 'from_user', assign result with key 'geo' to new_result with key 'geo' assign result with key 'text' to new_result with key 'tweet' and append new_result to results
for result in json_objects['results']: \n new_result = {} \n new_result['from_user'] = result['from_user_name'] \n new_result['geo'] = result['geo'] \n new_result['tweet'] = result['text'] \n results.append(new_result) \n
Try to assign the result of the function SMTP of smtplib with arguments 'smtp.gmail.com and 587 to smtpServer, call the method ehlo with no argument of smtpServer, call the method starttls with no argument of smtpServer, call the method ehlo with no argument of smtpServer, call the method login with arguments user and pwd of smtpServer, call the method sendmail with arguments user, to and the method as_string with no argument of msg of smtpServer and call the method close with no argument of smtpServer
try: \n smtpServer = smtplib.SMTP('smtp.gmail.com', 587) \n smtpServer.ehlo() \n smtpServer.starttls() \n smtpServer.ehlo() \n smtpServer.login(user, pwd) \n smtpServer.sendmail(user, to, msg.as_string()) \n smtpServer.close() \n
Except do nothing
except: \n pass \n
If handle is equal to None or tgt is equal to None or user is equal to None or pwd is equal to None call the function exit with argument 0
if handle == None or tgt == None or user ==None or pwd==None: \n exit(0) \n
If location is not equal to None assign the result of the function choice with argument location to randLoc and concatenate the concatenation of " Its me from ", randLoc and "." to spamMsg
if (location!=None): \n randLoc=choice(location) \n spamMsg += " Its me from "+randLoc+"." \n
If interests with key 'users' is not equal to None assign to randUser the result of the function choice with argument interests with key 'users' and concatenate the concatenation of " ", randUser and " said to say hello." to spamMsg
if (interests['users']!=None): \n randUser=choice(interests['users']) \n spamMsg += " "+randUser+" said to say hello." \n
If interests with key 'hashtags' is not equal to None assign to randHash the result of the function choice with argument interests with key 'hashtags' concatenate the concatenation of " Did you see all the fuss about ", randHash and "?" to spamMsg
if (interests['hashtags']!=None): \n randHash=choice(interests['hashtags']) \n spamMsg += " Did you see all the fuss about "+ randHash+"?" \n
If interests with key 'links' is not equal to None assign to randLink the result of the function choice with argument interests with key 'links' and concatenate the concatenation of " I really liked your link to: ", randLink and "." to spamMsg
if (interests['links']!=None): \n randLink=choice(interests['links']) \n spamMsg += " I really liked your link to: "+ randLink+"." \n
For each imgTag in imgTags download the image imgTag and assign it to imgFileName and call the function testForExif with argument imgFileName
for imgTag in imgTags: \n imgFileName = downloadImage(imgTag) \n testForExif(imgFileName)
Connect to the database skypeDB and execute the command "SELECT displayname, skypename, city, country,phone_mobile, birthday FROM Contacts;"
def printContacts(skypeDB): \n conn = sqlite3.connect(skypeDB) \n c = conn.cursor() \n c.execute("SELECT displayname, skypename, city, country,phone_mobile, birthday FROM Contacts;" \n
Else if ret equals 3 Increment the variable Fails of one
elif ret == 3: \n Fails += 1
If the thresh of options is not equal to None assign to THRESH the value thresh of options
if options.thresh != None: \n THRESH = options.thresh
For each row in c assign to date the result of the function str with argument row at the position 0, assign to addr the result of the function str with argument row at the position 1 and Assign to text the variable row at position 2
for row in c: \n date = str(row[0]) \n addr = str(row[1]) \n text = row[2] \n
Connect to downloadDB database and execute the command 'SELECT name, source, datetime(endTime/1000000,\'unixepoch\') FROM moz_downloads;'
def printDownloads(downloadDB): \n conn = sqlite3.connect(downloadDB) \n c = conn.cursor() \n c.execute('SELECT name, source, datetime(endTime/1000000,\'unixepoch\') FROM moz_downloads;' \n
If the substring encrypted is in the string e Call the function exit with argument 0
if 'encrypted' in str(e): \n exit(0)
If value Stop is equal to True then call function exit with argument 0
if Stop: \n exit(0)
Else if ret is more than 3 Assign True to the variable Stop
elif ret > 3: \n Stop = True
Start expect block with Exception and e and exit the function with argument False
except Exception, e: \n return False
Else assign an empty list to dnsRecords at the key rrname and append to the list dnsRecords at the key rrname the value rdata
else: \n dnsRecords[rrname] = [] \n dnsRecords[rrname].append(rdata)
Else assign to geoLoc the variable country
else: \n geoLoc = country
Start expect block and exit function with argument False
except: \n return False
If url is equal to None or if dir is equal to None call the function exit with argument 0
if url == None or dir == None: \n exit(0)
Else if the folder does not exists Call the function exit with argument 0
elif os.path.isdir(pathName) == False: \n exit(0)
Else Assign to iface of conf the value iface of options
else: \n conf.iface = options.iface
Try to call the function mirrorImages with arguments url and dir
try: \n mirrorImages(url, dir)
Connect with protocol ssx
def connect(self): \n try: \n s = pxssh.pxssh() \n s.login(self.host, self.user, self.password) \n return s \n
If the functions len with argument argv of sys returns a value bigger than 2 then assign to platform the value argv at position 2 of sys
if len(sys.argv) > 2: \n platform = sys.argv[2]
If __name__ equals '__main__' then call function main with no arguments
if __name__ == '__main__': \n main()
If cookiesDB is a file call the function printCookies with argument cookiesDB
if os.path.isfile(cookiesDB): \n printCookies(cookiesDB)
Else Assign to src the src of options
else: \n src = options.src
Try a connection FTP to hostname, login with userName and passWord then quit and return userName and passWord
try: \n ftp = ftplib.FTP(hostname) \n ftp.login(userName, passWord) \n ftp.quit() \n return (userName, passWord) \n
Start except block \n Do nothing
except: \n pass
Start except block with Exception and e then do nothing
except Exception, e: \n pass
Try to connect to hostname with FTP protocol, with credentials 'anonymous' and '[email protected]', quit the connection and then return True
try: \n ftp = ftplib.FTP(hostname) \n ftp.login('anonymous', '[email protected]') \n ftp.quit() \n return True \n
Connect to the database skypeDB and execute the command "SELECT datetime(begin_timestamp,'unixepoch'), identity FROM calls, conversations WHERE calls.conv_dbid = conversations.id;"
def printCallLog(skypeDB): \n conn = sqlite3.connect(skypeDB) \n c = conn.cursor() \n c.execute("SELECT datetime(begin_timestamp,'unixepoch'), identity FROM calls, conversations WHERE calls.conv_dbid = conversations.id;" \n
Except do nothing
except: \n pass
If host is equals to None or passDir is equals to None or User is equals to None then call function exit with argument 0
if host == None or passDir == None or user == None: \n exit(0)
Expect Exit the function with sid value
except: \n return sid
If downloadDB is a file Call the function printDownloads with argument downloadDB
if os.path.isfile(downloadDB): \n printDownloads(downloadDB)
Try to create the scoket with parameters AF_INET and SOCK_STREAM, connect to tgtHost on tgtPort, send the messsage 'ViolentPython\r\n', Receive the response in result and acquire the lock
try:\n connSkt = socket(AF_INET, SOCK_STREAM)\n connSkt.connect((tgtHost, tgtPort))\n connSkt.send('ViolentPython\r\n')\n results = connSkt.recv(100)\n screenLock.acquire()
Try to call the function printMessage with argument iphoneDB
try: \n printMessage(iphoneDB)
If rdata is not in the lust dnsRecords with key rrname append to the list dnsRecords at the key rrname the value rdata
if rdata not in dnsRecords[rrname]: \n dnsRecords[rrname].append(rdata)
If fileName is equal to None \n Call the function exit with argument 0
if fileName == None: \n exit(0)
Define the function send_command with arguments s and cmd then call method sendline with argument cmd on s and call method prompt with no argument on s
def send_command(s, cmd): \n s.sendline(cmd) \n s.prompt()
If the variable tgtHost of options is equal to None or lhost of options is equal to None then call the exit function with argument 0
if (options.tgtHost == None) | (options.lhost == None): \n exit(0)