http://123.206.31.85/ 上的几道Web题 23-26

23、是一个SQL注入,尝试许久未果,我再学学SQL去。。。

24、抓包看了下
http://123.206.31.85/ 上的几道Web题 23-26_第1张图片
会在本地cookie保存一个id,并返回一串flag,base64解码后发现是:
http://123.206.31.85/ 上的几道Web题 23-26_第2张图片
但是这个并不是flag呀
重复后发现,这个flag每次都不一样,再结合速度要快? 难道又像老司机车速那个。
请出脚本(CTF学python系列):

import requests,base64
import re
url='http://120.24.86.145:8002/web6/'
value=[0]*1000000
s=requests.Session()
content = s.post(url)
html = content.headers['flag']
flag  = base64.b64decode(base64.b64decode(html)[-8:])
data = {'margin':flag}
content = s.post(url,data=data)
print (content.text)

http://123.206.31.85/ 上的几道Web题 23-26_第3张图片

25、将地址栏中的filename的值base64解码后变成:keys.txt
又发现,将line分别改为1,2,3,4每改一次出现一行代码,比较笨的一次次保存后。。。得到:


error_reporting(0);
$file=base64_decode(isset($_GET['filename'])?$_GET['filename']:"");
$line=isset($_GET['line'])?intval($_GET['line']):0;
if($file=='') header("location:index.php?line=&filename=a2V5cy50eHQ=");
$file_list = array(
'0' =>'keys.txt',
'1' =>'index.php',
);
if(isset($_COOKIE['margin']) && $_COOKIE['margin']=='margin'){
$file_list[2]='keys.php';
}
if(in_array($file, $file_list)){
$fa = file($file);
echo $fa[$line];
}
?>

这个应该就是在cookie中添加一个名字和值都是margin的值就可以了(filename=keys.php base64编码后)得到flag:
http://123.206.31.85/ 上的几道Web题 23-26_第4张图片

26、这个,容我去学一下xss先。。。

缺的会补上的。。。

你可能感兴趣的:(从菜鸡到咸鱼)