├── README.md
├── httpscan.py
└── log
├── 203.124.10.0-203.124.10.255.log
├── demo.png
└── demo.txt~
/README.md:
--------------------------------------------------------------------------------
1 | # httpscan
2 | httpscan是一个扫描指定CIDR网段的Web主机的小工具。和端口扫描器不一样,httpscan是以爬虫的方式进行Web主机发现,因此相对来说不容易被防火墙拦截。
3 |
4 | httpscan会返回IP http状态码 Web容器版本 以及网站标题。
5 | ![demo][1]
6 |
7 | **Usage**:`./httpscan IP/CIDR –t threads`
8 |
9 | Example:`./httpscan.py 10.20.30.0/24 –t 10`
10 |
11 |
12 | [1]: https://raw.githubusercontent.com/zer0h/httpscan/master/log/demo.png
13 |
--------------------------------------------------------------------------------
/httpscan.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | #coding:utf-8
3 | # Author: Zeroh
4 |
5 | import re
6 | import sys
7 | import Queue
8 | import threading
9 | import optparse
10 | import requests
11 | from IPy import IP
12 |
13 | printLock = threading.Semaphore(1) #lock Screen print
14 | TimeOut = 5 #request timeout
15 |
16 | #User-Agent
17 | header = {'User-Agent' : 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36','Connection':'close'}
18 |
19 | class scan():
20 |
21 | def __init__(self,cidr,threads_num):
22 | self.threads_num = threads_num
23 | self.cidr = IP(cidr)
24 | #build ip queue
25 | self.IPs = Queue.Queue()
26 | for ip in self.cidr:
27 | ip = str(ip)
28 | self.IPs.put(ip)
29 |
30 | def request(self):
31 | with threading.Lock():
32 | while self.IPs.qsize() > 0:
33 | ip = self.IPs.get()
34 | try:
35 | r = requests.Session().get('http://'+str(ip),headers=header,timeout=TimeOut)
36 | status = r.status_code
37 | title = re.search(r'
(.*)', r.text) #get the title
38 | if title:
39 | title = title.group(1).strip().strip("\r").strip("\n")[:30]
40 | else:
41 | title = "None"
42 | banner = ''
43 | try:
44 | banner += r.headers['Server'][:20] #get the server banner
45 | except:pass
46 | printLock.acquire()
47 | print "|%-16s|%-6s|%-20s|%-30s|" % (ip,status,banner,title)
48 | print "+----------------+------+--------------------+------------------------------+"
49 |
50 | #Save log
51 | with open("./log/"+self.cidr.strNormal(3)+".log",'a') as f:
52 | f.write(ip+"\n")
53 |
54 | except Exception,e:
55 | printLock.acquire()
56 | finally:
57 | printLock.release()
58 |
59 | #Multi thread
60 | def run(self):
61 | for i in range(self.threads_num):
62 | t = threading.Thread(target=self.request)
63 | t.start()
64 |
65 | if __name__ == "__main__":
66 | parser = optparse.OptionParser("Usage: %prog [options] target")
67 | parser.add_option("-t", "--thread", dest = "threads_num",
68 | default = 10, type = "int",
69 | help = "[optional]number of theads,default=10")
70 | (options, args) = parser.parse_args()
71 | if len(args) < 1:
72 | parser.print_help()
73 | sys.exit(0)
74 |
75 | print "+----------------+------+--------------------+------------------------------+"
76 | print "| IP |Status| Server | Title |"
77 | print "+----------------+------+--------------------+------------------------------+"
78 |
79 | s = scan(cidr=args[0],threads_num=options.threads_num)
80 | s.run()
81 |
--------------------------------------------------------------------------------
/log/203.124.10.0-203.124.10.255.log:
--------------------------------------------------------------------------------
1 | 203.124.10.3
2 | 203.124.10.4
3 | 203.124.10.5
4 | 203.124.10.6
5 | 203.124.10.7
6 | 203.124.10.8
7 | 203.124.10.9
8 | 203.124.10.10
9 | 203.124.10.14
10 | 203.124.10.15
11 | 203.124.10.16
12 | 203.124.10.17
13 | 203.124.10.19
14 | 203.124.10.20
15 | 203.124.10.21
16 | 203.124.10.22
17 | 203.124.10.23
18 | 203.124.10.24
19 | 203.124.10.25
20 | 203.124.10.28
21 | 203.124.10.32
22 | 203.124.10.33
23 | 203.124.10.34
24 | 203.124.10.35
25 | 203.124.10.38
26 | 203.124.10.40
27 | 203.124.10.41
28 | 203.124.10.42
29 | 203.124.10.43
30 | 203.124.10.44
31 | 203.124.10.46
32 | 203.124.10.47
33 | 203.124.10.48
34 | 203.124.10.49
35 | 203.124.10.50
36 | 203.124.10.51
37 | 203.124.10.52
38 | 203.124.10.53
39 | 203.124.10.54
40 | 203.124.10.56
41 | 203.124.10.57
42 | 203.124.10.59
43 | 203.124.10.61
44 | 203.124.10.62
45 | 203.124.10.63
46 | 203.124.10.64
47 | 203.124.10.66
48 | 203.124.10.67
49 | 203.124.10.68
50 | 203.124.10.69
51 | 203.124.10.70
52 | 203.124.10.71
53 | 203.124.10.72
54 | 203.124.10.73
55 | 203.124.10.74
56 | 203.124.10.76
57 | 203.124.10.77
58 | 203.124.10.78
59 | 203.124.10.79
60 | 203.124.10.81
61 | 203.124.10.82
62 | 203.124.10.83
63 | 203.124.10.84
64 | 203.124.10.85
65 | 203.124.10.87
66 | 203.124.10.88
67 | 203.124.10.90
68 | 203.124.10.91
69 | 203.124.10.92
70 | 203.124.10.93
71 | 203.124.10.94
72 | 203.124.10.96
73 | 203.124.10.98
74 | 203.124.10.100
75 | 203.124.10.101
76 | 203.124.10.103
77 | 203.124.10.104
78 | 203.124.10.106
79 | 203.124.10.107
80 | 203.124.10.109
81 | 203.124.10.110
82 | 203.124.10.111
83 | 203.124.10.112
84 | 203.124.10.113
85 | 203.124.10.114
86 | 203.124.10.116
87 | 203.124.10.118
88 | 203.124.10.120
89 | 203.124.10.121
90 | 203.124.10.122
91 | 203.124.10.123
92 | 203.124.10.124
93 | 203.124.10.126
94 | 203.124.10.128
95 | 203.124.10.129
96 | 203.124.10.130
97 | 203.124.10.131
98 | 203.124.10.132
99 | 203.124.10.134
100 | 203.124.10.135
101 | 203.124.10.136
102 | 203.124.10.137
103 | 203.124.10.138
104 | 203.124.10.139
105 | 203.124.10.140
106 | 203.124.10.141
107 | 203.124.10.143
108 | 203.124.10.144
109 | 203.124.10.147
110 | 203.124.10.149
111 | 203.124.10.150
112 | 203.124.10.151
113 | 203.124.10.152
114 | 203.124.10.153
115 | 203.124.10.154
116 | 203.124.10.156
117 | 203.124.10.157
118 | 203.124.10.158
119 | 203.124.10.159
120 | 203.124.10.160
121 | 203.124.10.161
122 | 203.124.10.164
123 | 203.124.10.165
124 | 203.124.10.166
125 | 203.124.10.170
126 | 203.124.10.171
127 | 203.124.10.172
128 | 203.124.10.173
129 | 203.124.10.174
130 | 203.124.10.177
131 | 203.124.10.178
132 | 203.124.10.181
133 | 203.124.10.182
134 | 203.124.10.184
135 | 203.124.10.185
136 | 203.124.10.186
137 | 203.124.10.187
138 | 203.124.10.189
139 | 203.124.10.193
140 | 203.124.10.198
141 | 203.124.10.199
142 | 203.124.10.200
143 | 203.124.10.202
144 | 203.124.10.205
145 | 203.124.10.208
146 | 203.124.10.209
147 | 203.124.10.218
148 | 203.124.10.220
149 | 203.124.10.221
150 | 203.124.10.226
151 | 203.124.10.229
152 | 203.124.10.231
153 | 203.124.10.232
154 | 203.124.10.236
155 | 203.124.10.240
156 | 203.124.10.241
157 | 203.124.10.242
158 | 203.124.10.243
159 | 203.124.10.244
160 | 203.124.10.252
161 |
--------------------------------------------------------------------------------
/log/demo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/5up3rc/httpscan/28c7bd76f92b58ba72615d666507c454a38d1d0c/log/demo.png
--------------------------------------------------------------------------------
/log/demo.txt~:
--------------------------------------------------------------------------------
1 | +----------------+------+--------------------+------------------------------+
2 | | IP |Status| Server | Title |
3 | +----------------+------+--------------------+------------------------------+
4 | |203.124.10.3 |200 |Apache/1.3.41 (Unix)|CLink Office v2 |
5 | +----------------+------+--------------------+------------------------------+
6 | |203.124.10.4 |200 |Apache/2.2.17 (Unix)|None |
7 | +----------------+------+--------------------+------------------------------+
8 | |203.124.10.5 |200 |Apache/2.2.17 (Unix)|CLink Office v2 |
9 | +----------------+------+--------------------+------------------------------+
10 | |203.124.10.6 |200 |Apache/2.2.15 (Unix)|PenPal Garden |
11 | +----------------+------+--------------------+------------------------------+
12 | |203.124.10.7 |200 |Apache/2.2.17 (Unix)| |
13 | +----------------+------+--------------------+------------------------------+
14 | |203.124.10.8 |200 |Apache/2.2.22 (Unix)|None |
15 | +----------------+------+--------------------+------------------------------+
16 | |203.124.10.9 |200 |Apache/2.2.17 (Unix)|None |
17 | +----------------+------+--------------------+------------------------------+
18 | |203.124.10.10 |200 |Apache/2.2.17 (Unix)|CLink Office v2 |
19 | +----------------+------+--------------------+------------------------------+
20 | |203.124.10.14 |200 |Apache/2.2.29 (Unix)|None |
21 | +----------------+------+--------------------+------------------------------+
22 | |203.124.10.15 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
23 | +----------------+------+--------------------+------------------------------+
24 | |203.124.10.16 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
25 | +----------------+------+--------------------+------------------------------+
26 | |203.124.10.17 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
27 | +----------------+------+--------------------+------------------------------+
28 | |203.124.10.19 |200 |Apache/2.2.22 (Unix)|Knowledgebase - CommuniLink |
29 | +----------------+------+--------------------+------------------------------+
30 | |203.124.10.20 |200 |Apache/2.2.22 (Unix)|None |
31 | +----------------+------+--------------------+------------------------------+
32 | |203.124.10.21 |200 |Apache/2.2.22 (Unix)|None |
33 | +----------------+------+--------------------+------------------------------+
34 | |203.124.10.22 |200 |Apache/2.2.22 (Unix)|None |
35 | +----------------+------+--------------------+------------------------------+
36 | |203.124.10.23 |200 |Apache/2.2.22 (Unix)|None |
37 | +----------------+------+--------------------+------------------------------+
38 | |203.124.10.24 |200 |Apache/2.2.22 (Unix)|None |
39 | +----------------+------+--------------------+------------------------------+
40 | |203.124.10.25 |200 |CherryPy/3.1.2 |package repository |
41 | +----------------+------+--------------------+------------------------------+
42 | |203.124.10.28 |200 |Apache/2.2.22 (Unix)|None |
43 | +----------------+------+--------------------+------------------------------+
44 | |203.124.10.32 |200 |Apache/2.2.22 (Unix)|None |
45 | +----------------+------+--------------------+------------------------------+
46 | |203.124.10.33 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
47 | +----------------+------+--------------------+------------------------------+
48 | |203.124.10.34 |200 |Apache/1.3.41 (Unix)|None |
49 | +----------------+------+--------------------+------------------------------+
50 | |203.124.10.35 |200 |Apache/2.2.29 (Unix)|信腾盈创 - 河南外汇投资、EA智能交易、贵金属投资及基金理|
51 | +----------------+------+--------------------+------------------------------+
52 | |203.124.10.38 |401 |Apache/2.2.29 (Unix)|None |
53 | +----------------+------+--------------------+------------------------------+
54 | |203.124.10.40 |200 |Apache/2.2.22 (Unix)|None |
55 | +----------------+------+--------------------+------------------------------+
56 | |203.124.10.41 |200 |Apache/2.2.22 (Unix)|None |
57 | +----------------+------+--------------------+------------------------------+
58 | |203.124.10.42 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
59 | +----------------+------+--------------------+------------------------------+
60 | |203.124.10.43 |200 |Apache/2.2.22 (Unix)|None |
61 | +----------------+------+--------------------+------------------------------+
62 | |203.124.10.44 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
63 | +----------------+------+--------------------+------------------------------+
64 | |203.124.10.46 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
65 | +----------------+------+--------------------+------------------------------+
66 | |203.124.10.47 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
67 | +----------------+------+--------------------+------------------------------+
68 | |203.124.10.48 |200 |Apache/2.2.29 (Unix)|None |
69 | +----------------+------+--------------------+------------------------------+
70 | |203.124.10.49 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
71 | +----------------+------+--------------------+------------------------------+
72 | |203.124.10.50 |200 |Apache/2.2.22 (Unix)|Tour Confirmation - EGL Tours |
73 | +----------------+------+--------------------+------------------------------+
74 | |203.124.10.51 |200 |Apache/2.2.22 (Unix)|None |
75 | +----------------+------+--------------------+------------------------------+
76 | |203.124.10.52 |200 |Apache/2.2.29 (Unix)|None |
77 | +----------------+------+--------------------+------------------------------+
78 | |203.124.10.53 |200 |Apache/2.2.29 (Unix)|Lygo Technology Limited |
79 | +----------------+------+--------------------+------------------------------+
80 | |203.124.10.56 |200 |Apache/2.2.29 (Unix)|None |
81 | +----------------+------+--------------------+------------------------------+
82 | |203.124.10.57 |200 |Apache/2.2.29 (Unix)|永光 e電園 | 永光堂 五旬節聖潔會 |
83 | +----------------+------+--------------------+------------------------------+
84 | |203.124.10.59 |200 |Apache/2.2.29 (Unix)| |
85 | +----------------+------+--------------------+------------------------------+
86 | |203.124.10.61 |200 |Apache/2.2.22 (Unix)|:::°ì«ä¨t²ÎªA°È¦³¤½¥q::: |
87 | +----------------+------+--------------------+------------------------------+
88 | |203.124.10.62 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
89 | +----------------+------+--------------------+------------------------------+
90 | |203.124.10.63 |200 |Apache/2.2.29 (Unix)|Untitled Document |
91 | +----------------+------+--------------------+------------------------------+
92 | |203.124.10.64 |200 |Apache/2.2.22 (Unix)|Untitled Document |
93 | +----------------+------+--------------------+------------------------------+
94 | |203.124.10.66 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
95 | +----------------+------+--------------------+------------------------------+
96 | |203.124.10.67 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
97 | +----------------+------+--------------------+------------------------------+
98 | |203.124.10.68 |403 |Apache/2.2.22 (Unix)|403 Forbidden |
99 | +----------------+------+--------------------+------------------------------+
100 | |203.124.10.69 |200 |Apache/2.2.22 (Unix)|None |
101 | +----------------+------+--------------------+------------------------------+
102 | |203.124.10.70 |200 |Apache/2.2.22 (Unix)|None |
103 | +----------------+------+--------------------+------------------------------+
104 | |203.124.10.71 |200 |Apache/2.2.17 (Unix)|None |
105 | +----------------+------+--------------------+------------------------------+
106 | |203.124.10.72 |200 |Apache/1.3.41 (Unix)|None |
107 | +----------------+------+--------------------+------------------------------+
108 | |203.124.10.73 |401 |Apache/1.3.41 (Unix)|None |
109 | +----------------+------+--------------------+------------------------------+
110 | |203.124.10.74 |200 |Apache/2.2.29 (Unix)|None |
111 | +----------------+------+--------------------+------------------------------+
112 | |203.124.10.76 |200 |Apache/2.2.11 (Unix)|None |
113 | +----------------+------+--------------------+------------------------------+
114 | |203.124.10.77 |200 |Apache/2.2.16 (Unix)|CLink Office v2 |
115 | +----------------+------+--------------------+------------------------------+
116 | |203.124.10.78 |200 |Apache/2.2.29 (Unix)|China Cargo Transport Speciali|
117 | +----------------+------+--------------------+------------------------------+
118 | |203.124.10.79 |200 |Apache/2.2.11 (Unix)|LTA - Leadership Training Asso|
119 | +----------------+------+--------------------+------------------------------+
120 | |203.124.10.81 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
121 | +----------------+------+--------------------+------------------------------+
122 | |203.124.10.82 |200 |Apache/2.2.22 (Unix)|None |
123 | +----------------+------+--------------------+------------------------------+
124 | |203.124.10.83 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
125 | +----------------+------+--------------------+------------------------------+
126 | |203.124.10.84 |200 |Apache/2.2.22 (Unix)|None |
127 | +----------------+------+--------------------+------------------------------+
128 | |203.124.10.85 |200 |Apache/2.2.22 (Unix)|CLink Office v2 |
129 | +----------------+------+--------------------+------------------------------+
130 | |203.124.10.87 |200 |Apache/2.2.22 (Unix)|None |
131 | +----------------+------+--------------------+------------------------------+
132 | |203.124.10.88 |200 |Apache/2.2.29 (Unix)|CLink Office v2 |
133 | +----------------+------+--------------------+------------------------------+
134 | |203.124.10.89 |200 |Apache/2.2.29 (Unix)|Ponti Wine Cellars |
135 | +----------------+------+--------------------+------------------------------+
136 | |203.124.10.90 |200 |Apache/2.2.22 (Unix)|Welcome to Our Website |
137 | +----------------+------+--------------------+------------------------------+
138 | |203.124.10.91 |200 |Apache/2.2.29 (Unix)|DFax Manager - Login |
139 | +----------------+------+--------------------+------------------------------+
140 | |203.124.10.92 |200 |Apache/2.2.22 (Unix)|è¯éåéå®¢æ¶æåä¸å¿|
141 | +----------------+------+--------------------+------------------------------+
142 | |203.124.10.93 |200 |Apache/2.2.29 (Unix)|None |
143 | +----------------+------+--------------------+------------------------------+
144 | |203.124.10.94 |200 |Microsoft-IIS/7.0 |None |
145 | +----------------+------+--------------------+------------------------------+
146 | |203.124.10.96 |403 |Microsoft-IIS/8.5 |IIS 8.5 詳細錯誤 - 403.14 - Forbid|
147 | +----------------+------+--------------------+------------------------------+
148 | |203.124.10.98 |403 |Microsoft-IIS/6.0 |Error