else: print line + "\n" if select.select([ sys.stdin, ], [], [], 0.5)[0]: foo = sys.stdin().readline().strip() if foo == "exit": break elif comm.lower == "sms": command = agentkey + " " + "PORT" + " " + port1 + " " + foo db = DB(config=config) db.query("SELECT path from modems where id=" + modem) path2 = db.fetchone()[0] db.query("SELECT controlkey from modems where id=" + modem) key2 = db.fetchone()[0] number2 = agentnumber db.query("SELECT type from modems where id=" + modem) modemtype2 = db.fetchone()[0] if modemtype2 == "usb": usb = serial.serialposix(port='/dev/ttyUSB2', baudrate=115200, bytesize=8, parity='N', stopbits=1) usb.write("ATZ\r\n") sleep(1) line = read_modem(usb)
def get_movie(self, url): try: sqlList = [] info = { 'id': '', 'name': '', 'date': None, 'score': '0', 'introduction': '', 'download': '', } pattern = re.compile(r'.*/(?P<id>\d*)\.html') info['id'] = re.search(pattern, url).group('id') if info['id'] in self.idList: return html = Grab.get_content(url).replace( 'xmlns="http://www.w3.org/1999/xhtml" /', '').replace('xmlns="http://www.w3.org/1999/xhtml"', '').decode('gb2312', 'ignore') doc = pq(html) info['download'] = doc('#Zoom table td:first-child').eq(0).text() name = doc('.bd3r .co_area2 .title_all h1').text() info['name'] = re.search(r'.*《(.*)》.*', name).group(1) # name = re.search(r'.*阳光电影www\.ygdy8\.com\.(\W*\d?)\..*', info['download']).group(1).strip() content = doc('#Zoom p:first-child') if not content: return content = content.remove('br').html().replace(' ', '') pattern = re.compile( r'.*◎年代.*(?:.*/)?(?P<date>\d{4}[-年]\d{2}[-月]\d{2}日?)\(.*') res = re.match(pattern, content) if res: info['date'] = res.group('date').strip().replace( '年', '-').replace('月', '-').replace('日', '-') pattern = re.compile(r'.*◎豆瓣评分(?P<score>.*)/10 from .* users.*') res = re.match(pattern, content) if res: info['score'] = res.group('score').strip().replace(',', '.') if not info['score']: info['score'] = '0' else: pattern = re.compile( r'.*◎IMDb评分(?P<score>.*)/10 from .* users.*', re.I) res = re.match(pattern, content) if res: info['score'] = res.group('score').strip().replace( ',', '.') if not info['score']: info['score'] = '0' pattern = re.compile(r'.*◎简介(?P<introduction>.*)◎获奖情况.*<img.*') res = re.match(pattern, content) if res: info['introduction'] = res.group( 'introduction').strip().replace('\'', '\\\'') else: pattern = re.compile(r'.*◎简介(?P<introduction>.*).*<img.*') res = re.match(pattern, content) if res: info['introduction'] = res.group( 'introduction').strip().replace('\'', '\\\'') if len(info['introduction']) >= 1024: info['introduction'] = '' # print(info['introduction'], url) # return sql = "select * from bs_movie where name='%s' or id='%s'" % ( info['name'], info['id']) res = DB.fetchone(sql) if res: if int(info['id']) > res[0]: sql = "delete from bs_movie where id='%s'" % res[0] sqlList.append(sql) # self.sqlList.append(sql) else: return if info['date']: sql = "insert into bs_movie (id,name,date,score,introduction,url,download) values ('%s','%s','%s','%s','%s','%s','%s')" % ( info['id'], info['name'], info['date'], info['score'], info['introduction'], url, info['download']) else: sql = "insert into bs_movie (id,name,date,score,introduction,url,download) values ('%s','%s',NULL,'%s','%s','%s','%s')" % ( info['id'], info['name'], info['score'], info['introduction'], url, info['download']) # print(sql) sqlList.append(sql) if len(sqlList) == 1: DB.execute(sqlList[0]) else: DB.doTrans(sqlList) # self.sqlList.append(sql) except Exception as ex: print(str(ex), url)
command1 = "mkdir " + webserver + mypath system(command1) androidagent = config.get('ANDROIDAGENT') command = "cp " + androidagent + " " + webserver + mypath + myfile system(command) elif arsplit[1] == "IPHONE" : pass elif arsplit[1] == "BLACKBERRY" : pass elif arsplit[1] == "AGENTS" : db = DB(config=config) db.query("SELECT COUNT(*) from agents") row = db.fetchone()[0] fullpath2 = webserver + path + "/text2.txt" CLEARFILE2 = open(fullpath2, 'w') CLEARFILE2.close() GETFILE = open(fullpath2, 'w') if row == 0 : GETFILE.write( key + " NONE\n") GETFILE.close() else : GETFILE.write(key + " AGEN\n") for i in range(1,row+1): db.query("SELECT number from agents where id=" + i) r = db.fetchone()[0] db.query("SELECT controlkey from agents where id=" + i)
if line == "": pass else: print line + "\n" if select.select([sys.stdin, ], [], [], 0.5)[0]: foo = sys.stdin().readline().strip() if foo == "exit": break elif comm.lower == "sms": command = agentkey + " " + "PORT" + " " + port1 + " " + foo db = DB(config=config) db.query("SELECT path from modems where id=" + modem) path2 = db.fetchone()[0] db.query("SELECT controlkey from modems where id=" + modem) key2 = db.fetchone()[0] number2 = agentnumber db.query("SELECT type from modems where id=" + modem) modemtype2 = db.fetchone()[0] if modemtype2 == "usb": usb = serial.serialposix(port='/dev/ttyUSB2', baudrate=115200, bytesize=8, parity='N', stopbits=1) usb.write("ATZ\r\n") sleep(1) line = read_modem(usb) print line sleep(1) usb.write("AT+CMGF=1\r\n")
command9 = "chmod 777 " + sploitfile system(command9) results = webserver + localpath + "/results" command8 = "touch " + results system(command8) command9 = "chmod 777 " + results system(command9) sploitfiletext = "<?php\necho \"You Got Phished!\";\n$agent = $_SERVER['HTTP_USER_AGENT'];\n$page = " + x + ";\n$thing = $page . \" \" . $agent;\n$file = results;\n$current = file_get_contents($file);\n$current .= $thing . \"\\n\";\nfile_put_contents($file, $current);\n?>" SPLOITFILE = open(sploitfile, 'w') SPLOITFILE.write(sploitfiletext) SPLOITFILE.close() modem = 1 db = DB(config=config) db.query("SELECT path from modems where id=%s", (modem,)) path2 = db.fetchone()[0].replace('"', '') print path2 db.query("SELECT controlkey from modems where id=%s", (modem,)) key2 = db.fetchone()[0] print key2 db.query("SELECT type from modems where id=%s", (modem,)) modemtype2 = db.fetchone()[0] control = webserver + path2 + "/getfunc" sleep(5) with open(control, 'w') as f: msg = "This is a cool page: " command2 = key2 + " " + "SEND" + " " + x + " " + msg + link f.write(command2)