From 3640c65e3ab122ad4b8916a0324f9d8902dbd017 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E9=82=93?= Date: Fri, 1 Feb 2019 16:13:37 +0800 Subject: [PATCH] upgrade code --- httpscan.py | 16 ++++++++-------- log/10.10.67.0-10.10.67.255.log | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 log/10.10.67.0-10.10.67.255.log diff --git a/httpscan.py b/httpscan.py index d0276a6..364ecbc 100644 --- a/httpscan.py +++ b/httpscan.py @@ -4,7 +4,7 @@ import re import sys -import Queue +import Queue #Queue模块是提供队列操作的模块 import threading import optparse import requests @@ -41,17 +41,17 @@ def request(self): title = "None" banner = '' try: - banner += r.headers['Server'][:20] #get the server banner + banner += r.headers['Server'][:25] #get the server banner except:pass printLock.acquire() - print "|%-16s|%-6s|%-20s|%-30s|" % (ip,status,banner,title) - print "+----------------+------+--------------------+------------------------------+" + print("|%-16s|%-6s|%-25s|%-30s|" % (ip,status,banner,title)) + print("+----------------+------+--------------------+------------------------------+") #Save log with open("./log/"+self.cidr.strNormal(3)+".log",'a') as f: f.write(ip+"\n") - except Exception,e: + except Exception as e: printLock.acquire() finally: printLock.release() @@ -72,9 +72,9 @@ def run(self): parser.print_help() sys.exit(0) - print "+----------------+------+--------------------+------------------------------+" - print "| IP |Status| Server | Title |" - print "+----------------+------+--------------------+------------------------------+" + print("+----------------+------+-------------------------+------------------------------+") + print("| IP |Status| Server | Title |") + print("+----------------+------+-------------------------+------------------------------+") s = scan(cidr=args[0],threads_num=options.threads_num) s.run() diff --git a/log/10.10.67.0-10.10.67.255.log b/log/10.10.67.0-10.10.67.255.log new file mode 100644 index 0000000..77d2fb6 --- /dev/null +++ b/log/10.10.67.0-10.10.67.255.log @@ -0,0 +1,6 @@ +10.10.67.68 +10.10.67.180 +10.10.67.68 +10.10.67.180 +10.10.67.68 +10.10.67.180