成都创新互联网站制作重庆分公司

http_banner获取v0.2-创新互联

#-*-coding=utf-8-*-
# __author__  = 'sanr'
# __email__   = '5754190@qq.com'
# __url__     = 'http://0x007.blog.51cto.com/'
# __version__ = '0.2'
import requests
import re
from threading import Thread,Lock
import time
import sys
import chardet
import netaddr
import struct
import socket

lock = Lock()

def ip2int(addr):
        return struct.unpack("!I", socket.inet_aton(addr))[0]
def int2ip(addr):
        return socket.inet_ntoa(struct.pack("!I", addr))
def int_dec(pagehtml):

        charset = None
        if pagehtml != '':
                # print 'use charset dect'
                enc = chardet.detect(pagehtml)
                # print 'enc= ', enc
                if enc['encoding'] and enc['confidence'] > 0.9:
                        charset = enc['encoding']

                if charset == None:
                        charset_re = re.compile("((^|;)\s*charset\s*=)([^\"']*)", re.M)
                        charset=charset_re.search(pagehtml[:1000]) 
                        charset=charset and charset.group(3) or None

                # test charset
                try:
                        if charset:
                                unicode('test',charset,errors='replace')
                except Exception,e:
                        print 'Exception',e
                        charset = None
        # print 'charset=', charset
        return charset


def http_banner(url):
        ip=url
        try:
                url=requests.get(url,timeout=2)        

                body = url.content
                
                charset = None
                if body != '':
                        charset = int_dec(body)

                if charset == None or charset == 'ascii':
                        charset = 'ISO-8859-1'

                if charset and charset != 'ascii' and charset != 'unicode':
                        try:
                                body = unicode(body,charset,errors='replace')
                        except Exception, e:
                                body = ''
                Struts=url.status_code
                Server=url.headers['server'][0:13]
                if Struts==200 or Struts==403 or Struts==401:
                        title=re.findall(r"(.*)<\/title>",body)
                        if len(title):
                                title = title[0].strip()
                        else:
                                title = ''
                        lock.acquire()
                        print ('%s\t%d\t%-10s\t%s'%(ip.lstrip('http://'),Struts,Server,title))
                        lock.release()
        except (requests.HTTPError,requests.RequestException,AttributeError,KeyError),e:
                pass



if __name__ == '__main__':
        if len(sys.argv) >= 2:
                ips = sys.argv[1]
        else:
                print 'usage: python http_banner.py 192.168.1./24 '
                print 'usage: python http_banner.py 192.168.1.1-192.168.1.254 '
                print 'usage: python http_banner.py 192.168.1./24 8080'
                print 'usage: python http_banner.py 192.168.1.1-192.168.1.254 8080'
                sys.exit()
        port = '80'
        if len(sys.argv) == 3:
                port = sys.argv[2]
                
        if '-' in ips:
                start, end = ips.split('-')
                startlong = ip2int(start)
                endlong = ip2int(end)
                ips = netaddr.IPRange(start,end)
                for ip in list(ips):
                        url='http://%s:%s'%(ip,port)
                        t = Thread(target=http_banner,args=(url,))
                        t.daemon=False
                        t.start()
        elif '/'        in ips:
                ips = netaddr.IPNetwork(ips)
                for ip in list(ips):
                        url='http://%s:%s'%(ip,port) 
                        t = Thread(target=http_banner,args=(url,))
                        t.daemon=False
                        t.start()</pre><p><strong>更新了端口自定义 默认端口为80</strong></p>创新互联于2013年创立,先为泰和等服务建站,泰和等地企业,进行企业商务咨询服务。为泰和企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。<p><strong><img src="/upload/otherpic16/131896.jpg" alt="http_banner获取v0.2"></strong></p><p><img src="/upload/otherpic16/131898.jpg" alt="http_banner获取v0.2"></p><p><img src="/upload/otherpic16/131902.jpg" alt="http_banner获取v0.2"></p><p align=center>另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、<a href="https://www.cdcxhl.com/gaofang/" target="_blank">高防服务器</a>、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。</p>            <br>
            本文标题:http_banner获取v0.2-创新互联            <br>
            网页路径:<a href="http://cxhlcq.com/article/cdgsdp.html">http://cxhlcq.com/article/cdgsdp.html</a>
        </div>
    </div>
