ghostport-cli 0.1.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.
- ghostport_cli-0.1.1/.github/workflows/ci.yml +33 -0
- ghostport_cli-0.1.1/.github/workflows/publish.yml +38 -0
- ghostport_cli-0.1.1/.gitignore +11 -0
- ghostport_cli-0.1.1/CONTRIBUTING.md +132 -0
- ghostport_cli-0.1.1/LICENSE +21 -0
- ghostport_cli-0.1.1/PKG-INFO +358 -0
- ghostport_cli-0.1.1/README.md +326 -0
- ghostport_cli-0.1.1/SECURITY.md +21 -0
- ghostport_cli-0.1.1/pyproject.toml +68 -0
- ghostport_cli-0.1.1/src/ghostport/__init__.py +3 -0
- ghostport_cli-0.1.1/src/ghostport/__main__.py +4 -0
- ghostport_cli-0.1.1/src/ghostport/cli.py +111 -0
- ghostport_cli-0.1.1/src/ghostport/http_probe.py +133 -0
- ghostport_cli-0.1.1/src/ghostport/inspector.py +83 -0
- ghostport_cli-0.1.1/src/ghostport/models.py +154 -0
- ghostport_cli-0.1.1/src/ghostport/process.py +96 -0
- ghostport_cli-0.1.1/src/ghostport/py.typed +0 -0
- ghostport_cli-0.1.1/src/ghostport/redact.py +79 -0
- ghostport_cli-0.1.1/src/ghostport/render.py +137 -0
- ghostport_cli-0.1.1/src/ghostport/tcp.py +69 -0
- ghostport_cli-0.1.1/tests/conftest.py +106 -0
- ghostport_cli-0.1.1/tests/test_cli.py +149 -0
- ghostport_cli-0.1.1/tests/test_http_probe.py +106 -0
- ghostport_cli-0.1.1/tests/test_process.py +140 -0
- ghostport_cli-0.1.1/tests/test_redact.py +28 -0
- ghostport_cli-0.1.1/tests/test_tcp.py +57 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
test:
|
|
13
|
+
name: ${{ matrix.os }} / py${{ matrix.python-version }}
|
|
14
|
+
runs-on: ${{ matrix.os }}
|
|
15
|
+
strategy:
|
|
16
|
+
fail-fast: false
|
|
17
|
+
matrix:
|
|
18
|
+
os: [windows-latest, ubuntu-latest, macos-latest]
|
|
19
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v4
|
|
22
|
+
- uses: actions/setup-python@v5
|
|
23
|
+
with:
|
|
24
|
+
python-version: ${{ matrix.python-version }}
|
|
25
|
+
cache: pip
|
|
26
|
+
- name: Install
|
|
27
|
+
run: python -m pip install -e ".[dev]"
|
|
28
|
+
- name: Lint
|
|
29
|
+
run: ruff check .
|
|
30
|
+
- name: Format check
|
|
31
|
+
run: ruff format --check .
|
|
32
|
+
- name: Test
|
|
33
|
+
run: python -m pytest
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-python@v5
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.12"
|
|
18
|
+
- name: Build
|
|
19
|
+
run: |
|
|
20
|
+
python -m pip install build
|
|
21
|
+
python -m build
|
|
22
|
+
- uses: actions/upload-artifact@v4
|
|
23
|
+
with:
|
|
24
|
+
name: dist
|
|
25
|
+
path: dist/
|
|
26
|
+
|
|
27
|
+
publish:
|
|
28
|
+
needs: build
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
environment: pypi
|
|
31
|
+
permissions:
|
|
32
|
+
id-token: write
|
|
33
|
+
steps:
|
|
34
|
+
- uses: actions/download-artifact@v4
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/
|
|
38
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# 🌱 Contributing to GhostPort
|
|
2
|
+
|
|
3
|
+
**Welcome to the little corner of cyberspace where GhostPort lives.**
|
|
4
|
+
|
|
5
|
+
GhostPort is a CyberStudios™ open-source project built around a simple idea: developer tools can be lightweight, reliable, and pleasant to use.
|
|
6
|
+
|
|
7
|
+
Whether you're fixing a bug, improving documentation, adding a regression test, or investigating a platform-specific issue, contributions are welcome.
|
|
8
|
+
|
|
9
|
+
## ✦ Before You Begin
|
|
10
|
+
|
|
11
|
+
GhostPort is intentionally focused.
|
|
12
|
+
|
|
13
|
+
Its purpose is to inspect local TCP ports and report observable diagnostic information. Contributions should preserve that purpose rather than expand the project into a general-purpose network scanner.
|
|
14
|
+
|
|
15
|
+
For larger features, please open an issue to discuss the proposed scope before implementation.
|
|
16
|
+
|
|
17
|
+
## 🖥️ Development Setup
|
|
18
|
+
|
|
19
|
+
Requires Python 3.11 or newer.
|
|
20
|
+
|
|
21
|
+
Clone the repository:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
git clone https://github.com/CyberStudiosTM/GhostPort.git
|
|
25
|
+
cd GhostPort
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Create a virtual environment:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m venv .venv
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Activate it on Windows PowerShell:
|
|
35
|
+
|
|
36
|
+
```powershell
|
|
37
|
+
.\.venv\Scripts\Activate.ps1
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Or on Linux/macOS:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
source .venv/bin/activate
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Install development dependencies:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
python -m pip install -e ".[dev]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 🧪 Test Before You Submit
|
|
53
|
+
|
|
54
|
+
Run the project's checks:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
ruff check .
|
|
58
|
+
ruff format --check .
|
|
59
|
+
python -m pytest
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The GitHub Actions workflow also tests Windows, Ubuntu, and macOS across supported Python versions.
|
|
63
|
+
|
|
64
|
+
If a check cannot run in your environment, explain that limitation in your pull request.
|
|
65
|
+
|
|
66
|
+
## 🌿 Contribution Guidelines
|
|
67
|
+
|
|
68
|
+
### Keep it local
|
|
69
|
+
|
|
70
|
+
GhostPort only inspects IPv4 and IPv6 loopback addresses. Do not introduce arbitrary remote scanning, telemetry, or background monitoring.
|
|
71
|
+
|
|
72
|
+
### Preserve read-only behavior
|
|
73
|
+
|
|
74
|
+
GhostPort must not terminate, signal, or modify processes.
|
|
75
|
+
|
|
76
|
+
### Keep diagnostics independent
|
|
77
|
+
|
|
78
|
+
TCP connectivity, process identification, and HTTP checks are separate observations.
|
|
79
|
+
|
|
80
|
+
A process lookup failure must not turn a successful TCP result into a failure.
|
|
81
|
+
|
|
82
|
+
### Respect response boundaries
|
|
83
|
+
|
|
84
|
+
HTTP inspection must not read or display response bodies.
|
|
85
|
+
|
|
86
|
+
Keep requests bounded, avoid following redirects, and preserve the existing proxy isolation.
|
|
87
|
+
|
|
88
|
+
### Protect sensitive information
|
|
89
|
+
|
|
90
|
+
New diagnostic output must not expose credentials, authentication headers, tokens, or other sensitive values.
|
|
91
|
+
|
|
92
|
+
### Maintain the JSON contract
|
|
93
|
+
|
|
94
|
+
Additive changes may retain `schema_version: 1`. Breaking changes require a schema-version update and corresponding documentation.
|
|
95
|
+
|
|
96
|
+
### Test the behavior
|
|
97
|
+
|
|
98
|
+
Add or update regression tests when changing functionality.
|
|
99
|
+
|
|
100
|
+
Tests should use mocks or local test servers and must not depend on external hosts.
|
|
101
|
+
|
|
102
|
+
## ✿ Opening a Pull Request
|
|
103
|
+
|
|
104
|
+
A useful pull request should explain:
|
|
105
|
+
|
|
106
|
+
1. What changed and why.
|
|
107
|
+
2. Which issue or behavior it addresses.
|
|
108
|
+
3. What tests were run.
|
|
109
|
+
4. Any platform-specific limitations.
|
|
110
|
+
5. Whether the JSON schema, CLI behavior, or documented safety boundaries changed.
|
|
111
|
+
|
|
112
|
+
Keep pull requests focused and reviewable.
|
|
113
|
+
|
|
114
|
+
## ♡ Code of Conduct
|
|
115
|
+
|
|
116
|
+
Be respectful, constructive, and considerate when discussing issues or reviewing contributions.
|
|
117
|
+
|
|
118
|
+
Disagreements about implementation are normal. Personal attacks, harassment, and discriminatory behavior are not welcome.
|
|
119
|
+
|
|
120
|
+
This section describes project expectations and does not imply a separate formal Code of Conduct policy exists.
|
|
121
|
+
|
|
122
|
+
## 📜 Licensing
|
|
123
|
+
|
|
124
|
+
By contributing, you agree that your contributions are licensed under the project's [MIT License](LICENSE).
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
**Thanks for helping GhostPort grow.**
|
|
129
|
+
|
|
130
|
+
*Every good tool starts somewhere. Sometimes that somewhere is localhost.* 👻
|
|
131
|
+
|
|
132
|
+
**CyberStudios™**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CyberStudios
|
|
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,358 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: ghostport-cli
|
|
3
|
+
Version: 0.1.1
|
|
4
|
+
Summary: A tiny forensic CLI for diagnosing local TCP ports and unexpected HTTP services.
|
|
5
|
+
Project-URL: Homepage, https://github.com/CyberStudiosTM/GhostPort
|
|
6
|
+
Project-URL: Issues, https://github.com/CyberStudiosTM/GhostPort/issues
|
|
7
|
+
Author: CyberStudios
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: cli,developer-tools,diagnostics,http,localhost,ports
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: MacOS
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
22
|
+
Classifier: Typing :: Typed
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: httpx>=0.27
|
|
25
|
+
Requires-Dist: psutil>=5.9
|
|
26
|
+
Requires-Dist: rich>=13.7
|
|
27
|
+
Requires-Dist: typer>=0.12
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == 'dev'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# 👻 GhostPort
|
|
34
|
+
|
|
35
|
+
<div align="center">
|
|
36
|
+
|
|
37
|
+
**A little ghost in your localhost.**
|
|
38
|
+
|
|
39
|
+
*Find out what's listening, who's behind it, and whether it's answering the way you expected.*
|
|
40
|
+
|
|
41
|
+
**A CyberStudios™ developer utility**
|
|
42
|
+
|
|
43
|
+

|
|
44
|
+

|
|
45
|
+

|
|
46
|
+

|
|
47
|
+
|
|
48
|
+
[Getting Started](#-getting-started) · [Commands](#-commands) · [How It Works](#-how-it-works) · [Safety](#-safety--privacy) · [Contributing](CONTRIBUTING.md)
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## ✦ Welcome to GhostPort
|
|
55
|
+
|
|
56
|
+
Somewhere inside your computer, a service is listening.
|
|
57
|
+
|
|
58
|
+
Maybe it's your development server. Maybe it's an MCP endpoint. Maybe something else has occupied the port you expected to use.
|
|
59
|
+
|
|
60
|
+
**GhostPort helps you investigate.**
|
|
61
|
+
|
|
62
|
+
It's a lightweight, local-first command-line utility that inspects TCP ports on your own machine, identifies listening processes when possible, and checks how local HTTP services respond.
|
|
63
|
+
|
|
64
|
+
No dashboards. No cloud account. No background daemon.
|
|
65
|
+
|
|
66
|
+
Just you, your terminal, and a little ghost with questions.
|
|
67
|
+
|
|
68
|
+
### What can it do?
|
|
69
|
+
|
|
70
|
+
- **Inspect local ports.** Check whether a TCP port accepts connections.
|
|
71
|
+
- **Identify processes.** Find the associated PID and process name when the operating system permits.
|
|
72
|
+
- **Probe HTTP services.** Inspect status codes, content types, server headers, and response times.
|
|
73
|
+
- **Check JSON expectations.** Find out when a service isn't returning the expected JSON media type.
|
|
74
|
+
- **Generate structured reports.** Use machine-readable JSON output in scripts and developer workflows.
|
|
75
|
+
- **Keep diagnostics private.** No telemetry, external requests, or process termination.
|
|
76
|
+
|
|
77
|
+
GhostPort is an independent CyberStudios™ project. It does not require CyberCore or any other CyberStudios software.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## 🌱 Getting Started
|
|
82
|
+
|
|
83
|
+
**Requirements:** Python 3.11 or newer.
|
|
84
|
+
|
|
85
|
+
### Install from PyPI
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
python -m pip install ghostport-cli
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The PyPI package is named `ghostport-cli`; the command and import name are `ghostport`.
|
|
92
|
+
|
|
93
|
+
### Install from GitHub
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
python -m pip install git+https://github.com/CyberStudiosTM/GhostPort.git
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Install for development
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git clone https://github.com/CyberStudiosTM/GhostPort.git
|
|
103
|
+
cd GhostPort
|
|
104
|
+
python -m pip install -e ".[dev]"
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Your first inspection
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
ghostport inspect 8080
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Check the HTTP response:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
ghostport inspect 8080 --http
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Expect a JSON response:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
ghostport inspect 8080 --http --expect-json
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Export a report:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
ghostport inspect 8080 --json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
> **Note:** A successful connection doesn't prove which service owns a port. GhostPort reports the evidence it can observe without inventing an identity.
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 🖥️ Commands
|
|
136
|
+
|
|
137
|
+
```text
|
|
138
|
+
ghostport inspect PORT [--http] [--expect-json] [--json] [--verbose]
|
|
139
|
+
[--timeout SECONDS] [--path /PATH]
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
| Option | Description |
|
|
143
|
+
|---|---|
|
|
144
|
+
| `--http` | Send one bounded HTTP GET request and inspect response headers. |
|
|
145
|
+
| `--expect-json` | Validate that the HTTP content type is a supported JSON media type. Requires `--http`. |
|
|
146
|
+
| `--json` | Return structured, machine-readable output. |
|
|
147
|
+
| `--verbose`, `-v` | Display additional diagnostics with sensitive values redacted. |
|
|
148
|
+
| `--timeout`, `-t` | Set the per-operation timeout from 0.05 to 30 seconds. Default: 3 seconds. |
|
|
149
|
+
| `--path` | Specify the HTTP request path. Default: `/`. |
|
|
150
|
+
|
|
151
|
+
### Example investigations
|
|
152
|
+
|
|
153
|
+
**Is my development server listening?**
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
ghostport inspect 3000
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**What's responding on my API port?**
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
ghostport inspect 8000 --http
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Is this endpoint returning JSON?**
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
ghostport inspect 8000 --http --expect-json
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**I need a report for another tool.**
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
ghostport inspect 8000 --http --json
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Show additional diagnostics.**
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
ghostport inspect 5432 --verbose
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## ✧ Example Output
|
|
186
|
+
|
|
187
|
+
This example comes from a local GhostPort test against a Python HTTP server.
|
|
188
|
+
|
|
189
|
+
```text
|
|
190
|
+
$ ghostport inspect 8765 --http --expect-json
|
|
191
|
+
|
|
192
|
+
ghostport v0.1.0 · localhost:8765
|
|
193
|
+
|
|
194
|
+
TCP [+] open on 127.0.0.1 · 1.11 ms
|
|
195
|
+
PROCESS [+] python.exe · pid 17724
|
|
196
|
+
HTTP [+] 200 · text/html; charset=utf-8
|
|
197
|
+
403.44 ms · SimpleHTTP/0.6 Python/3.11.9
|
|
198
|
+
JSON [x] Content-Type is not a JSON media type
|
|
199
|
+
|
|
200
|
+
Port is open, but the HTTP check did not pass.
|
|
201
|
+
This does not identify the service.
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
The actual terminal interface uses rounded panels and a pastel color palette. GhostPort also respects `NO_COLOR`.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## 🔎 How It Works
|
|
209
|
+
|
|
210
|
+
GhostPort separates its diagnostics into three independent stages.
|
|
211
|
+
|
|
212
|
+
### 01 / TCP inspection
|
|
213
|
+
|
|
214
|
+
Attempts a connection to the requested port using IPv4 and IPv6 loopback addresses.
|
|
215
|
+
|
|
216
|
+
Reports whether the connection succeeds, fails, or times out.
|
|
217
|
+
|
|
218
|
+
### 02 / Process inspection
|
|
219
|
+
|
|
220
|
+
Attempts to identify the listening process using available operating-system information.
|
|
221
|
+
|
|
222
|
+
Process identification may be unavailable due to permissions or platform limitations. That does not change the TCP result.
|
|
223
|
+
|
|
224
|
+
### 03 / HTTP inspection
|
|
225
|
+
|
|
226
|
+
When requested, sends a single HTTP GET request and inspects the response headers.
|
|
227
|
+
|
|
228
|
+
GhostPort does not read or display the response body, follow redirects, or infer a service's identity from its content type.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## 📡 JSON Reports
|
|
233
|
+
|
|
234
|
+
GhostPort provides a stable, versioned JSON report format.
|
|
235
|
+
|
|
236
|
+
```json
|
|
237
|
+
{
|
|
238
|
+
"schema_version": 1,
|
|
239
|
+
"tool": "ghostport",
|
|
240
|
+
"version": "0.1.0",
|
|
241
|
+
"ok": true,
|
|
242
|
+
"exit_code": 0,
|
|
243
|
+
"target": {
|
|
244
|
+
"host": "localhost",
|
|
245
|
+
"port": 8765
|
|
246
|
+
},
|
|
247
|
+
"tcp": {
|
|
248
|
+
"status": "open",
|
|
249
|
+
"connected": true,
|
|
250
|
+
"address": "127.0.0.1",
|
|
251
|
+
"latency_ms": 2.7,
|
|
252
|
+
"error": null
|
|
253
|
+
},
|
|
254
|
+
"process": {
|
|
255
|
+
"status": "identified",
|
|
256
|
+
"pid": 17724,
|
|
257
|
+
"name": "python.exe",
|
|
258
|
+
"reason": null,
|
|
259
|
+
"listeners": []
|
|
260
|
+
},
|
|
261
|
+
"http": null
|
|
262
|
+
}
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The `tcp`, `process`, and `http` sections remain independent. Unavailable values are represented as `null`.
|
|
266
|
+
|
|
267
|
+
Supported status values:
|
|
268
|
+
|
|
269
|
+
- TCP: `open`, `closed`, `timeout`, `error`
|
|
270
|
+
- Process: `identified`, `partial`, `unavailable`, `not_found`
|
|
271
|
+
- HTTP: `ok`, `error`, `timeout`, `skipped`
|
|
272
|
+
|
|
273
|
+
When `--http` is enabled, the HTTP section includes the URL, status code, content type, server, response time, error information, and optional JSON validation result.
|
|
274
|
+
|
|
275
|
+
Verbose output may additionally include redacted diagnostics, listener details, and HTTP headers.
|
|
276
|
+
|
|
277
|
+
Invalid input returns a JSON error object containing the schema version, tool name, version, failure status, exit code, and structured error.
|
|
278
|
+
|
|
279
|
+
Additive schema changes preserve `schema_version: 1`. Breaking changes require a new schema version.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## 🚦 Exit Codes
|
|
284
|
+
|
|
285
|
+
| Code | Meaning |
|
|
286
|
+
|---|---|
|
|
287
|
+
| `0` | TCP connection succeeded and requested HTTP checks passed. |
|
|
288
|
+
| `1` | TCP connection failed, timed out, or encountered an error. |
|
|
289
|
+
| `2` | Invalid arguments or unsupported option combinations. |
|
|
290
|
+
| `3` | TCP succeeded, but the requested HTTP or JSON check failed. |
|
|
291
|
+
|
|
292
|
+
HTTP status codes such as `404` or `500` still count as valid HTTP responses for exit-code purposes.
|
|
293
|
+
|
|
294
|
+
Failure to identify the process does not change the TCP result.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## 🔐 Safety & Privacy
|
|
299
|
+
|
|
300
|
+
GhostPort is designed for local diagnostics.
|
|
301
|
+
|
|
302
|
+
- Connects only to `127.0.0.1` and `::1`.
|
|
303
|
+
- Does not offer arbitrary host scanning.
|
|
304
|
+
- Never kills, signals, or modifies processes.
|
|
305
|
+
- Does not require administrator privileges.
|
|
306
|
+
- Does not send telemetry or contact external services.
|
|
307
|
+
- Does not follow HTTP redirects.
|
|
308
|
+
- Does not read or display HTTP response bodies.
|
|
309
|
+
- Disables environment proxy inheritance for HTTP probes.
|
|
310
|
+
- Redacts sensitive headers, credentials, query values, and command-line arguments in supported verbose diagnostics.
|
|
311
|
+
|
|
312
|
+
For vulnerability reporting, see [SECURITY.md](SECURITY.md).
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## ☁️ Known Limitations
|
|
317
|
+
|
|
318
|
+
GhostPort is intentionally small and transparent about its capabilities.
|
|
319
|
+
|
|
320
|
+
- Process identification depends on OS permissions.
|
|
321
|
+
- macOS socket inspection may require elevated permissions; GhostPort continues when process information is unavailable.
|
|
322
|
+
- Some Windows system processes may expose a PID without a process name.
|
|
323
|
+
- Closed loopback ports may take approximately two seconds to report on Windows.
|
|
324
|
+
- The default timeout is three seconds and applies per network operation, not as a total execution deadline.
|
|
325
|
+
- A JSON content type does not conclusively identify a service.
|
|
326
|
+
- TLS-only services are not supported by the plain HTTP probe.
|
|
327
|
+
- Only IPv4 and IPv6 loopback addresses are inspected.
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## 🛠️ Development
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
python -m pip install -e ".[dev]"
|
|
335
|
+
ruff check .
|
|
336
|
+
ruff format --check .
|
|
337
|
+
python -m pytest
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
GitHub Actions runs the test and lint checks on Windows, Ubuntu, and macOS using Python 3.11, 3.12, and 3.13.
|
|
341
|
+
|
|
342
|
+
Want to help improve GhostPort? Read [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## ✿ Made in Cyberspace
|
|
347
|
+
|
|
348
|
+
GhostPort is part of **CyberStudios™**, a creative software ecosystem exploring development tools, game systems, digital environments, and interactive experiences.
|
|
349
|
+
|
|
350
|
+
Small tools deserve thoughtful engineering, too.
|
|
351
|
+
|
|
352
|
+
**Developed under CyberStudios™.**
|
|
353
|
+
|
|
354
|
+
Licensed under the [MIT License](LICENSE).
|
|
355
|
+
|
|
356
|
+
[Repository](https://github.com/CyberStudiosTM/GhostPort) · [Issues](https://github.com/CyberStudiosTM/GhostPort/issues) · [Security](SECURITY.md)
|
|
357
|
+
|
|
358
|
+
*End of transmission. The port is still listening.* 👻
|