def scan(self, URL): print(URL) status_code, content = self.reqUrl(URL) if self.urlIsExist(status_code, content): print('[FOUND]{}'.format(URL)) time.sleep(1.5) #多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现 writeFile(self.resultFile, URL + '\n') time.sleep(1.5) #多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现
def weakPwdCrack_jwt(token, code='ascii', key_list=None, resultFile=None): if key_list == None: key_list = readFile('{}payload/dict/passwd_1w.txt'.format(base_root)) if resultFile == None: resultFile = '{}result/jwt_{}.txt'.format(base_root, time.time()) myProcess = MyProcessPool(jwtCrack, key_list, other_args=token) myProcess.start() writeFile(resultFile, '[FOUND] key:{}'.format(myProcess.result))
def getWeb(ip_port_list=None,targetFile=None,resultFile=None): if targetFile: ip_port_list = readFile(targetFile) if resultFile == None: resultFile = '{}result/web_{}.txt'.format(base_root,time.time()) getWebThread = MyThreadPool(isWeb,ip_port_list) getWebThread.start() writeFile(resultFile,'{}'.format(getWebThread.result))
def updataCmsPrintJson(url=None, json_path=None): if url == None: url = 'https://raw.githubusercontent.com/Lucifer1993/cmsprint/master/cmsprint.json' if json_path == None: json_path = '{}payload/others/cmsprint.json'.format(base_root) resp = requests.get(url, verify=False) try: os.system('rm -rf {}'.format(json_path + '.bak')) os.system('mv {} {}'.format(json_path, json_path + '.bak')) except: pass writeFile(json_path, resp.text)
def connectSvn_forThread(passwd, otherArgs): ip = otherArgs['ip'] user = otherArgs['user'] passwd = passwd.strip() print('crack user:[{}]/pwd:[{}]'.format(user, passwd)) (flag, userAndpwd) = connect_svn(ip, user, password=passwd) if flag: print('[FOUND] user:[{}]/pwd:[{}],result out is [{}]'.format( user, passwd, userAndpwd)) time.sleep(1.5) # 多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现 writeFile(resultFile, '[user:[{}]/pwd:[{}]\r\n'.format(user, passwd)) time.sleep(1.5) # 多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现
def init_conf(): try: r = os.popen('pwd') info_list = r.readlines() base_root = info_list[0].strip()+'/' writeFile('./conf/conf.py', 'OS="{}"\n'.format('linux')) writeFile('./conf/conf.py','base_root="{}"\n'.format(base_root)) except: r = os.popen('chdir') info_list = r.readlines() base_root = info_list[0].strip() + '/' writeFile('./conf/conf.py', 'OS="{}"\n'.format('windows')) writeFile('./conf/conf.py', 'base_root="{}"\n'.format(base_root)) User_Agent = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36(security test by hanfei)' writeFile('./conf/conf.py', 'User_Agent="{}"\n'.format(User_Agent))
def connectMysql_forThread(passwd, otherArgs): ip = otherArgs['ip'] port = otherArgs['port'] user = otherArgs['user'] database = otherArgs['database'] passwd = passwd.strip() print('crack user:[{}]/pwd:[{}]'.format(user, passwd)) (flag, userAndpwd) = connect_mysql(ip, port=port, user=user, password=passwd, database=database) if flag: print('[FOUND] user:[{}]/pwd:[{}],result out is [{}]'.format( user, passwd, userAndpwd)) time.sleep(1.5) # 多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现 writeFile(resultFile, '[user:[{}]/pwd:[{}]\r\n'.format(user, passwd)) time.sleep(1.5) # 多线程写入文件时,可能存在条件竞争,添加睡眠时间尽可能防止其出现
def creatCachePathPayload(self): self.clearCacheTxt() extensionList = self.getExtensionList() #创建path缓存文件 try: for fileName in readFile(self.wordsFile): writeFile(self.cachePath_txt, '{}\n'.format(fileName.strip())) for fileName in self.keyWords: writeFile(self.cachePath_txt, '{}\n'.format(fileName)) except Exception as e: print(e) pass #创建file缓存文件 try: for fileName in readFile(self.wordsFile): for exten in extensionList: writeFile( self.cacheFile_txt, '{}.{}\n'.format(fileName.strip(), exten.strip())) for fileName in self.keyWords: for exten in extensionList: writeFile( self.cacheFile_txt, '{}.{}\n'.format(fileName.strip(), exten.strip())) except Exception as e: print(e) pass getRemoveDupFile(self.cachePath_txt) getRemoveDupFile(self.cacheFile_txt) self.clearCacheTxt() os.system('mv {} {}'.format(self.cachePath_txt + '.rd', self.cachePath_txt)) os.system('mv {} {}'.format(self.cacheFile_txt + '.rd', self.cacheFile_txt))
def file_dedu(target_file, result_file): test = readFile(target_file) test = deduplication_list(test) for i in test: writeFile(result_file, i)