</div>
<div class="other container">
    <h3>其他资讯</h3>
    <ul>
        <li>
                <a href="/article/dejgee.html">Linux日志对接Kibana如何进行配置与部署</a>
            </li><li>
                <a href="/article/dejgec.html">Linux:检查当前运行级别的五种方法-创新互联</a>
            </li><li>
                <a href="/article/dejgjc.html">VisualStudio原生开发的调试技巧有哪些-创新互联</a>
            </li><li>
                <a href="/article/dejgce.html">怎样理解bgp云服务器-创新互联</a>
            </li><li>
                <a href="/article/dejgih.html">ASP.NETCore依赖注入之服务注册与提供的示例分析-创新互联</a>
            </li>    </ul>
</div>
<div class="footer">
    <div class="foota container">
        <div class="foot_nav fl col-lg-8 col-md-8 col-sm-12 col-xs-12">
            <ul>
                <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
                    <h3>网站制作</h3>
                    <a href="http://www.mywzjz.com/" target="_blank">绵阳网站制作公司</a><a href="https://www.cdxwcx.com/wangzhan/shop.html" target="_blank">成都商城网站制作</a><a href="http://www.cxjianzhan.com/" target="_blank">网站制作</a><a href="http://www.cdxwcx.cn/" target="_blank">成都网站制作公司</a><a href="http://chengdu.kswjz.com/" target="_blank">成都网站制作</a><a href="https://www.cdcxhl.com/mobile.html" target="_blank">手机网站制作</a>                </li>
                <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
                    <h3>企业服务</h3>
                    <a href="https://www.cdcxhl.com/shoulu/" target="_blank">分类目录</a><a href="https://www.cdcxhl.com/link/" target="_blank">卖友情链接</a><a href="https://www.cdcxhl.com/service/gongsizhuce.html" target="_blank">注册公司</a><a href="https://www.cdcxhl.com/service/wenwangwen.html" target="_blank">网络文化经营许可证</a><a href="https://www.cdcxhl.com/service/ypfwzgz.html" target="_blank">互联网药品信息服务资格证</a><a href="https://www.cdcxhl.com/shoulu/" target="_blank">免费收录网站</a>                </li>
                <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
                    <h3>网站建设</h3>
                    <a href="http://www.wjwzjz.com/" target="_blank">温江网站建设</a><a href="http://chengdu.cdcxhl.cn/jianshe/" target="_blank">成都网站建设公司</a><a href="http://www.cqcxhl.com/" target="_blank">企业网站建设</a><a href="http://m.cdcxhl.cn/H5/" target="_blank">响应式网站建设</a><a href="http://www.cqcxhl.com/" target="_blank">网站建设</a><a href="http://www.scsantai.cn/" target="_blank">三台网站建设</a>                </li>
                <li class="col-lg-3 col-md-3 col-sm-3 col-xs-6">
                    <h3>服务器托管</h3>
                    <a href="https://www.cdcxhl.com/idc/cqlt.html" target="_blank">重庆联通机房托管</a><a href="https://www.cdcxhl.com/idc/yaan.html" target="_blank">雅安服务器托管</a><a href="https://www.cdcxhl.com/tuoguan/yidong/" target="_blank">移动服务器托管</a><a href="https://www.cdcxhl.com/jigui/" target="_blank">服务器机柜租用</a><a href="http://www.cdxwcx.cn/tuoguan/mianyang.html" target="_blank">绵阳托管服务器</a><a href="https://www.cdxwcx.com/jifang/xiyun.html" target="_blank">成都西云机房</a>                </li>
            </ul>
        </div>
        <div class="footar fl col-lg-4 col-md-4 col-sm-12 col-xs-12">
            <p>全国免费咨询:</p>
            <b>400-028-6601</b>
            <p>业务咨询:028-86922220 / 13518219792</p>
            <p>节假值班:18980820575 / 13518219792</p>
            <p>联系地址:成都市太升南路288号锦天国际A幢1002号</p>
        </div>
    </div>
    <div class="footb">
        <div class="copy container">
            <div class="fl">Copyright © 成都创新互联科技有限公司重庆分公司  <a href="https://beian.miit.gov.cn/" target="_blank">渝ICP备2021005571号</a></div>
            <!--<div class="fr"><a href="https://www.cdxwcx.com/" target="_blank">成都网站建设</a>:<a href="https://www.cdcxhl.com/" target="_blank">创新互联</a></div>-->
        </div>
    </div>
    <div class="link">
        <div class="container">
            友情链接::
            <a href="https://www.cdcxhl.com/" target="_blank">成都网站建设</a>
            <a href="https://www.cdcxhl.com/city/chongqing.html" target="_blank">重庆网站建设</a>
            <a href="">四川网站建设</a>
            <a href="">重庆建设网站</a>
            <a href="https://www.cdxwcx.com/jifang/xiyun.html" target="_blank">移动服务器托管</a>
            <a href="http://www.cdfuwuqi.com/" target="_blank">成都服务器托管</a>
            <a href="https://www.cdcxhl.cn/" target="_blank">云服务器</a>
            <a href="http://www.cdhuace.com/" target="_blank">广告设计制作</a>
            <a href="https://www.cdcxhl.com/sheji/chongqing.html" target="_blank">重庆网页设计</a>
            <a href="https://www.cdcxhl.com/zuo/chongqing.html" target="_blank">重庆做网站</a>
            <a href="https://www.cdcxhl.com/zhizuo/chongqing.html" target="_blank">重庆网站制作</a>
            <a href="">重庆网站建设</a>
            <a href="">重庆网站公司</a>
            <a href="">渝中网站制作</a>
            <a href="">重庆网站设计</a>
        </div>
    </div>
