常用脚本
部分脚本来源于网络,需要的自取,不需要的不取
爆破多个压缩包CRC
#爆破多个压缩包的crc
#长度为4字节
import zipfile
import string
import binascii
path = 'D:\\IDM_download\\file_17\\out'#输入文件夹目录
crcs = [''] * 68#压缩包总个数
txts = [''] * 68#同上
for i in range(68):
file = path + str(i) + '.zip'
f = zipfile.ZipFile(file, 'r')
crcs[i] = f.getinfo('data.txt').CRC
dic = string.printable[:-6]
num = 0
for i in dic:
for j in dic:
for k in dic:
for l in dic:
s = i + j + k + l
c = binascii.crc32(s.encode('utf-8'))
for n in range(68):
if c == crcs[n]:
txts[n] = s
print('No.%d is %s' %(n, s))
num += 1
if num == 68:
print(txts)
print(''.join(txts))
break
else:
continue
break
else:
continue
break
else:
continue
break
自动读取CRC爆破图片高宽
import zlib
import struct
import binascii
file = 'out.png'
fr = open(file,'rb').read()
data = bytearray(fr[12:29])
#crc32key = eval(str(fr[29:33]).replace('\\x','').replace("b'",'0x').replace("'",''))
crc32key = struct.unpack('>I',fr[29:33])[0]&0xffffffff
print(crc32key)
#data = bytearray(b'\x49\x48\x44\x52\x00\x00\x01\xF4\x00\x00\x01\xF1\x08\x06\x00\x00\x00')
n = 4096
for w in range(n):
width = bytearray(struct.pack('>i', w))
for h in range(n):
height = bytearray(struct.pack('>i', h))
for x in range(4):
data[x+4] = width[x]
data[x+8] = height[x]
#print(data)
crc32result = zlib.crc32(data)
if crc32result == crc32key:
print(crc32key)
print(width,height)
print(data)
newpic = bytearray(fr)
for x in range(4):
newpic[x+16] = width[x]
newpic[x+20] = height[x]
fw = open(file+'.png','wb')
fw.write(newpic)
fw.close
压缩包名字解压密码为最外层压缩包
import zipfile
name = '0573'
while True:
fz = zipfile.ZipFile(name + '.zip', 'r')
fz.extractall(pwd=bytes(name, 'utf-8'))
name = fz.filelist[0].filename[0:4]
fz.close()
读取压缩包名字自动解压
import zipfile
import re
zipname = "E:\\网站搭建\\资源库\\"+"1.zip"
while True:
if zipname != "E:\\网站搭建\\资源库\\73168.zip":
ts1 = zipfile.ZipFile(zipname)
#print ts1.namelist()[0]
res = re.search('[0-9]*',ts1.namelist()[0])
print(res.group())
passwd = res.group()
ts1.extractall("E:\\网站搭建\\资源库",pwd=passwd.encode('ascii'))
zipname = "E:\\网站搭建\\资源库\\"+ts1.namelist()[0]
else:
print("find")