ghostnet 1.2.1__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.
ghostnet-1.2.1/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jeff Mutugi
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.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghostnet
3
+ Version: 1.2.1
4
+ Summary: GhostNet - Advanced Network Scanner (nmap-style, pure Python)
5
+ Author: Jeff Mutugi
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Debug-Jeff/GhostNet
8
+ Project-URL: Repository, https://github.com/Debug-Jeff/GhostNet
9
+ Project-URL: Changelog, https://github.com/Debug-Jeff/GhostNet/blob/main/CHANGELOG.md
10
+ Keywords: network,security,scanner,nmap,port-scanner,pentest
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Information Technology
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Security
19
+ Classifier: Topic :: System :: Networking
20
+ Requires-Python: >=3.8
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: requests>=2.25.1
24
+ Requires-Dist: beautifulsoup4>=4.9.3
25
+ Requires-Dist: pytz>=2021.1
26
+ Requires-Dist: colorama>=0.4.4
27
+ Requires-Dist: dnspython>=2.1.0
28
+ Requires-Dist: xmltodict>=0.12.0
29
+ Requires-Dist: python-whois>=0.7.3
30
+ Requires-Dist: cryptography>=38.0.1
31
+ Provides-Extra: full
32
+ Requires-Dist: scapy>=2.4.5; extra == "full"
33
+ Requires-Dist: impacket>=0.10.0; extra == "full"
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # GhostNet — Advanced Network Scanner
39
+
40
+ [![CI](https://github.com/Debug-Jeff/GhostNet/actions/workflows/ci.yml/badge.svg)](https://github.com/Debug-Jeff/GhostNet/actions/workflows/ci.yml)
41
+
42
+ An nmap-style network scanner in Python: host discovery, port scanning,
43
+ service/OS detection, lightweight web checks, and traceroute mapping — via a
44
+ CLI or an interactive menu.
45
+
46
+ > SYN scanning, OS fingerprinting, traceroute and MAC spoofing need
47
+ > [scapy](https://scapy.net/) and usually root. Without it, GhostNet falls back
48
+ > to TCP connect scanning and banner-based detection.
49
+
50
+ ## Install
51
+
52
+ The easiest way — no cloning, no source — is [pipx](https://pipx.pypa.io),
53
+ which installs the `ghostnet` command into its own isolated environment:
54
+
55
+ ```bash
56
+ pipx install git+https://github.com/Debug-Jeff/GhostNet # core
57
+ pipx install "ghostnet[full] @ git+https://github.com/Debug-Jeff/GhostNet" # + scapy/impacket
58
+
59
+ ghostnet -t 127.0.0.1 # first scan
60
+ ghostnet # interactive menu
61
+ ```
62
+
63
+ Installed the core already and want scapy/impacket later? pipx keeps GhostNet
64
+ in its own environment, so a global `pip install scapy` won't be seen — inject
65
+ them into GhostNet's environment instead:
66
+
67
+ ```bash
68
+ pipx inject ghostnet scapy impacket
69
+ ```
70
+
71
+ (SYN/OS scans on Windows also need Npcap and an administrator shell. Once the
72
+ first release is published to PyPI this becomes simply `pipx install ghostnet`
73
+ — the release workflow publishes automatically when a `v*` tag is pushed.)
74
+
75
+ ### Don't have pipx?
76
+
77
+ Install it, then **open a new terminal** so the `pipx` command is on your PATH
78
+ (skipping that restart is the usual cause of "pipx is not recognized").
79
+
80
+ **Windows (PowerShell):**
81
+ ```powershell
82
+ py -m pip install --user pipx
83
+ py -m pipx ensurepath
84
+ # close and reopen PowerShell, then:
85
+ pipx install git+https://github.com/Debug-Jeff/GhostNet
86
+ ```
87
+ (If `py` isn't found, use `python` instead.)
88
+
89
+ **macOS:**
90
+ ```bash
91
+ brew install pipx # or: python3 -m pip install --user pipx
92
+ pipx ensurepath # then restart the terminal
93
+ ```
94
+
95
+ **Linux (Debian/Ubuntu):**
96
+ ```bash
97
+ sudo apt install pipx # or: python3 -m pip install --user pipx
98
+ pipx ensurepath # then restart the terminal
99
+ ```
100
+
101
+ Prefer not to use pipx at all? Install into a virtual environment instead —
102
+ see **From source** below.
103
+
104
+ ### From source (for development)
105
+
106
+ ```bash
107
+ git clone https://github.com/Debug-Jeff/GhostNet.git
108
+ cd GhostNet
109
+ python3 -m venv .venv
110
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
111
+ pip install -r requirements.txt
112
+ python main.py -t 127.0.0.1
113
+ ```
114
+
115
+ Run `ghostnet`/`python main.py` with **no arguments** for the interactive
116
+ menu, or pass any flag to use the CLI (scriptable, returns an exit code).
117
+ `scapy`/`impacket` are optional — missing ones just disable their features,
118
+ and raw-socket scans (`--syn-scan`, `--traceroute`) still need `sudo`.
119
+
120
+ ## Usage
121
+
122
+ ```bash
123
+ ghostnet -t 192.168.1.1 # common ports
124
+ ghostnet -t 192.168.1.0/24 -p- # whole subnet, all 65535 ports
125
+ ghostnet -t host -A # aggressive: -sV -O -b
126
+ ghostnet -t host -sV -T4 # version detection, fast timing
127
+ ghostnet -t 192.168.1.0/24 -sn # host discovery (ping sweep) only
128
+ sudo ghostnet -t host --syn-scan # SYN scan (scapy/root)
129
+ ghostnet -t host -oA results # write results.txt/.json/.xml
130
+ ghostnet -t host --vuln-scan # vulnerability checks
131
+ ghostnet --update-db # refresh local NVD DB (API key)
132
+ ```
133
+
134
+ (From source, use `python main.py` in place of `ghostnet`.) Handy flags:
135
+ `-A` aggressive, `-T0..-T5` timing (paranoid→insane), `-sn` ping sweep,
136
+ `-Pn` skip discovery, `-p-` all ports, `-n` no DNS, `-oA` all output formats.
137
+ Full reference: `ghostnet --help`.
138
+
139
+ **NVD API key** — `--update-db` and live NVD lookups need a free key from
140
+ <https://nvd.nist.gov/developers/request-an-api-key>, via the `NVD_API_KEY`
141
+ environment variable or a `.env` file in the project root.
142
+
143
+ ## Tests
144
+
145
+ ```bash
146
+ pip install pytest # or: pip install '.[dev]'
147
+ python -m pytest tests/ -v
148
+ ```
149
+
150
+ Runs in CI on Python 3.9–3.12; passes without scapy/impacket.
151
+
152
+ ## Notes
153
+
154
+ - `-sV` is banner/probe-driven, not a full nmap-style version database.
155
+ - Rate controls: `--max-rate` caps throughput, `--min-rate` is a floor on that
156
+ cap, `--max-retries` retries lossy UDP/SYN probes. `--data-length` is
157
+ accepted but not yet applied.
158
+
159
+ ## Project layout
160
+
161
+ The code lives in the `ghostnet/` package — `cli` (flags/dispatch), `menu`
162
+ (interactive mode), `engine` (the scanner), `detectors`, `webapp`, `netmap`,
163
+ `reporting`, `vulndb`, `config`, `parsing`, and `constants` (shared globals and
164
+ optional-dependency symbols). A thin `main.py` shim re-exports the package so
165
+ `import main` and `python main.py` still work; `python -m ghostnet` works too.
166
+
167
+ ## Disclaimer
168
+
169
+ For authorized security assessment only. Scanning systems without explicit
170
+ permission is illegal in many jurisdictions — only scan what you own or are
171
+ permitted to test.
172
+
173
+ ## License
174
+
175
+ MIT — see the LICENSE file.
@@ -0,0 +1,138 @@
1
+ # GhostNet — Advanced Network Scanner
2
+
3
+ [![CI](https://github.com/Debug-Jeff/GhostNet/actions/workflows/ci.yml/badge.svg)](https://github.com/Debug-Jeff/GhostNet/actions/workflows/ci.yml)
4
+
5
+ An nmap-style network scanner in Python: host discovery, port scanning,
6
+ service/OS detection, lightweight web checks, and traceroute mapping — via a
7
+ CLI or an interactive menu.
8
+
9
+ > SYN scanning, OS fingerprinting, traceroute and MAC spoofing need
10
+ > [scapy](https://scapy.net/) and usually root. Without it, GhostNet falls back
11
+ > to TCP connect scanning and banner-based detection.
12
+
13
+ ## Install
14
+
15
+ The easiest way — no cloning, no source — is [pipx](https://pipx.pypa.io),
16
+ which installs the `ghostnet` command into its own isolated environment:
17
+
18
+ ```bash
19
+ pipx install git+https://github.com/Debug-Jeff/GhostNet # core
20
+ pipx install "ghostnet[full] @ git+https://github.com/Debug-Jeff/GhostNet" # + scapy/impacket
21
+
22
+ ghostnet -t 127.0.0.1 # first scan
23
+ ghostnet # interactive menu
24
+ ```
25
+
26
+ Installed the core already and want scapy/impacket later? pipx keeps GhostNet
27
+ in its own environment, so a global `pip install scapy` won't be seen — inject
28
+ them into GhostNet's environment instead:
29
+
30
+ ```bash
31
+ pipx inject ghostnet scapy impacket
32
+ ```
33
+
34
+ (SYN/OS scans on Windows also need Npcap and an administrator shell. Once the
35
+ first release is published to PyPI this becomes simply `pipx install ghostnet`
36
+ — the release workflow publishes automatically when a `v*` tag is pushed.)
37
+
38
+ ### Don't have pipx?
39
+
40
+ Install it, then **open a new terminal** so the `pipx` command is on your PATH
41
+ (skipping that restart is the usual cause of "pipx is not recognized").
42
+
43
+ **Windows (PowerShell):**
44
+ ```powershell
45
+ py -m pip install --user pipx
46
+ py -m pipx ensurepath
47
+ # close and reopen PowerShell, then:
48
+ pipx install git+https://github.com/Debug-Jeff/GhostNet
49
+ ```
50
+ (If `py` isn't found, use `python` instead.)
51
+
52
+ **macOS:**
53
+ ```bash
54
+ brew install pipx # or: python3 -m pip install --user pipx
55
+ pipx ensurepath # then restart the terminal
56
+ ```
57
+
58
+ **Linux (Debian/Ubuntu):**
59
+ ```bash
60
+ sudo apt install pipx # or: python3 -m pip install --user pipx
61
+ pipx ensurepath # then restart the terminal
62
+ ```
63
+
64
+ Prefer not to use pipx at all? Install into a virtual environment instead —
65
+ see **From source** below.
66
+
67
+ ### From source (for development)
68
+
69
+ ```bash
70
+ git clone https://github.com/Debug-Jeff/GhostNet.git
71
+ cd GhostNet
72
+ python3 -m venv .venv
73
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
74
+ pip install -r requirements.txt
75
+ python main.py -t 127.0.0.1
76
+ ```
77
+
78
+ Run `ghostnet`/`python main.py` with **no arguments** for the interactive
79
+ menu, or pass any flag to use the CLI (scriptable, returns an exit code).
80
+ `scapy`/`impacket` are optional — missing ones just disable their features,
81
+ and raw-socket scans (`--syn-scan`, `--traceroute`) still need `sudo`.
82
+
83
+ ## Usage
84
+
85
+ ```bash
86
+ ghostnet -t 192.168.1.1 # common ports
87
+ ghostnet -t 192.168.1.0/24 -p- # whole subnet, all 65535 ports
88
+ ghostnet -t host -A # aggressive: -sV -O -b
89
+ ghostnet -t host -sV -T4 # version detection, fast timing
90
+ ghostnet -t 192.168.1.0/24 -sn # host discovery (ping sweep) only
91
+ sudo ghostnet -t host --syn-scan # SYN scan (scapy/root)
92
+ ghostnet -t host -oA results # write results.txt/.json/.xml
93
+ ghostnet -t host --vuln-scan # vulnerability checks
94
+ ghostnet --update-db # refresh local NVD DB (API key)
95
+ ```
96
+
97
+ (From source, use `python main.py` in place of `ghostnet`.) Handy flags:
98
+ `-A` aggressive, `-T0..-T5` timing (paranoid→insane), `-sn` ping sweep,
99
+ `-Pn` skip discovery, `-p-` all ports, `-n` no DNS, `-oA` all output formats.
100
+ Full reference: `ghostnet --help`.
101
+
102
+ **NVD API key** — `--update-db` and live NVD lookups need a free key from
103
+ <https://nvd.nist.gov/developers/request-an-api-key>, via the `NVD_API_KEY`
104
+ environment variable or a `.env` file in the project root.
105
+
106
+ ## Tests
107
+
108
+ ```bash
109
+ pip install pytest # or: pip install '.[dev]'
110
+ python -m pytest tests/ -v
111
+ ```
112
+
113
+ Runs in CI on Python 3.9–3.12; passes without scapy/impacket.
114
+
115
+ ## Notes
116
+
117
+ - `-sV` is banner/probe-driven, not a full nmap-style version database.
118
+ - Rate controls: `--max-rate` caps throughput, `--min-rate` is a floor on that
119
+ cap, `--max-retries` retries lossy UDP/SYN probes. `--data-length` is
120
+ accepted but not yet applied.
121
+
122
+ ## Project layout
123
+
124
+ The code lives in the `ghostnet/` package — `cli` (flags/dispatch), `menu`
125
+ (interactive mode), `engine` (the scanner), `detectors`, `webapp`, `netmap`,
126
+ `reporting`, `vulndb`, `config`, `parsing`, and `constants` (shared globals and
127
+ optional-dependency symbols). A thin `main.py` shim re-exports the package so
128
+ `import main` and `python main.py` still work; `python -m ghostnet` works too.
129
+
130
+ ## Disclaimer
131
+
132
+ For authorized security assessment only. Scanning systems without explicit
133
+ permission is illegal in many jurisdictions — only scan what you own or are
134
+ permitted to test.
135
+
136
+ ## License
137
+
138
+ MIT — see the LICENSE file.
@@ -0,0 +1,6 @@
1
+ # -*- coding: utf-8 -*-
2
+ """GhostNet - Advanced Network Scanner."""
3
+ from .constants import VERSION as __version__
4
+ from .cli import main
5
+
6
+ __all__ = ["main", "__version__"]
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ import sys
3
+ import time
4
+ from .cli import main
5
+ from .constants import Colors
6
+
7
+
8
+ def _run():
9
+ exit_code = 0
10
+ try:
11
+ exit_code = main()
12
+ except KeyboardInterrupt:
13
+ print(f"\n{Colors.BRIGHT_RED}Program terminated by user.{Colors.RESET}")
14
+ exit_code = 130
15
+ except Exception as e:
16
+ print(f"\n{Colors.BRIGHT_RED}An unexpected error occurred: {e}{Colors.RESET}")
17
+ exit_code = 1
18
+ finally:
19
+ if len(sys.argv) <= 1:
20
+ time.sleep(1.5)
21
+ sys.exit(exit_code)
22
+
23
+
24
+ if __name__ == "__main__":
25
+ _run()