Wizard1803/Port-Scanner
GitHub: Wizard1803/Port-Scanner
一个基于Python多线程的端口扫描工具,支持CLI和Web界面,用于探测指定IP地址的开放端口及对应服务名称。
Stars: 0 | Forks: 0
# 端口扫描器
*它会在我们指定的端口范围内扫描给定 IP 地址的端口,并显示开放的端口及其服务名称。*
## 项目结构
```
Port_Scanner
|--app.py
|--main.py
|--scanner.py
|--utils.py
|--README.md
|--frontend/
|--src/
|--App.js
|--light-bg.jpg
```
## 技术栈
```
Python 3.12.4
Built-in : socket, threading
External : flask, flask-cors
Frontend : React 18
External : axios
```
## 工作流程
```
1. Takes input ip address from user
|
\/
2. Inputs start and end port number for a range from user
|
\/
3. In given range of ports scan_worker() is called with threading and it scans the ports
|
\/
4.threading is stored in threads list and then it is started and then all threads are joined
|
\/
5. If any port is open then port no. with service name (service name is return from utils.py-> get_service_name()) then it is stored in open_ports list as tuple of (port, service_name) with thread lock to prevent race condition
|
\/
6. Print_results() is called to print all the results of scanning ports of given IP Address
```
## 安装和运行项目的两种方式
## CLI 模式
1. 通过运行以下命令在系统上克隆仓库:
```git clone https://github.com/Wizard1803/Port-Scanner.git```
2. 无需 API 密钥或依赖项。所有库均为 Python 内置库。
通过以下命令从项目文件夹路径运行程序:
```python main.py```
## Web UI 模式
终端 1 — 启动 Flask 后端:
```
python app.py
```
终端 2 — 启动 React 前端:
```
cd frontend
npm start
```
然后打开 `http://localhost:3000`
## 安装依赖
```
pip install flask flask-cors
cd frontend && npm install
```
## 示例输出:
```
Port_Scanner> python main.py
Enter Target IP Address : 127.0.0.1
Starting Port : 1
Ending Port : 6000
Open Ports Found on : 127.0.0.1
--------------------
Port 135 --> epmap
Port 445 --> microsoft-ds
Port 623 --> Unknown
Port 3260 --> Unknown
Port 3306 --> MySQL
Port 5040 --> Unknown
Port 5357 --> wsd
--------------------
Total no. of open Ports : 7
```
标签:Flask, LFI本地文件包含, Python, Qt框架, React, Socket编程, Syscalls, TCP/IP, Web安全, 二进制发布, 代码生成, 后端开发, 开源工具, 开源情报工具, 插件系统, 数据统计, 无后门, 服务识别, 渗透测试工具, 漏洞扫描辅助, 端口扫描, 网络安全, 网络扫描器, 蓝队分析, 逆向工具, 隐私保护