import zipfile zFile=zipfile.ZipFile("*.zip") try: zFile.extractall(pwd="...") except Exception,e: print e
多线程
1 2 3 4 5 6 7 8 9 10
from threading import Thread defextractFile(zFile,password): #... defmain(): passFile=open('*.txt') for line in passFile.readlines(): t=Thread(target=extractFile,args=(zFile,password)) t.start() if __name__=='__main__' main()
命令行提示
1 2 3 4 5 6 7 8 9 10
import optparse parser=optparse.OptionParser("usage%prog"+"-f <zipfile> -d <dictionary>") parser.add_option('-f',dest='zname',type='string',help='specify zip file') parser.add_option('-d',dest='dname',type='string',help='specify dictionary file')(options,args)=parse_args() if (options.zname==None)|(options.dname==None): print parser.usage exit(0) else: zname=options.zname dname=options.dname
import pyPdf from pyPdf import PdfFileReader defprintMeta(fileName): pdfFile=PdfFileReader(file(fileName,'rb')) docInfo=pdfFile.getDocumentInfo() print'[*] PDF MetaData For: '+str(fileName) for metaItem in docInfo: print'[+] '+metaItem+':'+docInfo[metaItem]
蓝牙搜寻
1 2 3 4 5 6 7 8 9 10 11 12 13
import time from bluetooth import * alreadyFound=[] deffindDevs(): foundDevs=discover_devices(lookup_names=True) for (addr,name) in foundDevs: if addr notin alreadyFound: print'[*] Found Bluetooth Device: '+str(name) print'[+] MAC address: '+str(addr) alreadFound.append(addr) whileTrue: findDevs() time.sleep(5)