</div>
<div class="foot">
    <ul class="public-celan">
        <li>
            <a href="https://p.qiao.baidu.com/cps3/chatIndex?siteToken=6ce441ff9e2d6bedbdfc2a4138de449e&speedLogId=162260383240185e3_1622603832401_02407&eid=6256368&reqParam=%7B%22from%22%3A1%2C%22sessionid%22%3A%22-100%22%2C%22siteId%22%3A%2211284691%22%2C%22tid%22%3A%22-1%22%2C%22userId%22%3A%226256368%22%2C%22ttype%22%3A1%2C%22pageId%22%3A0%7D" target="_blank" class="a1 db tc">
                <img src="/Public/Home/img/icon-23.png" alt="" class="db auto">
                <span class="span-txt">在线咨询</span>
            </a>
        </li>
        <li>
            <a href="tel:18980820575" class="a1 db tc">
                <img src="/Public/Home/img/icon-24.png" alt="" class="db auto">
                <span class="span-txt">电话咨询</span>
            </a>
        </li>
        <li>
            <a target="_blank" href="tencent://message/?uin=1683211881&Site=&Menu=yes" class="a1 db tc">
                <img src="/Public/Home/img/icon-25.png" alt="" class="db auto">
                <span class="span-txt">QQ咨询</span>
            </a>
        </li>
        <li>
            <a target="_blank" href="tencent://message/?uin=532337155&Site=&Menu=yes" class="a1 db tc public-yuyue-up">
                <img src="/Public/Home/img/icon-26.png" alt="" class="db auto">
                <span class="span-txt">预约顾问</span>
            </a>
        </li>
    </ul>
</div>
<div class="customer">
    <dl class="icon1">
        <dt>
            <a href="tencent://message/?uin=1683211881&Site=&Menu=yes">
                <i class="iconT"><img src="/Public/Home/img/QQ.png" alt=""></i>
                <p>在线咨询</p>
            </a>
        </dt>
    </dl>
    <dl class="icon2">
        <dt><i><img src="/Public/Home/img/weixin.png" alt=""></i><p>微信咨询</p></dt>
        <dd><img src="/Public/Home/img/ewm.png"></dd>
    </dl>
    <dl class="icon3">
        <dt><i><img src="/Public/Home/img/dianhua.png" alt=""></i><p>电话咨询</p></dt>
        <dd>
            <p>028-86922220(工作日)</p>
            <p>18980820575(7×24)</p>
        </dd>
    </dl>
    <dl class="icon4">
        <dt class="sShow">
            <a href="tencent://message/?uin=244261566&Site=&Menu=yes">
                <i><img src="/Public/Home/img/dengji.png" alt=""></i><p>提交需求</p>
            </a>
        </dt>
    </dl>
    <dl class="icon5">
        <dt class="gotop">
            <a href="#top">
                <i><img src="/Public/Home/img/top.png" alt=""></i><p>返回顶部</p>
            </a>
        </dt>
    </dl>
</div>
</body>
</html>
<script>
    $(".con img").each(function(){
        var src = $(this).attr("src");    //获取图片地址
        var str=new RegExp("http");
        var result=str.test(src);
        if(result==false){
            var url = "https://www.cdcxhl.com"+src;    //绝对路径
            $(this).attr("src",url);
        }
    });
    window.onload=function(){
        document.oncontextmenu=function(){
            return false;
        }
    }
</script>