zoukankan      html  css  js  c++  java
  • python web指纹获取加目录扫描加端口扫描加判断robots.txt

    前言:

    总结上几次的信息收集构造出来的。

    0x01:

    首先今行web指纹识别,然后在进行robots是否存在。后面是目录扫描

    然后到使用nmap命令扫描端口。(nmap模块在windows下使用会报停止使用的鬼鬼)

    0x02:

    代码:

    import requests
    import os
    import socket
    from bs4 import BeautifulSoup
    import time
    def Webfingerprintcollection():
      global lgr
      lgr=input('请输入目标域名:')
      url="http://{}".format(lgr)
      header={'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
      r=requests.get(url,headers=header)
      xyt=r.headers
      for key in xyt:
          print(key,':',xyt[key])
    Webfingerprintcollection()
    print('================================================')
    def robots():
      urlsd="http://{}/robots.txt".format(lgr)
      header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
      gf=requests.get(urlsd,headers=header,timeout=8)
      if gf.status_code == 200:
          print('robots.txt存在')
          print('[+]该站存在robots.txt',urlsd)
      else:
          print('[-]没有robots.txt')
    robots()
    print("=================================================")
    def Webdirectoryscanner():
      dict=open('build.txt','r',encoding='utf-8').read().split('
    ')
      for xyt in dict:
          try:
            header = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
            urljc="http://"+lgr+"{}".format(xyt)
            rvc=requests.get(urljc,headers=header,timeout=8)
            if rvc.status_code == 200:
                print('[*]',urljc)
          except:
              print('[-]远程主机强迫关闭了一个现有的连接')
    Webdirectoryscanner()
    print("=====================================================")
    s = socket.gethostbyname(lgr)
    def portscanner():
      o=os.system('nmap {} program'.format(s))
      print(o)
    portscanner()
    print('======================================================')
    def whois():
       heads={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
       urlwhois="http://site.ip138.com/{}/whois.htm".format(lgr)
       rvt=requests.get(urlwhois,headers=heads)
       bv=BeautifulSoup(rvt.content,"html.parser")
       for line in bv.find_all('p'):
           link=line.get_text()
           print(link)
    whois()
    print('======================================================')
    def IPbackupdomainname():
        wu=socket.gethostbyname(lgr)
        rks="http://site.ip138.com/{}/".format(wu)
        rod={'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36'}
        sjk=requests.get(rks,headers=rod)
        liverou=BeautifulSoup(sjk.content,'html.parser')
        for low in liverou.find_all('li'):
            bc=low.get_text()
            print(bc)
    IPbackupdomainname()
    print('=======================================================')
    

      

  • 相关阅读:
    转:wcf大文件传输解决之道(1)
    转:WCF传送二进制流数据基本实现步骤详解
    创建一个简单的WCF程序2——手动开启/关闭WCF服务与动态调用WCF地址
    创建一个简单的WCF程序
    转:【专题十二】实现一个简单的FTP服务器
    转:【专题十一】实现一个基于FTP协议的程序——文件上传下载器
    转:【专题十】实现简单的邮件收发器
    转:【专题九】实现类似QQ的即时通信程序
    转:【专题八】P2P编程
    转:【专题七】UDP编程补充——UDP广播程序的实现
  • 原文地址:https://www.cnblogs.com/haq5201314/p/8386993.html
Copyright © 2011-2022 走看看