8
8
from time import time
9
9
import asyncio
10
10
from bs4 import BeautifulSoup
11
-
12
-
13
11
requests .packages .urllib3 .disable_warnings ()
14
12
15
13
__author__ = "whois"
16
14
__update__ = "2020/06/07"
15
+ __version__ = "v2.0.1"
17
16
"""
18
17
C段扫描,指定web端口和非web端口,获取标题,版本信息
19
18
@@ -62,10 +61,11 @@ def banner():
62
61
``:::::::::''""" + yellow + """
63
62
64
63
================= WEB Info Scan ==================
65
- ================= Code by whois ==================
64
+ ================= Code by {0} ==================
65
+ ================= {1} ==================
66
66
+++++++++++++++++++++++++++++++++++++++++++++++++++++
67
67
68
- """ + end )
68
+ """ . format ( __author__ , __version__ ) + end )
69
69
70
70
71
71
def get_info (url ):
@@ -85,13 +85,14 @@ def get_info(url):
85
85
86
86
return info
87
87
except Exception as e :
88
- # print(e)
88
+ print (e )
89
89
pass
90
90
91
91
92
92
# 将域名转化为ip
93
93
def url_to_ip (url ):
94
94
domain = url .split ('/' )[0 ] if '://' not in url else url .split ('//' )[1 ].split ('/' )[0 ]
95
+ domain = domain .split (':' )[0 ] if ':' in domain else domain # fix domain
95
96
try :
96
97
ip = gethostbyname (domain )
97
98
return ip
@@ -169,6 +170,13 @@ async def scan(mode, x, t):
169
170
tasks .append (asyncio .create_task (connet (ip , sem )))
170
171
await asyncio .wait (tasks )
171
172
173
+ '''
174
+ 文件格式支持ip、域名
175
+ 1.1.1.1:80
176
+ baidu.com:443
177
+ http:/1.1.1.1
178
+ http://www.baidu.com
179
+ '''
172
180
if mode == 'file' :
173
181
with open (x , 'r' ) as f :
174
182
for line in f .readlines ():
@@ -179,12 +187,13 @@ async def scan(mode, x, t):
179
187
180
188
await asyncio .wait (tasks )
181
189
182
- print (blue + "\n Found {0} ports in {1} seconds\n " .format (count , time () - time_start ))
190
+ print (blue + "\n Found {0} in {1} seconds\n " .format (count , time () - time_start ))
183
191
184
192
185
193
186
- if __name__ == '__main__' :
194
+ def main () :
187
195
banner ()
196
+
188
197
parser = argparse .ArgumentParser (
189
198
usage = '\n cscan -i 192.168.0.1/24 -t 100\n cscan -f url.txt -t 100' ,
190
199
description = "CScan V2" ,
@@ -210,3 +219,7 @@ async def scan(mode, x, t):
210
219
211
220
if args .file :
212
221
asyncio .run (scan ('file' , args .file , args .threads ))
222
+
223
+
224
+ if __name__ == '__main__' :
225
+ main ()
0 commit comments