在线c段查询小工具

admin 2022年5月17日11:36:10在线c段查询小工具已关闭评论241 views1字数 3571阅读11分54秒阅读模式
<?php
 
function getIp($url) {
        $data = file_get_contents("http://www.ip138.com/ips138.asp?ip={$url}&action=2");
        preg_match("/(\d+\.\d+\.\d+\.\d+)<\/font>/", $data, $arr);
        if(!empty($arr[1])) {
                return $arr[1];
        }
        return $url;
}
 
function getBing($ip) {
        $ctx = stream_context_create(array(
                        'http' => array(
                                'timeout' => 30,
                                //'proxy' => 'tcp://113.47.46.152:1080',
                                'request_fulluri' => True,
                                'header'=> "User-Agent: BaiduSpider\r\nAccept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3",
                        )
                )
        );
        $first = 1;
        $res = array();
        while(true) {
                $url = "http://www.bing.com/search?q=ip%3A{$ip}&go=%E6%8F%90%E4%BA%A4&qs=n&first={$first}&form=QBRE&pq=ip%3A{$ip}&sc=0-0&sp=-1&sk=&cvid=5e52385772e24683a0bdf047de60abfc";
                $first = $first + 10;
                $result = file_get_contents($url, False, $ctx); 
                preg_match_all('/<h2><a href="((http|https):\/\/([\w|\.]+)\/)([\w|\/|&|=|\.|\?]+)?" h="ID=\w+,\w+\.\w+">/',$result,$arr);
                if(!empty($arr[1])) {
                        foreach($arr[1] as $v) {
                                array_push($res, $v);
                        } 
                }
                if(!preg_match('/<div class="sw_next">/', $result)) {
                        break;
                }
 
        }
        return array_unique($res);
}
 
//getBing("58.96.186.133");
 
function main() {
        if(isset($_POST["action"])) {
                $action = trim($_POST["action"]);
                if($action == "getip") {
                        $domain = trim($_POST["domain"]);
                        $ip = getIp($domain);
                        echo $ip;
                }
                if($action == "query") {
                        $ip = trim($_POST["ip"]);
                        $res = getBing($ip);
                        echo json_encode($res);
                }
        }
}
 
main();
if(empty($_POST['action'])) {
?>
<!DOCTYPE html>
<html>
        <head>
                <title>必应接口C段查询|c段查询|旁站查询</title>
                <meta charset="utf-8">
                <meta >
                <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
                <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
                <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
                <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
                <style type="text/css" media="screen">
                        .main{
                                width:90%;
                                //border:1px solid red;
                                margin-top:20px;
                        }
                        .ip{
                                margin-top:10px;
                        }
                        dd{
                                text-indent:10px;
                        }
                </style>
        </head>
        <body>
                <div class="container">
                        <div class="main">
                                <h1>必应接口C段查询 </h1>
                                <form class="form-inline">
                                        <div class="form-group" style="">
                                        <input type="text" id="domain" class="form-control" placeholder="输入你要查询的ip或域名">
                                        </div>
                                        <button type="submit" class="btn btn-success" id="getip">获取ip</button>
                                        <button type="submit" class="btn btn-info" id="query">查询</button>
                                </form>
                                <div class="alert alert-info ip" role="alert" style="display:none">IP:<span id="ip"></span><span id="se"></span></div>
                                <div class="progress" id="jd" style="display:none">
                                  <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar" aria-valuenow="40" id="b" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
                                          <span class="sr-only">40% Complete (success)</span>
                                  </div>
                                </div>
                                <dl id="result">
 
                                </dl>
                        </div>
                </div>
        </body>
        <script type="text/javascript">
                var ipi = 1;
                $(function() {
                        $("#getip").click(function() {
                                var domain = $("#domain").val();
                                if(domain == "") {
                                        alert("请输入ip或者域名");
                                        return false;
                                }
                                $.post("","action=getip&domain="+domain,function(res) {
                                        var ip = res;
                                        $("#ip").html(ip);
                                        $(".ip").show();
                                        arr = ip.split(".");
                                        start = arr[0] + "." + arr[1] + "." + arr[2] + "." + 1;
                                        end = arr[0] + "." + arr[1] + "." + arr[2] + "." + 255;
                                        $("#se").html(" 查询ip段:" + start + "-" + end)
                                })
                        });
                         
                        $("#query").click(function() {
                                ipi=1;
                                $("#b").css("width","0%");
                                $("#result").html("");
                                $("#jd").show();
                                query();
                                 
                        });
                })
 
                function query() {
                        $("#query").click(function() {
                                return;
                        });
                        var html = "";
                        var b = (ipi/255) * 100;
                        var ip = $("#ip").html();
                        if(ip == "") {
                                alert("骚年请先获取Ip哦");
                                return;
                        }
                        var arr = ip.split(".");
                        var ips = arr[0] + "." + arr[1] + "." + arr[2] + "." + ipi;
                         
                        $.post("","action=query&ip="+ips,function(res) {
                                $("#b").css("width",b+"%");
                                html += "<dt>"+ ips +"</dt>";
                                for(var i in res) {
                                        html += "<dd><a href=\"" + res[i] + "\" target=\"_blank\">" + res[i]+"</a></dd>";
                                         
                                }
                                $("#result").append(html);
                                if(ipi<255) {
                                        ipi++;
                                        query();
                                }
                        },"json");
                }
        </script>
</html>
 
<?php
}
?>

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2022年5月17日11:36:10
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   在线c段查询小工具http://cn-sec.com/archives/1012927.html