网站SEO优化教程|技术分享|源码分享

本博客文章均是作者原创,记录码砖的点点滴滴,不介意搬砖,希望大家转载注明出处,感谢ing……




JS端口扫描,网页版扫描端口源码


 2020-05-26 11:22:26  浏览量:(227)   标签: JS端口扫描源码  网页版扫描端口源码 




直接上源码了,复制直接使用即可:

<html>
    <title>端口扫描</title>
    <head></head>
<body>
<form>
<label for="target">目标</label><br/>
<input type="text" name="target" value="127.0.0.1"/><br/>
<label for="port">端口</label><br/>
<input type="text" name="port" value="80,21,22,25,3306,8888,888,445"/><br/>
<p>多个端口,请用英文逗号隔开80,81,8080</p>
<label for="timeout">超时</label><br/>
<input type="text" name="timeout" value="2000"/><br/>
<label for="result">结果</label><br/>
<textarea id="result" name="result" rows="7" cols="50"></textarea><br/>
<input class="button" type="button" value="开始扫描" onClick="javascript:scan(this.form)"/>
</form>

<script>
var AttackAPI = {
    version: 1.0,
    author: "日韩赶SEO",
    homepage: "http://www.4asport.com"
    };

AttackAPI.PortScanner = {};
AttackAPI.PortScanner.scanPort = function (callback, target, port, timeout) {
    var timeout = (timeout == null)?2000:timeout;
    var img = new Image();
   
    img.onerror = function () {
        if (!img) return;
        img = undefined;
        callback(target, port, "开启");
    };
   
    img.onload = img.onerror;
    img.src = "http://" + target + ":" + port;
   
    setTimeout(function () {
        if (!img) return;
        img = undefined;
        //callback(target, port, "关闭");关闭的端口就不用输出了
    }, timeout);
};
AttackAPI.PortScanner.scanTarget = function (callback, target, ports, timeout){
    for (index = 0; index < ports.length; index++)
    AttackAPI.PortScanner.scanPort(callback, target, ports[index], timeout);
};

var result = document.getElementById("result");
var callback = function (target, port, status) {
    result.value += target + ":" + port +  status + "\n";
};
var scan = function (form) {
    AttackAPI.PortScanner.scanTarget(callback, form.target.value, form.port.value.split(","), form.timeout.value);
};
</script>
</body></html>


如文章内容失效请联系作者更新,感谢ing,如有任何疑问点击网站提问按钮;

本文由【日韩赶SEO】原创,转载请注明出处,违者必究:http://4asport.com/post/91.html

提问 刷新 ^

友情链接:A5源码

Copyright ?2019 【日韩赶SEO】京ICP备25252500号