def split_cigar(cigar): ## split the cigar into a list of tuples cigar_splitted = rs('(S|I|D|M|X|=|H)', cigar) return zip(cigar_splitted[0::2], cigar_splitted[1::2])
@author: cagurl01 """ import datetime as dt import os from re import search as rs from time import sleep while True: try: core = input("""Enter name for merged file, excluding extension and '_SYSDATE' if planning to use today's date as a suffix: """) append_date = input("""\nDo you want to append an underscore followed by today's date (Y/n)? """) ext = input("\nEnter extension for merged file without separator: ") if len(core) == 0 or rs(r'\W', core) or rs(r'\W', ext): raise ValueError() filename = core if not append_date.lower().startswith('n'): filename += '_' + dt.datetime.now().strftime('%Y%m%d') filename = os.extsep.join([filename, ext]) except ValueError: print( '\n***Invalid name or extension. Use only letters, numbers, and underscores. Name must not be empty.***' ) retry = input('Retry (Y/n)? ') if retry.lower().startswith('n'): break print('\n\n') else:
search = key[0:4] key = key[4:] pos = key.find(search) - 12 first = key[pos:pos + 4] last = key[pos - 4:pos] key = key[pos:] pos = key.find(last) key = key[:pos + 4] login = '******' b64cert = getcert(s) cert = xor(b64decode(b64cert), key.decode('hex')) hash = cert[25:] B = int(hash[0:8], 16) A = int(hash[8:16], 16) D = int(hash[16:24], 16) C = int(hash[24:32], 16) for j in xrange(0,32): res = s.recv(B) if res.find('CTF') != -1: print rs(r'CTF{.*}', res).group() break s.send('1\n') s.recv(B) h = hashme('&role=administrator', A, B, C, D, j) cert = b64encode(xor('login='******'&role=anonymous&role=administrator' + h, key.decode('hex'))) s.send(cert + '\n') s.recv(B) s.close()