Файловый менеджер - Редактировать - C:/xampp/htdocs/project.php
Назад
<?php /* Version : 3.0 Change Log : Hyperlink of result is added Version : 2.0 Change Log : Save result and state in LocalStrorage */ header('Access-Control-Allow-Origin: *'); if (isset($_GET["haha"])) { echo "hehe"; } else if (isset($_GET["ip"])) { $addr = $_GET["ip"]; $fp = @fsockopen($addr, 80, $errno, $errstr, 2); if ($fp) { echo "<a target=\"_blank\" href=\"http://$addr\">$addr:80</a><br>\r\n";//"$addr:80\r\n"; } @fclose($fp); $fp = @fsockopen($addr, 443, $errno, $errstr, 2); if ($fp) { echo "<a target=\"_blank\" href=\"https://$addr\">$addr:443</a><br>\r\n";//"$addr:443\r\n"; } @fclose($fp); } else { ?> <html> <head> <title>Http Port Scanner</title> <style> div { margin : 20px; } #ip { width : 200px; } #thread { width : 50px; } #dist_block { display : none; } #servers { width : 100%; height : 200px; } #status { display : none; } #result { width : 100%; height : 600px; } </style> <script> //var base; if (localStorage["count"] == null) { localStorage["count"] = 0; } //var count = 0; //var all; var process; var servers_list; var fail_scans; function get_ip_range(raw){ range = raw; ip = range.split("/")[0]; mask = range.split("/")[1]; blocks = ip.split("."); mask_array = [1, 1, 1, 1]; count = 1; for (i = 31; i >= mask; i--) { mask_array[Math.floor(i / 8)] *= 2; count *= 2; } for (i = 0; i < blocks.length; i++) { blocks[i] = blocks[i] - (blocks[i] % mask_array[i]); } return [blocks, count]; } function ip_2_string(blocks) { val = blocks[0]; for (i = 1; i < blocks.length; i++) { val += "." + blocks[i]; } return val; } function increase(blocks) { i = blocks.length - 1; blocks[i]++; while(blocks[i] == 256) { blocks[i] = 0; i--; blocks[i]++; } return blocks; } function scan() { scan_ip = localStorage["base"];//ip_2_string(localStorage["base"]); var s = new XMLHttpRequest(); s.open("GET", servers_list[localStorage["count"] % servers_list.length] + "?ip=" + scan_ip); s.onreadystatechange = function() { if (s.readyState == 4) { process--; if (s.status == 200) { localStorage["result"] += s.responseText; localStorage["progress"]++; document.getElementById("result").srcdoc += s.responseText;//value += s.responseText; document.getElementById("progress").innerHTML++; document.getElementById("percent").innerHTML = Math.floor((document.getElementById("progress").innerHTML)*100/localStorage["all"]); } else { fail_scan.push(scan_ip); } if (localStorage["count"] > 0) { scan(); } } }; s.send(); process++; localStorage["count"]--; localStorage["base"] = ip_2_string(increase(localStorage["base"].split("."))); } function start_scan() { ip_regex = /^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\/[0-9]{1,2}$/; threads_regex = /^[0-9]+$/; ip_raw = document.getElementById("ip").value; threads_raw = document.getElementById("thread").value; ip_regex.test(ip_raw);//console.log(ip_raw.match(ip_regex)); threads_regex.test(threads_raw);//console.log(threads_raw.match(threads_regex)); if (threads_raw.match(threads_regex) == null || ip_raw.match(ip_regex) == null) { alert("Please insert IP and Threads correctly"); return; } if (localStorage["count"] == 0) { temp = get_ip_range(ip_raw = document.getElementById("ip").value); localStorage["base"] = ip_2_string(temp[0]); localStorage["all"] = temp[1]; localStorage["count"] = localStorage["all"]; localStorage["result"] = ""; localStorage["progress"] = 0; document.getElementById("result").srcdoc = "";//value = ""; document.getElementById("percent").innerHTML = 0; document.getElementById("progress").innerHTML = 0; document.getElementById("all").innerHTML = localStorage["all"]; document.getElementById("status").style.display = "block"; } max_thread = document.getElementById("thread").value; servers_list = [""]; if (document.getElementById("dist").checked) { fail = ""; tmp_servers = document.getElementById("servers").value.split("\n"); for (i in tmp_servers) { if (servers_list.indexOf(tmp_servers[i]) < 0) { var hs = new XMLHttpRequest(); hs.open("GET", tmp_servers[i] + "?haha", false); hs.send(); if (hs.responseText == "hehe") { servers_list.push(tmp_servers[i]); } else { fail += "\n" + tmp_servers[i]; } } } console.log(servers_list); if (fail != "") { alert("Cannot handshake with these servers :\n" + fail); } } fail_scans = []; process = 0; document.getElementById("ip").disabled = "disabled"; document.getElementById("thread").disabled = "disabled"; document.getElementById("start").disabled = "disabled"; document.getElementById("pause").disabled = null; document.getElementById("stop").disabled = null; document.getElementById("dist").disabled = "disabled"; document.getElementById("servers").disabled = "disabled"; for (ii = 0; ii < max_thread && localStorage["count"] > 0; ii++) { scan(); } } function pause_scan() { document.getElementById("ip").disabled = "disabled"; document.getElementById("thread").disabled = null; document.getElementById("start").disabled = "disbaled"; document.getElementById("pause").disabled = "disabled"; document.getElementById("stop").disabled = "disabled"; document.getElementById("dist").disabled = null; document.getElementById("servers").disabled = null; var tmp = localStorage["count"]; localStorage["count"] = 0; var wait = setInterval( function() { if (process <= 0) { localStorage["count"] = tmp; document.getElementById("start").disabled = null; clearInterval(wait); } }, 500 ) } function stop_scan() { localStorage["count"] = 0; document.getElementById("status").style.display = "none"; document.getElementById("ip").disabled = null; document.getElementById("thread").disabled = null; document.getElementById("start").disabled = null; document.getElementById("pause").disabled = "disabled"; document.getElementById("stop").disabled = "disabled"; document.getElementById("dist").disabled = null; document.getElementById("servers").disabled = null; } function toggle_servers() { if (document.getElementById("servers").style.display == "none") { document.getElementById("servers").style.display = "block"; document.getElementById("server_label").innerHTML = "Hide Servers <<"; } else { document.getElementById("servers").style.display = "none"; document.getElementById("server_label").innerHTML = "Show Servers >>"; } } function toggle_dist() { if (document.getElementById("dist_block").style.display == "none" || document.getElementById("dist_block").style.display == "") { document.getElementById("dist_block").style.display = "block"; } else { document.getElementById("dist_block").style.display = "none"; } } function changeState(id) { if (id == "dist") { localStorage[id] = document.getElementById(id).checked; return; } localStorage[id] = document.getElementById(id).value; } function init() { document.getElementById("ip").value = (localStorage["ip"] == null)?"":localStorage["ip"]; document.getElementById("thread").value = (localStorage["thread"] == null)?"":localStorage["thread"]; if (localStorage["dist"] == true) { document.getElementById("dist").checked = true; toggle_dist(); } document.getElementById("servers").value = (localStorage["servers"] == null)?"":localStorage["servers"]; document.getElementById("result").srcdoc = (localStorage["result"] == null)?"":localStorage["result"];//.value to .srcdoc if (localStorage["count"] > 0) { document.getElementById("ip").disabled = "disabled"; document.getElementById("progress").innerHTML = (localStorage["progress"] == null)?"":localStorage["progress"]; document.getElementById("percent").innerHTML = Math.floor((document.getElementById("progress").innerHTML)*100/localStorage["all"]); document.getElementById("all").innerHTML = localStorage["all"]; document.getElementById("status").style.display = "block"; } } </script> </head> <body> <div> <h1>#Http Port Scanner#</h1> </div> <div> IP Range : <input id="ip" pattern="[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}/[0-9]{1,2}" onchange="changeState('ip')" > #Threads <input id="thread" pattern="[0-9]*" onchange="changeState('thread')" > <input type="button" id="start" value="Start!" onclick="start_scan()" > <input type="button" id="pause" value="Pause" onclick="pause_scan()" disabled="disabled" > <input type="button" id="stop" value="Stop" onclick="stop_scan()" disabled="disabled" > <input type="checkbox" id="dist" onclick="toggle_dist()" onchange="changeState('dist')" >Distributed </div> <div id="dist_block" > <a href="#" id="server_label" onclick="toggle_servers()" >Hide Servers <<</a> <textarea id="servers" onchange="changeState('servers')" ></textarea> </div> <div id="status" > Scan Complete : <span id="percent" ></span>% (<span id="progress" ></span>/<span id="all" ></span>) </div> <div> Result : <iframe id="result" srcdoc="" onchange="changeState('result')"></iframe> <!--<textarea id="result" readonly="readonly" onchange="changeState('result')" ></textarea>--> </div> <script> init(); </script> </body> </html> <?php } ?>
| ver. 1.4 |
Github
|
.
| PHP 5.3.8 | Генерация страницы: 0.12 |
proxy
|
phpinfo
|
Настройка