zoukankan      html  css  js  c++  java
  • 使用JavaScript扫描端口

    <html>
        <title>端口扫描</title>
        <head></head>
    <form>
    <label for="target">target</label><br/>
    <input type="text" name="target" value="127.0.0.1"/><br/>
    <label for="port">port</label><br/>
    <input type="text" name="port" value="80"/><br/>
    <p>you can use sequence as well 80,81,8080</p>
    <label for="timeout">timeout</label><br/>
    <input type="text" name="timeout" value="1000"/><br/>
    <label for="result">result</label><br/>
    <textarea id="result" name="result" rows="7" cols="50"></textarea><br/>
    <input class="button" type="button" value="scan" onClick="javascript:scan(this.form)"/>
    </form>

    <script>
    var AttackAPI = {
        version: 0.1,
        author: "Petko Petkov (architect)",
        homepage: "http://www.gnucitizen.org"
        };

    AttackAPI.PortScanner = {};
    AttackAPI.PortScanner.scanPort = function (callback, target, port, timeout) {
        var timeout = (timeout == null)?100:timeout;
        var img = new Image();
       
        img.onerror = function () {
            if (!img) return;
            img = undefined;
            callback(target, port, "open");
        };
       
        img.onload = img.onerror;
        img.src = "http://" + target + ":" + port;
       
        setTimeout(function () {
            if (!img) return;
            img = undefined;
            callback(target, port, "closed");
        }, timeout);
    };
    AttackAPI.PortScanner.scanTarget = function (callback, target, ports, timeout)
    {
        for (index = 0; index < ports.length; index++)
        AttackAPI.PortScanner.scanPort(callback, target, ports[index], timeout);
    };
    </script>
    <script>
    var result = document.getElementById("result");
    var callback = function (target, port, status) {
        result.value += target + ":" + port +  status + " ";
    };
    var scan = function (form) {
        AttackAPI.PortScanner.scanTarget(callback, form.target.value, form.port.value.split(","), form.timeout.value);
    };
    </script>



    </html>

  • 相关阅读:
    windows下安装rocketmq采坑全记录
    测试日常使用---网络协议与抓包
    python重写及重写后调用父类方法
    python继承和多态
    python私有成员都以双下划线“__”开头,仅类内部可访问
    http中的post请求发生了两次(多了一次options请求)的原因
    测试日常使用---linux命令:
    数据库性能优化
    pytest常用配置文件之pytest.ini
    pytest.main()的使用
  • 原文地址:https://www.cnblogs.com/shengulong/p/4796374.html
Copyright © 2011-2022 走看看