Skip to content

Commit 52ea7c8

Browse files
committed
🎃 fix domain
1 parent f2f93b4 commit 52ea7c8

File tree

3 files changed

+32
-18
lines changed

3 files changed

+32
-18
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
# 🍺 Cscan ![Stage](https://img.shields.io/badge/Release-STABLE-brightgreen.svg) [![Python 3.7](https://img.shields.io/badge/Python-3.7-yellow.svg)](http://www.python.org/download/) ![Build Status](https://img.shields.io/badge/Version-2.0-red.svg)
22

3-
🔧 一款C段扫描工具,支持python3
3+
🔧 一款C段扫描工具,支持python3.7以上
44

55
- ~~V1版本已废弃~~
66
- V2版本使用协程重构
77

88
> 线程过大会导致丢包
99
10-
## Install
10+
## 1. Install
1111
```
1212
git clone https://github.com/j3ers3/Cscan
1313
pip3 install -r requirement.txt
14-
15-
配置端口
16-
- web端口: Ports_web = [80, 8080]
17-
- 非web端口:Ports_other = [21, 22, 3306]
1814
```
1915

20-
## Usage
21-
- C段扫描
16+
## 2. 配置端口
17+
- web端口: `Ports_web = [80, 8080]`
18+
- 非web端口:`Ports_other = [21, 22, 3306]`
2219

23-
```
20+
21+
## 3. Usage
22+
- C段扫描模式
23+
24+
```python
2425
python3 cscanV2.py -i 192.168.0.1/24 -t 100
2526
```
2627
<img src="./media/15915372292964.jpg" width="500" height="450">
2728

2829

2930
- 域名或ip文件扫描
3031

31-
```
32+
```python
3233
python3 cscanV2.py -f domain.txt -t 100
3334
```
3435
<img src="./media/15915374071366.jpg" width="600" height="400">
3536

36-
## ToDo
37+
## 4. ToDo
3738
- [ ] 优化输出
3839
- [ ] 增加IP反查

cscanV2.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
from time import time
99
import asyncio
1010
from bs4 import BeautifulSoup
11-
12-
1311
requests.packages.urllib3.disable_warnings()
1412

1513
__author__ = "whois"
1614
__update__ = "2020/06/07"
15+
__version__ = "v2.0.1"
1716
"""
1817
C段扫描,指定web端口和非web端口,获取标题,版本信息
1918
@@ -62,10 +61,11 @@ def banner():
6261
``:::::::::''""" + yellow + """
6362
6463
================= WEB Info Scan ==================
65-
================= Code by whois ==================
64+
================= Code by {0} ==================
65+
================= {1} ==================
6666
+++++++++++++++++++++++++++++++++++++++++++++++++++++
6767
68-
""" + end)
68+
""".format(__author__, __version__) + end)
6969

7070

7171
def get_info(url):
@@ -85,13 +85,14 @@ def get_info(url):
8585

8686
return info
8787
except Exception as e:
88-
#print(e)
88+
print(e)
8989
pass
9090

9191

9292
# 将域名转化为ip
9393
def url_to_ip(url):
9494
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
9596
try:
9697
ip = gethostbyname(domain)
9798
return ip
@@ -169,6 +170,13 @@ async def scan(mode, x, t):
169170
tasks.append(asyncio.create_task(connet(ip, sem)))
170171
await asyncio.wait(tasks)
171172

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+
'''
172180
if mode == 'file':
173181
with open(x, 'r') as f:
174182
for line in f.readlines():
@@ -179,12 +187,13 @@ async def scan(mode, x, t):
179187

180188
await asyncio.wait(tasks)
181189

182-
print(blue + "\nFound {0} ports in {1} seconds\n".format(count, time() - time_start))
190+
print(blue + "\nFound {0} in {1} seconds\n".format(count, time() - time_start))
183191

184192

185193

186-
if __name__ == '__main__':
194+
def main():
187195
banner()
196+
188197
parser = argparse.ArgumentParser(
189198
usage='\ncscan -i 192.168.0.1/24 -t 100\ncscan -f url.txt -t 100',
190199
description="CScan V2",
@@ -210,3 +219,7 @@ async def scan(mode, x, t):
210219

211220
if args.file:
212221
asyncio.run(scan('file', args.file, args.threads))
222+
223+
224+
if __name__ == '__main__':
225+
main()
File renamed without changes.

0 commit comments

Comments
 (0)