└─# python2 UsbKeyboardDataHacker.py attachment.pcapng Running as user "root" and group "root". This could be dangerous. [+] Found : <CAP>a<CAP>utokey('****').decipheer('<CAP>mplrvffczeyoujfjkybxgzvdgqaurkxzolkolvtufblrnjesqitwahxnsijxpnmplshcjbtyhzealogviaaissplfhlfswfehjncrwhtinsmambvexo<DEL>pze<DEL>iz')
for i in enc: if i in string.ascii_lowercase: index=grid.lower().index(i) flag+=string.ascii_lowercase[index] continue if i in string.ascii_uppercase: index=grid.upper().index(i) flag+=string.ascii_uppercase[index] continue flag+=i print(flag)
import binascii from tqdm import tqdm flag='' with open('files/start.txt') as f: text=f.read() nexttxt=text[-36:] data='{:04x}'.format(int(text[0:text.find(':')-1]))#4位小数,并且16进制 print(type(data)) flag=flag+data print(text, '\t', nexttxt, '\t', data) for i in tqdm(range(160000)): try: with open('files/'+nexttxt) as f: text = f.read() nexttxt = text[-36:] data = '{:04x}'.format(int(text[0:text.find(':') - 1])) flag = flag + data #print(text, '\t', nexttxt, '\t', data) except: print(flag) break
with open('fla.zip','wb') as f: f.write(binascii.unhexlify(flag))
#!/usr/bin/env python3 import logging import os import sys import textwrap def decode_data_low(buf): return buf[::2] def decode_data_normal(buf): out = bytearray() for i in range(0, len(buf), 4): out.append((buf[i] & 15) << 4 | (buf[i + 2] & 15)) return out def decode_data_high(buf): out = bytearray() for i in range(0, len(buf), 8): out.append((buf[i] & 3) << 6 | (buf[i + 2] & 3) << 4 \ | (buf[i + 4] & 3) << 2 | (buf[i + 6] & 3)) return out def is_magic(buf): return (buf[0] & 15) == (68 >> 4) and (buf[2] & 15) == (68 & 15) \ and (buf[4] & 15) == (83 >> 4) and (buf[6] & 15) == (83 & 15) \ and (buf[8] & 15) == (67 >> 4) and (buf[10] & 15) == (67 & 15) \ and (buf[12] & 15) == (70 >> 4) and (buf[14] & 15) == (70 & 15) def is_wave(buf): return buf[0:4] == b'RIFF' and buf[8:12] == b'WAVE' def process_deepsound_file(f): bname = os.path.basename(f.name) logger = logging.getLogger(bname) buf = f.read(12) if not is_wave(buf): global convert_warn logger.error('file not in .wav format') convert_warn = True return f.seek(0, os.SEEK_SET) hdrsz = 104 hdr = None while True: off = f.tell() buf = f.read(hdrsz) if len(buf) < hdrsz: break if is_magic(buf): hdr = decode_data_normal(buf) logger.info('found DeepSound header at offset %i', off) break f.seek(-hdrsz + 1, os.SEEK_CUR) if hdr is None: logger.warn('does not appear to be a DeepSound file') return mode = hdr[4] encrypted = hdr[5] modes = {2: 'low', 4: 'normal', 8: 'high'} if mode in modes: logger.info('data is encoded in %s-quality mode', modes[mode]) else: logger.error('unexpected data encoding mode %i', modes[mode]) return if encrypted == 0: logger.warn('file is not encrypted') return elif encrypted != 1: logger.error('unexpected encryption flag %i', encrypted) return sha1 = hdr[6:6+20] print('%s:$dynamic_1529$%s' % (bname, sha1.hex())) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument('--verbose', '-v', action='store_true') parser.add_argument('files', nargs='+', metavar='file', type=argparse.FileType('rb', bufsize=4096)) args = parser.parse_args() if args.verbose: logging.basicConfig(level=logging.INFO) else: logging.basicConfig(level=logging.WARN) convert_warn = False for f in args.files: process_deepsound_file(f)
if convert_warn: print(textwrap.dedent(''' --------------------------------------------------------------- Some files were not in .wav format. Try converting them to .wav and try again. You can use: ffmpeg -i input output.wav ---------------------------------------------------------------'''.rstrip()), file=sys.stderr)
cipherdic = {'M':'ACEG','R':'ADEG','K':'BCEG','S':'BDEG','A':'ACEH','B':'ADEH','L':'BCEH','U':'BDEH','D':'ACEI','C':'ADEI','N':'BCEI','V':'BDEI','H':'ACFG','F':'ADFG','O':'BCFG','W':'BDFG','T':'ACFH','G':'ADFH','P':'BCFH','X':'BDFH','E':'ACFI','I':'ADFI','Q':'BCFI','Y':'BDFI'} cipher = 'BCEHACEIBDEIBDEHBDEHADEIACEGACFIBDFHACEGBCEHBCFIBDEGBDEGADFGBDEHBDEGBDFHBCEGACFIBCFGADEIADEIADFH' flag='' for i in range(0,len(cipher),4): for k, v in cipherdic.items(): if v == cipher[i:i+4]: flag = flag + k print(flag)#LDVUUCMEXMLQSSFUSXKEOCCG ciphertext = 'LDVUUCMEXMLQSSFUSXKEOCCG' original_list = ['M','R','K','S','A','B','L','U','D','C','N','V','H','F','O','W','T','G','P','X','E','I','Q','Y'] reversed_list = original_list[::-1]#倒装后的表 flag = '' for char in ciphertext: for i in range(len(original_list)): if original_list[i] ==char: flag=flag+reversed_list[i] print(flag)#GWHTTOYSAYGREENTEAISCOOL