您好,欢迎访问一九零五行业门户网

PHP内网探测脚本(内网代理访问+内网端口扫描)

前些天看到wooyun社区有人发的jsp内网探测脚本,可以内网代理访问和内网端口扫描。但是却没找到php的既能代理内网,又能扫描内网端口的的脚本。所以我写了这个集合版本的php内网探测脚本。
一、代码
255){$ciparr[2]+=1;$ciparr[3]=0;}if($ciparr[2]>255){$ciparr[1]+=1;$ciparr[2]=0;}}}/*内网代理代码*/function gethtmlcontext($url){ $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, true); //表示需要response header curl_setopt($ch, curlopt_nobody, false); //表示需要response body curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_timeout, 120); $result = curl_exec($ch); global $header; if($result){ $headersize = curl_getinfo($ch, curlinfo_header_size); $header = explode(\r\n,substr($result, 0, $headersize)); $body = substr($result, $headersize); } if (curl_getinfo($ch, curlinfo_http_code) == '200') { return $body; } if (curl_getinfo($ch, curlinfo_http_code) == '302') { $location = getheader(location); if(strpos(getheader(location),'http://') == false){ $location = gethost($url).$location; } return gethtmlcontext($location); } return null; } function gethost($url){ preg_match(/^(http:\/\/)?([^\/]+)/i,$url, $matches); return $matches[0]; } function getcss($host,$html){ preg_match_all(//i,$html, $matches); foreach($matches[1] as $v){ $cssurl = $v; if(strpos($v,'http://') == false){ $cssurl = $host./.$v; } $csshtml = ; $html .= $csshtml; } return $html; } if($url != null){ $host = gethost($url); echo getcss($host,gethtmlcontext($url)); }?>
其中的代理访问这部分的源码,借鉴了前人的源代码。附上地址:http://zone.wooyun.org/content/22879。对作者表示感谢
用法:
1、端口扫描部分:
填好起始ip、结束ip、自定义端口、超时等,点击扫描即可,十分方便
2、内网代理部分:
直接在文件后面加url参数,注意这里要带着http协议,不然可能css加载不完
其它类似信息

推荐信息