my-new-tool 0.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.
- my_new_tool-0.2.1/LICENSE +21 -0
- my_new_tool-0.2.1/PKG-INFO +265 -0
- my_new_tool-0.2.1/README.md +212 -0
- my_new_tool-0.2.1/my_new_tool/__init__.py +59 -0
- my_new_tool-0.2.1/my_new_tool/__main__.py +8 -0
- my_new_tool-0.2.1/my_new_tool/_version.py +1 -0
- my_new_tool-0.2.1/my_new_tool/cli.py +244 -0
- my_new_tool-0.2.1/my_new_tool/config.py +181 -0
- my_new_tool-0.2.1/my_new_tool/engine.py +195 -0
- my_new_tool-0.2.1/my_new_tool/executor.py +120 -0
- my_new_tool-0.2.1/my_new_tool/mcp_server.py +69 -0
- my_new_tool-0.2.1/my_new_tool/plugin.py +215 -0
- my_new_tool-0.2.1/my_new_tool/plugins/__init__.py +6 -0
- my_new_tool-0.2.1/my_new_tool/plugins/http_title.py +42 -0
- my_new_tool-0.2.1/my_new_tool/plugins/my_tool.py +33 -0
- my_new_tool-0.2.1/my_new_tool/plugins/string_info.py +35 -0
- my_new_tool-0.2.1/my_new_tool/report.py +134 -0
- my_new_tool-0.2.1/my_new_tool/scaffold.py +77 -0
- my_new_tool-0.2.1/my_new_tool/schema.py +133 -0
- my_new_tool-0.2.1/my_new_tool/server.py +135 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/PKG-INFO +265 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/SOURCES.txt +31 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/dependency_links.txt +1 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/entry_points.txt +2 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/requires.txt +40 -0
- my_new_tool-0.2.1/my_new_tool.egg-info/top_level.txt +1 -0
- my_new_tool-0.2.1/pyproject.toml +79 -0
- my_new_tool-0.2.1/setup.cfg +4 -0
- my_new_tool-0.2.1/tests/test_config.py +43 -0
- my_new_tool-0.2.1/tests/test_engine.py +61 -0
- my_new_tool-0.2.1/tests/test_report.py +41 -0
- my_new_tool-0.2.1/tests/test_scaffold.py +22 -0
- my_new_tool-0.2.1/tests/test_schema.py +40 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 soxoj
|
|
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,265 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: my_new_tool
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A universal, AI-native skeleton for OSINT CLI tools, libraries, microservices and MCP servers.
|
|
5
|
+
Author-email: Soxoj <soxoj@protonmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/soxoj/osint-cli-tool-skeleton
|
|
8
|
+
Project-URL: Repository, https://github.com/soxoj/osint-cli-tool-skeleton
|
|
9
|
+
Keywords: osint,cli,skeleton,template,mcp,fastapi,async
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: aiohttp
|
|
23
|
+
Requires-Dist: aiohttp-socks>=0.12.0
|
|
24
|
+
Requires-Dist: beautifulsoup4
|
|
25
|
+
Requires-Dist: tqdm>=4.70.0
|
|
26
|
+
Requires-Dist: colorama>=0.4.6
|
|
27
|
+
Requires-Dist: termcolor>=3.3.0
|
|
28
|
+
Provides-Extra: server
|
|
29
|
+
Requires-Dist: fastapi>=0.141.1; extra == "server"
|
|
30
|
+
Requires-Dist: uvicorn[standard]>=0.52.4; extra == "server"
|
|
31
|
+
Provides-Extra: mcp
|
|
32
|
+
Requires-Dist: mcp>=2.2.0; extra == "mcp"
|
|
33
|
+
Provides-Extra: yaml
|
|
34
|
+
Requires-Dist: pyyaml>=6.0.3; extra == "yaml"
|
|
35
|
+
Provides-Extra: toml
|
|
36
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "toml"
|
|
37
|
+
Provides-Extra: all
|
|
38
|
+
Requires-Dist: fastapi>=0.141.1; extra == "all"
|
|
39
|
+
Requires-Dist: uvicorn[standard]>=0.52.4; extra == "all"
|
|
40
|
+
Requires-Dist: mcp>=2.2.0; extra == "all"
|
|
41
|
+
Requires-Dist: pyyaml>=6.0.3; extra == "all"
|
|
42
|
+
Requires-Dist: tomli>=2.0; python_version < "3.11" and extra == "all"
|
|
43
|
+
Provides-Extra: dev
|
|
44
|
+
Requires-Dist: pytest>=9.1.1; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-asyncio>=1.4.0; extra == "dev"
|
|
46
|
+
Requires-Dist: coverage>=7.16.0; extra == "dev"
|
|
47
|
+
Requires-Dist: flake8>=7.3.0; extra == "dev"
|
|
48
|
+
Requires-Dist: mypy>=2.3.1; extra == "dev"
|
|
49
|
+
Requires-Dist: black>=26.5.1; extra == "dev"
|
|
50
|
+
Requires-Dist: build>=1.6.0; extra == "dev"
|
|
51
|
+
Requires-Dist: twine>=7.0.0; extra == "dev"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
# OSINT cli tool skeleton
|
|
55
|
+
|
|
56
|
+
<p align="center">
|
|
57
|
+
<p align="center">
|
|
58
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
59
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/osint-cli-tool-skeleton?style=flat-square">
|
|
60
|
+
</a>
|
|
61
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
62
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dw/osint-cli-tool-skeleton?style=flat-square">
|
|
63
|
+
</a>
|
|
64
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
65
|
+
<img alt="Views" src="https://komarev.com/ghpvc/?username=osint-cli-tool-skeleton&color=brightgreen&label=views&style=flat-square">
|
|
66
|
+
</a>
|
|
67
|
+
</p>
|
|
68
|
+
<p align="center">
|
|
69
|
+
<img src="https://raw.githubusercontent.com/soxoj/osint-cli-tool-skeleton/main/pictures/logo.png" height="200"/>
|
|
70
|
+
</p>
|
|
71
|
+
</p>
|
|
72
|
+
|
|
73
|
+
A universal, **AI-native** template for building OSINT tools.
|
|
74
|
+
|
|
75
|
+
Write **one plugin file**, and the same logic instantly works as a **CLI**, a
|
|
76
|
+
**Python library**, an **HTTP microservice** (FastAPI) and an **MCP server** for
|
|
77
|
+
AI agents — with concurrency, proxying, reports and config handled for you.
|
|
78
|
+
|
|
79
|
+
> **Press "[Use this template](https://github.com/soxoj/osint-cli-tool-skeleton/generate)"** to start your own tool, then see [INSTALL.md](INSTALL.md).
|
|
80
|
+
|
|
81
|
+
## Why this skeleton
|
|
82
|
+
|
|
83
|
+
- **Universal** — plugins return arbitrary fields; nothing is hardcoded to one
|
|
84
|
+
data shape. Build a username checker, a domain enricher, a leak lookup, anything.
|
|
85
|
+
- **Easy to customize** — add a capability by dropping one file in `plugins/`.
|
|
86
|
+
You never touch the engine, CLI, server or reports.
|
|
87
|
+
- **Embeddable** — clean sync (`run_tool`) and async (`arun_tool`) library API,
|
|
88
|
+
plus a FastAPI app factory for microservices and pipelines.
|
|
89
|
+
- **AI-native** — every plugin is auto-exposed as an MCP tool, and
|
|
90
|
+
[AGENTS.md](AGENTS.md) is a ready brief: point an agent at the repo and say
|
|
91
|
+
"build a tool based on this".
|
|
92
|
+
|
|
93
|
+
## Architecture
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
your plugins/ (subclass Plugin, implement run())
|
|
97
|
+
│ auto-discovered & registered
|
|
98
|
+
▼
|
|
99
|
+
CLI ─┐ ┌─────────┐
|
|
100
|
+
lib ─┼──> Settings ──> │ Engine │ ──> Reporters (plain/csv/txt/json)
|
|
101
|
+
HTTP ─┤ (file/env/CLI) │ +Context│ Result / ResultSet (any fields)
|
|
102
|
+
MCP ─┘ └─────────┘
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Quickstart
|
|
106
|
+
|
|
107
|
+
```sh
|
|
108
|
+
pip install -e .
|
|
109
|
+
python -m my_new_tool --list-plugins
|
|
110
|
+
python -m my_new_tool --plugin http_title example.com reddit.com
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
Target: example.com
|
|
115
|
+
Results found: 1
|
|
116
|
+
1) Value: Example Domain
|
|
117
|
+
Code: 200
|
|
118
|
+
------------------------------
|
|
119
|
+
Total found: 1
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Write a tool (the only thing you edit)
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
python -m my_new_tool --new-plugin my_tool
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# my_new_tool/plugins/my_tool.py
|
|
130
|
+
from my_new_tool import InputData, Plugin, Result
|
|
131
|
+
|
|
132
|
+
class MyTool(Plugin):
|
|
133
|
+
name = "my_tool"
|
|
134
|
+
description = "Look up something for a target."
|
|
135
|
+
|
|
136
|
+
async def run(self, target: InputData) -> Result:
|
|
137
|
+
status, data = await self.ctx.fetch_json(f"https://api.example/{target.value}")
|
|
138
|
+
return Result(found=data.get("found"), code=status)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
That's it — `my_tool` now works on the CLI, as a library call, over HTTP and as
|
|
142
|
+
an MCP tool. Full contract in [AGENTS.md](AGENTS.md).
|
|
143
|
+
|
|
144
|
+
<details>
|
|
145
|
+
<summary><b>Inputs</b> — args, file, or stdin</summary>
|
|
146
|
+
|
|
147
|
+
```sh
|
|
148
|
+
my_new_tool a.com b.com c.com # positional
|
|
149
|
+
my_new_tool --target-list targets.txt # from a file
|
|
150
|
+
cat list.txt | my_new_tool --targets-from-stdin
|
|
151
|
+
```
|
|
152
|
+
</details>
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary><b>Reports</b> — console, CSV, TXT, JSON</summary>
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
my_new_tool a.com b.com -oC out.csv -oJ out.json -oT out.txt
|
|
159
|
+
my_new_tool a.com --format json # JSON to stdout
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Reports are schema-driven: columns/fields adapt to whatever your plugin emits.
|
|
163
|
+
```sh
|
|
164
|
+
$ cat out.json | jq '.[0]'
|
|
165
|
+
{ "input": { "value": "a.com" }, "results": [ { "value": "Site A", "code": 200 } ] }
|
|
166
|
+
```
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
<details>
|
|
170
|
+
<summary><b>Library</b> — embed in your own code / pipeline</summary>
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from my_new_tool import run_tool # sync
|
|
174
|
+
results = run_tool("http_title", ["example.com"], proxy="socks5://127.0.0.1:1080")
|
|
175
|
+
for rs in results:
|
|
176
|
+
print(rs.input_data, [r.fields for r in rs.results])
|
|
177
|
+
|
|
178
|
+
# inside an existing event loop:
|
|
179
|
+
from my_new_tool import arun_tool
|
|
180
|
+
results = await arun_tool("http_title", ["example.com"])
|
|
181
|
+
```
|
|
182
|
+
</details>
|
|
183
|
+
|
|
184
|
+
<details>
|
|
185
|
+
<summary><b>HTTP microservice</b> — FastAPI + OpenAPI</summary>
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
pip install -e '.[server]'
|
|
189
|
+
my_new_tool --server 0.0.0.0:8080 # docs at /docs
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
```sh
|
|
193
|
+
curl localhost:8080/plugins/http_title/run \
|
|
194
|
+
-d '{"targets": ["google.com", "yahoo.com"]}' -s | jq
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Endpoints: `GET /plugins`, `GET /plugins/{name}/schema`,
|
|
198
|
+
`POST /plugins/{name}/run`, `POST /run`. For your own ASGI deployment:
|
|
199
|
+
`from my_new_tool.server import create_app; app = create_app()`.
|
|
200
|
+
|
|
201
|
+
Or run it in Docker:
|
|
202
|
+
```sh
|
|
203
|
+
docker build -t osint-tool . && docker run -p 8080:8080 osint-tool
|
|
204
|
+
```
|
|
205
|
+
</details>
|
|
206
|
+
|
|
207
|
+
<details>
|
|
208
|
+
<summary><b>MCP server</b> — for AI agents</summary>
|
|
209
|
+
|
|
210
|
+
```sh
|
|
211
|
+
pip install -e '.[mcp]'
|
|
212
|
+
my_new_tool --mcp # stdio MCP server
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Every plugin becomes an MCP tool named after it, taking `targets` and optional
|
|
216
|
+
`options`. Register it with your agent/host as the command
|
|
217
|
+
`my_new_tool --mcp`.
|
|
218
|
+
</details>
|
|
219
|
+
|
|
220
|
+
<details>
|
|
221
|
+
<summary><b>Configuration</b> — file / env / CLI</summary>
|
|
222
|
+
|
|
223
|
+
Precedence: **defaults < config file < `OSINT_*` env < CLI flags**.
|
|
224
|
+
|
|
225
|
+
```toml
|
|
226
|
+
# osint.toml (auto-detected in cwd, or pass --config)
|
|
227
|
+
[osint]
|
|
228
|
+
plugin = "http_title"
|
|
229
|
+
proxy = "socks5://127.0.0.1:1080"
|
|
230
|
+
concurrency = 20
|
|
231
|
+
[osint.options]
|
|
232
|
+
api_key = "..."
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
```sh
|
|
236
|
+
OSINT_PROXY=socks5://127.0.0.1:1080 my_new_tool example.com
|
|
237
|
+
my_new_tool --plugin my_tool --option api_key=XXX --concurrency 20 t
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
See [`examples/osint.example.toml`](examples/osint.example.toml).
|
|
241
|
+
</details>
|
|
242
|
+
|
|
243
|
+
## Installation
|
|
244
|
+
|
|
245
|
+
Requires Python ≥ 3.10.
|
|
246
|
+
|
|
247
|
+
```sh
|
|
248
|
+
pip install my_new_tool # from PyPI (core)
|
|
249
|
+
pip install 'my_new_tool[all]' # + server, mcp, yaml
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
…or clone and `pip install -e '.[all,dev]'`. Details in [INSTALL.md](INSTALL.md).
|
|
253
|
+
|
|
254
|
+
## Development
|
|
255
|
+
|
|
256
|
+
```sh
|
|
257
|
+
make install-dev # editable install with dev tools
|
|
258
|
+
make test # pytest + coverage
|
|
259
|
+
make lint # flake8 + mypy
|
|
260
|
+
make format # black
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
## License
|
|
264
|
+
|
|
265
|
+
MIT
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
# OSINT cli tool skeleton
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
6
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/osint-cli-tool-skeleton?style=flat-square">
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
9
|
+
<img alt="PyPI - Downloads" src="https://img.shields.io/pypi/dw/osint-cli-tool-skeleton?style=flat-square">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://pypi.org/project/osint-cli-tool-skeleton/">
|
|
12
|
+
<img alt="Views" src="https://komarev.com/ghpvc/?username=osint-cli-tool-skeleton&color=brightgreen&label=views&style=flat-square">
|
|
13
|
+
</a>
|
|
14
|
+
</p>
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="https://raw.githubusercontent.com/soxoj/osint-cli-tool-skeleton/main/pictures/logo.png" height="200"/>
|
|
17
|
+
</p>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
A universal, **AI-native** template for building OSINT tools.
|
|
21
|
+
|
|
22
|
+
Write **one plugin file**, and the same logic instantly works as a **CLI**, a
|
|
23
|
+
**Python library**, an **HTTP microservice** (FastAPI) and an **MCP server** for
|
|
24
|
+
AI agents — with concurrency, proxying, reports and config handled for you.
|
|
25
|
+
|
|
26
|
+
> **Press "[Use this template](https://github.com/soxoj/osint-cli-tool-skeleton/generate)"** to start your own tool, then see [INSTALL.md](INSTALL.md).
|
|
27
|
+
|
|
28
|
+
## Why this skeleton
|
|
29
|
+
|
|
30
|
+
- **Universal** — plugins return arbitrary fields; nothing is hardcoded to one
|
|
31
|
+
data shape. Build a username checker, a domain enricher, a leak lookup, anything.
|
|
32
|
+
- **Easy to customize** — add a capability by dropping one file in `plugins/`.
|
|
33
|
+
You never touch the engine, CLI, server or reports.
|
|
34
|
+
- **Embeddable** — clean sync (`run_tool`) and async (`arun_tool`) library API,
|
|
35
|
+
plus a FastAPI app factory for microservices and pipelines.
|
|
36
|
+
- **AI-native** — every plugin is auto-exposed as an MCP tool, and
|
|
37
|
+
[AGENTS.md](AGENTS.md) is a ready brief: point an agent at the repo and say
|
|
38
|
+
"build a tool based on this".
|
|
39
|
+
|
|
40
|
+
## Architecture
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
your plugins/ (subclass Plugin, implement run())
|
|
44
|
+
│ auto-discovered & registered
|
|
45
|
+
▼
|
|
46
|
+
CLI ─┐ ┌─────────┐
|
|
47
|
+
lib ─┼──> Settings ──> │ Engine │ ──> Reporters (plain/csv/txt/json)
|
|
48
|
+
HTTP ─┤ (file/env/CLI) │ +Context│ Result / ResultSet (any fields)
|
|
49
|
+
MCP ─┘ └─────────┘
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Quickstart
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
pip install -e .
|
|
56
|
+
python -m my_new_tool --list-plugins
|
|
57
|
+
python -m my_new_tool --plugin http_title example.com reddit.com
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
Target: example.com
|
|
62
|
+
Results found: 1
|
|
63
|
+
1) Value: Example Domain
|
|
64
|
+
Code: 200
|
|
65
|
+
------------------------------
|
|
66
|
+
Total found: 1
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Write a tool (the only thing you edit)
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
python -m my_new_tool --new-plugin my_tool
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
# my_new_tool/plugins/my_tool.py
|
|
77
|
+
from my_new_tool import InputData, Plugin, Result
|
|
78
|
+
|
|
79
|
+
class MyTool(Plugin):
|
|
80
|
+
name = "my_tool"
|
|
81
|
+
description = "Look up something for a target."
|
|
82
|
+
|
|
83
|
+
async def run(self, target: InputData) -> Result:
|
|
84
|
+
status, data = await self.ctx.fetch_json(f"https://api.example/{target.value}")
|
|
85
|
+
return Result(found=data.get("found"), code=status)
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
That's it — `my_tool` now works on the CLI, as a library call, over HTTP and as
|
|
89
|
+
an MCP tool. Full contract in [AGENTS.md](AGENTS.md).
|
|
90
|
+
|
|
91
|
+
<details>
|
|
92
|
+
<summary><b>Inputs</b> — args, file, or stdin</summary>
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
my_new_tool a.com b.com c.com # positional
|
|
96
|
+
my_new_tool --target-list targets.txt # from a file
|
|
97
|
+
cat list.txt | my_new_tool --targets-from-stdin
|
|
98
|
+
```
|
|
99
|
+
</details>
|
|
100
|
+
|
|
101
|
+
<details>
|
|
102
|
+
<summary><b>Reports</b> — console, CSV, TXT, JSON</summary>
|
|
103
|
+
|
|
104
|
+
```sh
|
|
105
|
+
my_new_tool a.com b.com -oC out.csv -oJ out.json -oT out.txt
|
|
106
|
+
my_new_tool a.com --format json # JSON to stdout
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Reports are schema-driven: columns/fields adapt to whatever your plugin emits.
|
|
110
|
+
```sh
|
|
111
|
+
$ cat out.json | jq '.[0]'
|
|
112
|
+
{ "input": { "value": "a.com" }, "results": [ { "value": "Site A", "code": 200 } ] }
|
|
113
|
+
```
|
|
114
|
+
</details>
|
|
115
|
+
|
|
116
|
+
<details>
|
|
117
|
+
<summary><b>Library</b> — embed in your own code / pipeline</summary>
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from my_new_tool import run_tool # sync
|
|
121
|
+
results = run_tool("http_title", ["example.com"], proxy="socks5://127.0.0.1:1080")
|
|
122
|
+
for rs in results:
|
|
123
|
+
print(rs.input_data, [r.fields for r in rs.results])
|
|
124
|
+
|
|
125
|
+
# inside an existing event loop:
|
|
126
|
+
from my_new_tool import arun_tool
|
|
127
|
+
results = await arun_tool("http_title", ["example.com"])
|
|
128
|
+
```
|
|
129
|
+
</details>
|
|
130
|
+
|
|
131
|
+
<details>
|
|
132
|
+
<summary><b>HTTP microservice</b> — FastAPI + OpenAPI</summary>
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
pip install -e '.[server]'
|
|
136
|
+
my_new_tool --server 0.0.0.0:8080 # docs at /docs
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
curl localhost:8080/plugins/http_title/run \
|
|
141
|
+
-d '{"targets": ["google.com", "yahoo.com"]}' -s | jq
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Endpoints: `GET /plugins`, `GET /plugins/{name}/schema`,
|
|
145
|
+
`POST /plugins/{name}/run`, `POST /run`. For your own ASGI deployment:
|
|
146
|
+
`from my_new_tool.server import create_app; app = create_app()`.
|
|
147
|
+
|
|
148
|
+
Or run it in Docker:
|
|
149
|
+
```sh
|
|
150
|
+
docker build -t osint-tool . && docker run -p 8080:8080 osint-tool
|
|
151
|
+
```
|
|
152
|
+
</details>
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary><b>MCP server</b> — for AI agents</summary>
|
|
156
|
+
|
|
157
|
+
```sh
|
|
158
|
+
pip install -e '.[mcp]'
|
|
159
|
+
my_new_tool --mcp # stdio MCP server
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Every plugin becomes an MCP tool named after it, taking `targets` and optional
|
|
163
|
+
`options`. Register it with your agent/host as the command
|
|
164
|
+
`my_new_tool --mcp`.
|
|
165
|
+
</details>
|
|
166
|
+
|
|
167
|
+
<details>
|
|
168
|
+
<summary><b>Configuration</b> — file / env / CLI</summary>
|
|
169
|
+
|
|
170
|
+
Precedence: **defaults < config file < `OSINT_*` env < CLI flags**.
|
|
171
|
+
|
|
172
|
+
```toml
|
|
173
|
+
# osint.toml (auto-detected in cwd, or pass --config)
|
|
174
|
+
[osint]
|
|
175
|
+
plugin = "http_title"
|
|
176
|
+
proxy = "socks5://127.0.0.1:1080"
|
|
177
|
+
concurrency = 20
|
|
178
|
+
[osint.options]
|
|
179
|
+
api_key = "..."
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
```sh
|
|
183
|
+
OSINT_PROXY=socks5://127.0.0.1:1080 my_new_tool example.com
|
|
184
|
+
my_new_tool --plugin my_tool --option api_key=XXX --concurrency 20 t
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
See [`examples/osint.example.toml`](examples/osint.example.toml).
|
|
188
|
+
</details>
|
|
189
|
+
|
|
190
|
+
## Installation
|
|
191
|
+
|
|
192
|
+
Requires Python ≥ 3.10.
|
|
193
|
+
|
|
194
|
+
```sh
|
|
195
|
+
pip install my_new_tool # from PyPI (core)
|
|
196
|
+
pip install 'my_new_tool[all]' # + server, mcp, yaml
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
…or clone and `pip install -e '.[all,dev]'`. Details in [INSTALL.md](INSTALL.md).
|
|
200
|
+
|
|
201
|
+
## Development
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
make install-dev # editable install with dev tools
|
|
205
|
+
make test # pytest + coverage
|
|
206
|
+
make lint # flake8 + mypy
|
|
207
|
+
make format # black
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## License
|
|
211
|
+
|
|
212
|
+
MIT
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""
|
|
2
|
+
my_new_tool — a universal, AI-native skeleton for OSINT tools.
|
|
3
|
+
|
|
4
|
+
Public API (stable):
|
|
5
|
+
|
|
6
|
+
from my_new_tool import Plugin, Result, run_tool
|
|
7
|
+
|
|
8
|
+
class MyTool(Plugin):
|
|
9
|
+
name = "my_tool"
|
|
10
|
+
description = "..."
|
|
11
|
+
async def run(self, target):
|
|
12
|
+
...
|
|
13
|
+
|
|
14
|
+
results = run_tool("my_tool", ["target-a", "target-b"])
|
|
15
|
+
|
|
16
|
+
Importing this package is cheap: heavy CLI/server/MCP modules are loaded only
|
|
17
|
+
when used.
|
|
18
|
+
"""
|
|
19
|
+
from ._version import __version__
|
|
20
|
+
from .config import Settings
|
|
21
|
+
from .plugin import (
|
|
22
|
+
Plugin,
|
|
23
|
+
all_plugins,
|
|
24
|
+
discover,
|
|
25
|
+
get_plugin,
|
|
26
|
+
load_path,
|
|
27
|
+
register,
|
|
28
|
+
)
|
|
29
|
+
from .schema import InputData, Result, ResultEncoder, ResultSet, dumps
|
|
30
|
+
|
|
31
|
+
__all__ = [
|
|
32
|
+
"__version__",
|
|
33
|
+
"Plugin",
|
|
34
|
+
"Result",
|
|
35
|
+
"ResultSet",
|
|
36
|
+
"InputData",
|
|
37
|
+
"ResultEncoder",
|
|
38
|
+
"dumps",
|
|
39
|
+
"Settings",
|
|
40
|
+
"run_tool",
|
|
41
|
+
"arun_tool",
|
|
42
|
+
"Engine",
|
|
43
|
+
"RunContext",
|
|
44
|
+
"get_plugin",
|
|
45
|
+
"all_plugins",
|
|
46
|
+
"discover",
|
|
47
|
+
"load_path",
|
|
48
|
+
"register",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def __getattr__(name):
|
|
53
|
+
# Lazy re-exports so `import my_new_tool` stays light and free
|
|
54
|
+
# of an import cycle with engine.py (which imports this package).
|
|
55
|
+
if name in ("run_tool", "arun_tool", "Engine", "RunContext"):
|
|
56
|
+
from . import engine
|
|
57
|
+
|
|
58
|
+
return getattr(engine, name)
|
|
59
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = '0.2.1'
|