python写外网收集信息器

Posted 东京$

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python写外网收集信息器相关的知识,希望对你有一定的参考价值。

简单化,知道IP去扫描ip

import socket
from socket import *
a=input(\'请输入域名:\')
try:
  ip=gethostbyname(a)
  print(\'[+]\'+ip)

  print(\'开放的端口有:\')
  def postscanner(host,port):
    try:
      s=socket(AF_INET,SOCK_STREAM)
      s.connect((host,port))
      print(\'[+]%d open\'%port)
      s.close()
    except:
      pass

  def main():
       setdefaulttimeout(1)
       for p in range(1,1024):
          postscanner(\'14.215.177.38\',p)


except Exception as e:
    print(e)

if __name__ == \'__main__\':
       main()

 

以上是关于python写外网收集信息器的主要内容,如果未能解决你的问题,请参考以下文章