for line in f.readlines(): line = line.replace("\n", "") # print(line) if"s7"in line.lower(): ip = re.findall(r"[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}", line) # ip正则 lst += ip # 列表可以使用+合并 f.close()
# print(lst) for l in lst: ifnot dic.get(l): dic[l] = 1 else: dic[l] += 1
f = open("flag-woody.mp3", "rb") n = 115130# private_bit起始字节 data = "" while n < 2000000: f.seek(n, 0) # 将文件指针从0位置移动115130字节 n += 1044# struct MPEG_FRAME mf 大小为1044Byte private_bit = f.read(1) # 读出1个字节大小内容 bit = bin(ord(private_bit))[-1] # 先转为ascii码,再转为2进制,取最后1bit,即:private_bit data += bit # print(data)
for i inrange(0, len(data), 8): rel = int(data[i:i + 8], 2) print(chr(rel), end="") # 将二进制转为字符
f = open("data.txt", "r") data = f.readlines() for line in data: line = line.strip() length = int(len(binascii.unhexlify(line))) base64_char += chr(length)
defenc(key, file): count = 0 f = open(file, 'rb') f1 = open('encrypted', 'wb') for now in f: for nowByte in now: newByte = nowByte ^ ord(key[count % len(key)]) count += 1 f1.write(bytes([ newByte]))
if __name__ == '__main__': key = KeyGenerate() enc(key, sys.argv[1])
defdec(key): count = 0 f = open('encrypted', 'rb') f1 = open('decrypted', 'wb') for now in f: for nowByte in now: originalByte = nowByte ^ ord(key[count % len(key)]) count += 1 f1.write(bytes([originalByte]))
if __name__ == '__main__': key = KeyGenerate() dec(key)
解密后得到一张jpg照片,该图片有LSB隐写,但隐写信息加密
需要lsb密码爆破:U!lSb29
1 2 3 4
~/Desktop/misctools/clocked_pixel_lsb > python2 lsb.py extract decrypted.png 1.png 'U!lSb29' [+] Image size: 254x156 pixels. [+] Written extracted data to 1.png.