ScanNet 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scannet-0.1.0/LICENSE +21 -0
- scannet-0.1.0/PKG-INFO +172 -0
- scannet-0.1.0/README.md +143 -0
- scannet-0.1.0/ScanNet.egg-info/PKG-INFO +172 -0
- scannet-0.1.0/ScanNet.egg-info/SOURCES.txt +52 -0
- scannet-0.1.0/ScanNet.egg-info/dependency_links.txt +1 -0
- scannet-0.1.0/ScanNet.egg-info/entry_points.txt +2 -0
- scannet-0.1.0/ScanNet.egg-info/requires.txt +6 -0
- scannet-0.1.0/ScanNet.egg-info/top_level.txt +1 -0
- scannet-0.1.0/pyproject.toml +3 -0
- scannet-0.1.0/scannet/__init__.py +15 -0
- scannet-0.1.0/scannet/cli.py +165 -0
- scannet-0.1.0/scannet/core/__init__.py +12 -0
- scannet-0.1.0/scannet/core/dns_tools.py +40 -0
- scannet-0.1.0/scannet/core/host_discovery.py +84 -0
- scannet-0.1.0/scannet/core/os_detector.py +83 -0
- scannet-0.1.0/scannet/core/ping.py +37 -0
- scannet-0.1.0/scannet/core/port_scanner.py +51 -0
- scannet-0.1.0/scannet/core/scanner.py +105 -0
- scannet-0.1.0/scannet/core/service_detector.py +169 -0
- scannet-0.1.0/scannet/core/subnet.py +55 -0
- scannet-0.1.0/scannet/core/traceroute.py +71 -0
- scannet-0.1.0/scannet/core/validator.py +68 -0
- scannet-0.1.0/scannet/core/whois_tools.py +24 -0
- scannet-0.1.0/scannet/protocols/__init__.py +1 -0
- scannet-0.1.0/scannet/protocols/dns.py +17 -0
- scannet-0.1.0/scannet/protocols/ftp.py +12 -0
- scannet-0.1.0/scannet/protocols/http.py +15 -0
- scannet-0.1.0/scannet/protocols/https.py +15 -0
- scannet-0.1.0/scannet/protocols/icmp.py +28 -0
- scannet-0.1.0/scannet/protocols/smtp.py +12 -0
- scannet-0.1.0/scannet/protocols/snmp.py +20 -0
- scannet-0.1.0/scannet/protocols/ssh.py +13 -0
- scannet-0.1.0/scannet/protocols/tcp.py +9 -0
- scannet-0.1.0/scannet/protocols/udp.py +24 -0
- scannet-0.1.0/scannet/report/__init__.py +5 -0
- scannet-0.1.0/scannet/report/csv_report.py +35 -0
- scannet-0.1.0/scannet/report/html_report.py +202 -0
- scannet-0.1.0/scannet/report/json_report.py +13 -0
- scannet-0.1.0/scannet/report/markdown_report.py +39 -0
- scannet-0.1.0/scannet/utils/__init__.py +8 -0
- scannet-0.1.0/scannet/utils/config.py +43 -0
- scannet-0.1.0/scannet/utils/exceptions.py +15 -0
- scannet-0.1.0/scannet/utils/exporter.py +22 -0
- scannet-0.1.0/scannet/utils/formatter.py +53 -0
- scannet-0.1.0/scannet/utils/helpers.py +54 -0
- scannet-0.1.0/scannet/utils/logger.py +27 -0
- scannet-0.1.0/scannet/utils/rate_limiter.py +25 -0
- scannet-0.1.0/setup.cfg +4 -0
- scannet-0.1.0/setup.py +37 -0
- scannet-0.1.0/tests/test_exporter.py +61 -0
- scannet-0.1.0/tests/test_port_scanner.py +20 -0
- scannet-0.1.0/tests/test_subnet.py +23 -0
- scannet-0.1.0/tests/test_validator.py +30 -0
scannet-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NetScan Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
scannet-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ScanNet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A safe, educational, authorized-only network scanning library
|
|
5
|
+
Home-page: https://github.com/user/netscan
|
|
6
|
+
Author: NetScan Team
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: click>=8.0.0
|
|
15
|
+
Requires-Dist: rich>=12.0.0
|
|
16
|
+
Requires-Dist: dnspython>=2.2.0
|
|
17
|
+
Requires-Dist: requests>=2.27.0
|
|
18
|
+
Requires-Dist: python-whois>=0.7.3
|
|
19
|
+
Requires-Dist: tabulate>=0.8.9
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# NetScan (Network Scanning Library)
|
|
31
|
+
|
|
32
|
+
NetScan adalah sebuah library dan command line interface (CLI) Python yang didesain secara khusus untuk kebutuhan pembelajaran (educational), audit keamanan jaringan internal, inventarisasi perangkat, dan pemantauan keamanan yang legal/authorized-only.
|
|
33
|
+
|
|
34
|
+
## Fitur Utama
|
|
35
|
+
|
|
36
|
+
- **Validasi Target Ketat**: Memvalidasi IP address, domain, subnet range CIDR, port, dan port range. Secara default, pemindaian ke target IP publik akan diblokir kecuali user mengaktifkan flag `allow_public=True`.
|
|
37
|
+
- **Host Discovery**: Pencarian host aktif di subnet jaringan internal menggunakan ping sweep, ICMP ping, TCP ping, UDP ping, dan ARP lookup lokal.
|
|
38
|
+
- **Port Scanning**: Pencarian port terbuka (TCP Connect scan, UDP basic scan) dengan timeout & thread count yang dapat dikonfigurasi.
|
|
39
|
+
- **Service Detection**: Banner grabbing aman untuk berbagai protokol populer (HTTP, HTTPS, SSH, FTP, SMTP, DNS, MySQL, PostgreSQL, Redis, MongoDB, RDP, SMB) tanpa melakukan serangan brute-force atau eksploitasi celah keamanan.
|
|
40
|
+
- **OS Fingerprinting Heuristik**: Estimasi Operating System berdasarkan nilai TTL (Time To Live), port listening, dan informasi banner.
|
|
41
|
+
- **DNS & Traceroute Tools**: DNS lookup lengkap, reverse DNS PTR resolution, traceroute aman, dan pengecekan subdomain berdasarkan list kustom.
|
|
42
|
+
- **Subnet Tools**: Perhitungan range IP, broadcast address, private/public subnet checks, loopback/multicast check.
|
|
43
|
+
- **Reporting Modular**: Ekspor laporan hasil scanning ke format JSON, CSV, HTML, dan Markdown.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Instalasi
|
|
48
|
+
|
|
49
|
+
Pastikan Anda menggunakan Python 3.10 ke atas.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Clone repository
|
|
53
|
+
git clone https://github.com/user/scannet.git
|
|
54
|
+
cd netscan
|
|
55
|
+
|
|
56
|
+
# Install menggunakan mode edit (-e) agar siap dikembangkan
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Penggunaan CLI
|
|
63
|
+
|
|
64
|
+
Setiap aksi pemindaian membutuhkan konfirmasi autorisasi legal melalui flag `--yes-authorized`.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Bantuan umum CLI
|
|
68
|
+
netscan --help
|
|
69
|
+
|
|
70
|
+
# Pindai port default (top 100) pada localhost
|
|
71
|
+
netscan --target 127.0.0.1 --yes-authorized
|
|
72
|
+
|
|
73
|
+
# Pindai port range spesifik dengan deteksi service dan OS
|
|
74
|
+
netscan --target 127.0.0.1 --ports 22,80,443 --service-detect --os-detect --yes-authorized
|
|
75
|
+
|
|
76
|
+
# Subnet Host Discovery (Ping Sweep)
|
|
77
|
+
netscan --subnet 192.168.1.0/24 --discover --yes-authorized
|
|
78
|
+
|
|
79
|
+
# DNS Record Lookup
|
|
80
|
+
netscan --target google.com --dns --allow-public --yes-authorized
|
|
81
|
+
|
|
82
|
+
# Traceroute Path Analysis
|
|
83
|
+
netscan --target 127.0.0.1 --traceroute --yes-authorized
|
|
84
|
+
|
|
85
|
+
# Ekspor hasil scan ke file HTML
|
|
86
|
+
netscan --target 127.0.0.1 --ports 1-1000 --export html --output report.html --yes-authorized
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Penggunaan Python API
|
|
92
|
+
|
|
93
|
+
### 1. Port Scan & Service Detection
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from scannet import NetScanner
|
|
97
|
+
|
|
98
|
+
# Inisialisasi scanner
|
|
99
|
+
scanner = NetScanner(
|
|
100
|
+
target="127.0.0.1",
|
|
101
|
+
timeout=2.0,
|
|
102
|
+
threads=20,
|
|
103
|
+
rate_limit=10, # 10 request per detik
|
|
104
|
+
authorized=True
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Jalankan scan port dengan service detection
|
|
108
|
+
result = scanner.scan_ports("22,80,443", detect_services=True, detect_os=True)
|
|
109
|
+
print(result)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. Network Discovery Sweep
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from scannet import NetworkDiscovery
|
|
116
|
+
|
|
117
|
+
discovery = NetworkDiscovery(
|
|
118
|
+
subnet="192.168.1.0/24",
|
|
119
|
+
authorized=True
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
hosts = discovery.discover()
|
|
123
|
+
print("Host Aktif:", hosts)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Contoh Hasil Output (Terminal)
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
==================================================
|
|
132
|
+
NETSCAN REPORT
|
|
133
|
+
==================================================
|
|
134
|
+
Scan Duration: 0.85s
|
|
135
|
+
Total Hosts Discovered: 1
|
|
136
|
+
Total Open Ports: 2
|
|
137
|
+
--------------------------------------------------
|
|
138
|
+
|
|
139
|
+
Host: 127.0.0.1 (localhost)
|
|
140
|
+
Estimated OS: Linux/Unix (Estimated, score=3)
|
|
141
|
+
+--------+--------+-----------+-------------------------+
|
|
142
|
+
| Port | State | Service | Banner/Details |
|
|
143
|
+
+========+========+===========+=========================+
|
|
144
|
+
| 22 | open | ssh | SSH-2.0-OpenSSH_8.2p1 |
|
|
145
|
+
+--------+--------+-----------+-------------------------+
|
|
146
|
+
| 80 | open | http | nginx/1.18.0 (Status:200)|
|
|
147
|
+
+--------+--------+-----------+-------------------------+
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Batasan Keamanan & Guardrails
|
|
153
|
+
|
|
154
|
+
Library ini dibangun dengan prinsip pertahanan dan audit internal. Di dalamnya terdapat fitur keamanan terprogram:
|
|
155
|
+
1. **Pernyataan Otorisasi Wajib**: Scan tidak akan berjalan tanpa `authorized=True` / `--yes-authorized`.
|
|
156
|
+
2. **Blokir Target Publik**: Target IP publik diblokir secara default untuk mencegah penyalahgunaan tak sengaja. Harus dilewati dengan `allow_public=True` / `--allow-public`.
|
|
157
|
+
3. **No Exploit & No Brute-Force**: Library ini tidak mengirim payload eksploitasi celah keamanan, bypass firewall, DDoS flooding, brute force password, ataupun stealth scan.
|
|
158
|
+
4. **Rate Limiting**: Kecepatan request per detik dapat dibatasi melalui parameter `rate_limit`.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Legal Disclaimer
|
|
163
|
+
|
|
164
|
+
> [!WARNING]
|
|
165
|
+
> NetScan dibuat khusus untuk tujuan edukasi pembelajaran keamanan siber dan pemantauan resmi aset jaringan internal sendiri. Developer tidak bertanggung jawab atas segala kerusakan, kehilangan data, tuntutan hukum, atau penyalahgunaan yang melanggar hukum setempat yang disebabkan oleh penggunaan tool ini. Anda wajib memiliki izin tertulis resmi sebelum memindai jaringan yang bukan milik Anda pribadi.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Kontribusi & Lisensi
|
|
170
|
+
|
|
171
|
+
Kontribusi dipersilakan dengan membuka Pull Request.
|
|
172
|
+
Berlisensi di bawah **MIT License**.
|
scannet-0.1.0/README.md
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
# NetScan (Network Scanning Library)
|
|
2
|
+
|
|
3
|
+
NetScan adalah sebuah library dan command line interface (CLI) Python yang didesain secara khusus untuk kebutuhan pembelajaran (educational), audit keamanan jaringan internal, inventarisasi perangkat, dan pemantauan keamanan yang legal/authorized-only.
|
|
4
|
+
|
|
5
|
+
## Fitur Utama
|
|
6
|
+
|
|
7
|
+
- **Validasi Target Ketat**: Memvalidasi IP address, domain, subnet range CIDR, port, dan port range. Secara default, pemindaian ke target IP publik akan diblokir kecuali user mengaktifkan flag `allow_public=True`.
|
|
8
|
+
- **Host Discovery**: Pencarian host aktif di subnet jaringan internal menggunakan ping sweep, ICMP ping, TCP ping, UDP ping, dan ARP lookup lokal.
|
|
9
|
+
- **Port Scanning**: Pencarian port terbuka (TCP Connect scan, UDP basic scan) dengan timeout & thread count yang dapat dikonfigurasi.
|
|
10
|
+
- **Service Detection**: Banner grabbing aman untuk berbagai protokol populer (HTTP, HTTPS, SSH, FTP, SMTP, DNS, MySQL, PostgreSQL, Redis, MongoDB, RDP, SMB) tanpa melakukan serangan brute-force atau eksploitasi celah keamanan.
|
|
11
|
+
- **OS Fingerprinting Heuristik**: Estimasi Operating System berdasarkan nilai TTL (Time To Live), port listening, dan informasi banner.
|
|
12
|
+
- **DNS & Traceroute Tools**: DNS lookup lengkap, reverse DNS PTR resolution, traceroute aman, dan pengecekan subdomain berdasarkan list kustom.
|
|
13
|
+
- **Subnet Tools**: Perhitungan range IP, broadcast address, private/public subnet checks, loopback/multicast check.
|
|
14
|
+
- **Reporting Modular**: Ekspor laporan hasil scanning ke format JSON, CSV, HTML, dan Markdown.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Instalasi
|
|
19
|
+
|
|
20
|
+
Pastikan Anda menggunakan Python 3.10 ke atas.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Clone repository
|
|
24
|
+
git clone https://github.com/user/scannet.git
|
|
25
|
+
cd netscan
|
|
26
|
+
|
|
27
|
+
# Install menggunakan mode edit (-e) agar siap dikembangkan
|
|
28
|
+
pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Penggunaan CLI
|
|
34
|
+
|
|
35
|
+
Setiap aksi pemindaian membutuhkan konfirmasi autorisasi legal melalui flag `--yes-authorized`.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# Bantuan umum CLI
|
|
39
|
+
netscan --help
|
|
40
|
+
|
|
41
|
+
# Pindai port default (top 100) pada localhost
|
|
42
|
+
netscan --target 127.0.0.1 --yes-authorized
|
|
43
|
+
|
|
44
|
+
# Pindai port range spesifik dengan deteksi service dan OS
|
|
45
|
+
netscan --target 127.0.0.1 --ports 22,80,443 --service-detect --os-detect --yes-authorized
|
|
46
|
+
|
|
47
|
+
# Subnet Host Discovery (Ping Sweep)
|
|
48
|
+
netscan --subnet 192.168.1.0/24 --discover --yes-authorized
|
|
49
|
+
|
|
50
|
+
# DNS Record Lookup
|
|
51
|
+
netscan --target google.com --dns --allow-public --yes-authorized
|
|
52
|
+
|
|
53
|
+
# Traceroute Path Analysis
|
|
54
|
+
netscan --target 127.0.0.1 --traceroute --yes-authorized
|
|
55
|
+
|
|
56
|
+
# Ekspor hasil scan ke file HTML
|
|
57
|
+
netscan --target 127.0.0.1 --ports 1-1000 --export html --output report.html --yes-authorized
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Penggunaan Python API
|
|
63
|
+
|
|
64
|
+
### 1. Port Scan & Service Detection
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from scannet import NetScanner
|
|
68
|
+
|
|
69
|
+
# Inisialisasi scanner
|
|
70
|
+
scanner = NetScanner(
|
|
71
|
+
target="127.0.0.1",
|
|
72
|
+
timeout=2.0,
|
|
73
|
+
threads=20,
|
|
74
|
+
rate_limit=10, # 10 request per detik
|
|
75
|
+
authorized=True
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
# Jalankan scan port dengan service detection
|
|
79
|
+
result = scanner.scan_ports("22,80,443", detect_services=True, detect_os=True)
|
|
80
|
+
print(result)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### 2. Network Discovery Sweep
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from scannet import NetworkDiscovery
|
|
87
|
+
|
|
88
|
+
discovery = NetworkDiscovery(
|
|
89
|
+
subnet="192.168.1.0/24",
|
|
90
|
+
authorized=True
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
hosts = discovery.discover()
|
|
94
|
+
print("Host Aktif:", hosts)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Contoh Hasil Output (Terminal)
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
==================================================
|
|
103
|
+
NETSCAN REPORT
|
|
104
|
+
==================================================
|
|
105
|
+
Scan Duration: 0.85s
|
|
106
|
+
Total Hosts Discovered: 1
|
|
107
|
+
Total Open Ports: 2
|
|
108
|
+
--------------------------------------------------
|
|
109
|
+
|
|
110
|
+
Host: 127.0.0.1 (localhost)
|
|
111
|
+
Estimated OS: Linux/Unix (Estimated, score=3)
|
|
112
|
+
+--------+--------+-----------+-------------------------+
|
|
113
|
+
| Port | State | Service | Banner/Details |
|
|
114
|
+
+========+========+===========+=========================+
|
|
115
|
+
| 22 | open | ssh | SSH-2.0-OpenSSH_8.2p1 |
|
|
116
|
+
+--------+--------+-----------+-------------------------+
|
|
117
|
+
| 80 | open | http | nginx/1.18.0 (Status:200)|
|
|
118
|
+
+--------+--------+-----------+-------------------------+
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Batasan Keamanan & Guardrails
|
|
124
|
+
|
|
125
|
+
Library ini dibangun dengan prinsip pertahanan dan audit internal. Di dalamnya terdapat fitur keamanan terprogram:
|
|
126
|
+
1. **Pernyataan Otorisasi Wajib**: Scan tidak akan berjalan tanpa `authorized=True` / `--yes-authorized`.
|
|
127
|
+
2. **Blokir Target Publik**: Target IP publik diblokir secara default untuk mencegah penyalahgunaan tak sengaja. Harus dilewati dengan `allow_public=True` / `--allow-public`.
|
|
128
|
+
3. **No Exploit & No Brute-Force**: Library ini tidak mengirim payload eksploitasi celah keamanan, bypass firewall, DDoS flooding, brute force password, ataupun stealth scan.
|
|
129
|
+
4. **Rate Limiting**: Kecepatan request per detik dapat dibatasi melalui parameter `rate_limit`.
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Legal Disclaimer
|
|
134
|
+
|
|
135
|
+
> [!WARNING]
|
|
136
|
+
> NetScan dibuat khusus untuk tujuan edukasi pembelajaran keamanan siber dan pemantauan resmi aset jaringan internal sendiri. Developer tidak bertanggung jawab atas segala kerusakan, kehilangan data, tuntutan hukum, atau penyalahgunaan yang melanggar hukum setempat yang disebabkan oleh penggunaan tool ini. Anda wajib memiliki izin tertulis resmi sebelum memindai jaringan yang bukan milik Anda pribadi.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Kontribusi & Lisensi
|
|
141
|
+
|
|
142
|
+
Kontribusi dipersilakan dengan membuka Pull Request.
|
|
143
|
+
Berlisensi di bawah **MIT License**.
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ScanNet
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A safe, educational, authorized-only network scanning library
|
|
5
|
+
Home-page: https://github.com/user/netscan
|
|
6
|
+
Author: NetScan Team
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: click>=8.0.0
|
|
15
|
+
Requires-Dist: rich>=12.0.0
|
|
16
|
+
Requires-Dist: dnspython>=2.2.0
|
|
17
|
+
Requires-Dist: requests>=2.27.0
|
|
18
|
+
Requires-Dist: python-whois>=0.7.3
|
|
19
|
+
Requires-Dist: tabulate>=0.8.9
|
|
20
|
+
Dynamic: author
|
|
21
|
+
Dynamic: classifier
|
|
22
|
+
Dynamic: description
|
|
23
|
+
Dynamic: description-content-type
|
|
24
|
+
Dynamic: home-page
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
Dynamic: requires-dist
|
|
27
|
+
Dynamic: requires-python
|
|
28
|
+
Dynamic: summary
|
|
29
|
+
|
|
30
|
+
# NetScan (Network Scanning Library)
|
|
31
|
+
|
|
32
|
+
NetScan adalah sebuah library dan command line interface (CLI) Python yang didesain secara khusus untuk kebutuhan pembelajaran (educational), audit keamanan jaringan internal, inventarisasi perangkat, dan pemantauan keamanan yang legal/authorized-only.
|
|
33
|
+
|
|
34
|
+
## Fitur Utama
|
|
35
|
+
|
|
36
|
+
- **Validasi Target Ketat**: Memvalidasi IP address, domain, subnet range CIDR, port, dan port range. Secara default, pemindaian ke target IP publik akan diblokir kecuali user mengaktifkan flag `allow_public=True`.
|
|
37
|
+
- **Host Discovery**: Pencarian host aktif di subnet jaringan internal menggunakan ping sweep, ICMP ping, TCP ping, UDP ping, dan ARP lookup lokal.
|
|
38
|
+
- **Port Scanning**: Pencarian port terbuka (TCP Connect scan, UDP basic scan) dengan timeout & thread count yang dapat dikonfigurasi.
|
|
39
|
+
- **Service Detection**: Banner grabbing aman untuk berbagai protokol populer (HTTP, HTTPS, SSH, FTP, SMTP, DNS, MySQL, PostgreSQL, Redis, MongoDB, RDP, SMB) tanpa melakukan serangan brute-force atau eksploitasi celah keamanan.
|
|
40
|
+
- **OS Fingerprinting Heuristik**: Estimasi Operating System berdasarkan nilai TTL (Time To Live), port listening, dan informasi banner.
|
|
41
|
+
- **DNS & Traceroute Tools**: DNS lookup lengkap, reverse DNS PTR resolution, traceroute aman, dan pengecekan subdomain berdasarkan list kustom.
|
|
42
|
+
- **Subnet Tools**: Perhitungan range IP, broadcast address, private/public subnet checks, loopback/multicast check.
|
|
43
|
+
- **Reporting Modular**: Ekspor laporan hasil scanning ke format JSON, CSV, HTML, dan Markdown.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Instalasi
|
|
48
|
+
|
|
49
|
+
Pastikan Anda menggunakan Python 3.10 ke atas.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Clone repository
|
|
53
|
+
git clone https://github.com/user/scannet.git
|
|
54
|
+
cd netscan
|
|
55
|
+
|
|
56
|
+
# Install menggunakan mode edit (-e) agar siap dikembangkan
|
|
57
|
+
pip install -e .
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Penggunaan CLI
|
|
63
|
+
|
|
64
|
+
Setiap aksi pemindaian membutuhkan konfirmasi autorisasi legal melalui flag `--yes-authorized`.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Bantuan umum CLI
|
|
68
|
+
netscan --help
|
|
69
|
+
|
|
70
|
+
# Pindai port default (top 100) pada localhost
|
|
71
|
+
netscan --target 127.0.0.1 --yes-authorized
|
|
72
|
+
|
|
73
|
+
# Pindai port range spesifik dengan deteksi service dan OS
|
|
74
|
+
netscan --target 127.0.0.1 --ports 22,80,443 --service-detect --os-detect --yes-authorized
|
|
75
|
+
|
|
76
|
+
# Subnet Host Discovery (Ping Sweep)
|
|
77
|
+
netscan --subnet 192.168.1.0/24 --discover --yes-authorized
|
|
78
|
+
|
|
79
|
+
# DNS Record Lookup
|
|
80
|
+
netscan --target google.com --dns --allow-public --yes-authorized
|
|
81
|
+
|
|
82
|
+
# Traceroute Path Analysis
|
|
83
|
+
netscan --target 127.0.0.1 --traceroute --yes-authorized
|
|
84
|
+
|
|
85
|
+
# Ekspor hasil scan ke file HTML
|
|
86
|
+
netscan --target 127.0.0.1 --ports 1-1000 --export html --output report.html --yes-authorized
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Penggunaan Python API
|
|
92
|
+
|
|
93
|
+
### 1. Port Scan & Service Detection
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from scannet import NetScanner
|
|
97
|
+
|
|
98
|
+
# Inisialisasi scanner
|
|
99
|
+
scanner = NetScanner(
|
|
100
|
+
target="127.0.0.1",
|
|
101
|
+
timeout=2.0,
|
|
102
|
+
threads=20,
|
|
103
|
+
rate_limit=10, # 10 request per detik
|
|
104
|
+
authorized=True
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
# Jalankan scan port dengan service detection
|
|
108
|
+
result = scanner.scan_ports("22,80,443", detect_services=True, detect_os=True)
|
|
109
|
+
print(result)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 2. Network Discovery Sweep
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from scannet import NetworkDiscovery
|
|
116
|
+
|
|
117
|
+
discovery = NetworkDiscovery(
|
|
118
|
+
subnet="192.168.1.0/24",
|
|
119
|
+
authorized=True
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
hosts = discovery.discover()
|
|
123
|
+
print("Host Aktif:", hosts)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Contoh Hasil Output (Terminal)
|
|
129
|
+
|
|
130
|
+
```text
|
|
131
|
+
==================================================
|
|
132
|
+
NETSCAN REPORT
|
|
133
|
+
==================================================
|
|
134
|
+
Scan Duration: 0.85s
|
|
135
|
+
Total Hosts Discovered: 1
|
|
136
|
+
Total Open Ports: 2
|
|
137
|
+
--------------------------------------------------
|
|
138
|
+
|
|
139
|
+
Host: 127.0.0.1 (localhost)
|
|
140
|
+
Estimated OS: Linux/Unix (Estimated, score=3)
|
|
141
|
+
+--------+--------+-----------+-------------------------+
|
|
142
|
+
| Port | State | Service | Banner/Details |
|
|
143
|
+
+========+========+===========+=========================+
|
|
144
|
+
| 22 | open | ssh | SSH-2.0-OpenSSH_8.2p1 |
|
|
145
|
+
+--------+--------+-----------+-------------------------+
|
|
146
|
+
| 80 | open | http | nginx/1.18.0 (Status:200)|
|
|
147
|
+
+--------+--------+-----------+-------------------------+
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Batasan Keamanan & Guardrails
|
|
153
|
+
|
|
154
|
+
Library ini dibangun dengan prinsip pertahanan dan audit internal. Di dalamnya terdapat fitur keamanan terprogram:
|
|
155
|
+
1. **Pernyataan Otorisasi Wajib**: Scan tidak akan berjalan tanpa `authorized=True` / `--yes-authorized`.
|
|
156
|
+
2. **Blokir Target Publik**: Target IP publik diblokir secara default untuk mencegah penyalahgunaan tak sengaja. Harus dilewati dengan `allow_public=True` / `--allow-public`.
|
|
157
|
+
3. **No Exploit & No Brute-Force**: Library ini tidak mengirim payload eksploitasi celah keamanan, bypass firewall, DDoS flooding, brute force password, ataupun stealth scan.
|
|
158
|
+
4. **Rate Limiting**: Kecepatan request per detik dapat dibatasi melalui parameter `rate_limit`.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Legal Disclaimer
|
|
163
|
+
|
|
164
|
+
> [!WARNING]
|
|
165
|
+
> NetScan dibuat khusus untuk tujuan edukasi pembelajaran keamanan siber dan pemantauan resmi aset jaringan internal sendiri. Developer tidak bertanggung jawab atas segala kerusakan, kehilangan data, tuntutan hukum, atau penyalahgunaan yang melanggar hukum setempat yang disebabkan oleh penggunaan tool ini. Anda wajib memiliki izin tertulis resmi sebelum memindai jaringan yang bukan milik Anda pribadi.
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Kontribusi & Lisensi
|
|
170
|
+
|
|
171
|
+
Kontribusi dipersilakan dengan membuka Pull Request.
|
|
172
|
+
Berlisensi di bawah **MIT License**.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
setup.py
|
|
5
|
+
ScanNet.egg-info/PKG-INFO
|
|
6
|
+
ScanNet.egg-info/SOURCES.txt
|
|
7
|
+
ScanNet.egg-info/dependency_links.txt
|
|
8
|
+
ScanNet.egg-info/entry_points.txt
|
|
9
|
+
ScanNet.egg-info/requires.txt
|
|
10
|
+
ScanNet.egg-info/top_level.txt
|
|
11
|
+
scannet/__init__.py
|
|
12
|
+
scannet/cli.py
|
|
13
|
+
scannet/core/__init__.py
|
|
14
|
+
scannet/core/dns_tools.py
|
|
15
|
+
scannet/core/host_discovery.py
|
|
16
|
+
scannet/core/os_detector.py
|
|
17
|
+
scannet/core/ping.py
|
|
18
|
+
scannet/core/port_scanner.py
|
|
19
|
+
scannet/core/scanner.py
|
|
20
|
+
scannet/core/service_detector.py
|
|
21
|
+
scannet/core/subnet.py
|
|
22
|
+
scannet/core/traceroute.py
|
|
23
|
+
scannet/core/validator.py
|
|
24
|
+
scannet/core/whois_tools.py
|
|
25
|
+
scannet/protocols/__init__.py
|
|
26
|
+
scannet/protocols/dns.py
|
|
27
|
+
scannet/protocols/ftp.py
|
|
28
|
+
scannet/protocols/http.py
|
|
29
|
+
scannet/protocols/https.py
|
|
30
|
+
scannet/protocols/icmp.py
|
|
31
|
+
scannet/protocols/smtp.py
|
|
32
|
+
scannet/protocols/snmp.py
|
|
33
|
+
scannet/protocols/ssh.py
|
|
34
|
+
scannet/protocols/tcp.py
|
|
35
|
+
scannet/protocols/udp.py
|
|
36
|
+
scannet/report/__init__.py
|
|
37
|
+
scannet/report/csv_report.py
|
|
38
|
+
scannet/report/html_report.py
|
|
39
|
+
scannet/report/json_report.py
|
|
40
|
+
scannet/report/markdown_report.py
|
|
41
|
+
scannet/utils/__init__.py
|
|
42
|
+
scannet/utils/config.py
|
|
43
|
+
scannet/utils/exceptions.py
|
|
44
|
+
scannet/utils/exporter.py
|
|
45
|
+
scannet/utils/formatter.py
|
|
46
|
+
scannet/utils/helpers.py
|
|
47
|
+
scannet/utils/logger.py
|
|
48
|
+
scannet/utils/rate_limiter.py
|
|
49
|
+
tests/test_exporter.py
|
|
50
|
+
tests/test_port_scanner.py
|
|
51
|
+
tests/test_subnet.py
|
|
52
|
+
tests/test_validator.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
scannet
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# NetScan package API initialization
|
|
2
|
+
from scannet.core.scanner import NetScanner
|
|
3
|
+
from scannet.core.host_discovery import NetworkDiscovery
|
|
4
|
+
from scannet.core.subnet import SubnetTools
|
|
5
|
+
from scannet.core.dns_tools import DNSTools
|
|
6
|
+
from scannet.core.traceroute import Traceroute
|
|
7
|
+
|
|
8
|
+
__version__ = "0.1.0"
|
|
9
|
+
__all__ = [
|
|
10
|
+
"NetScanner",
|
|
11
|
+
"NetworkDiscovery",
|
|
12
|
+
"SubnetTools",
|
|
13
|
+
"DNSTools",
|
|
14
|
+
"Traceroute"
|
|
15
|
+
]
|