Skip to content

Commit 3d3a025

Browse files
manmolecularIandmeesph-668Shas08Minerm
authored
Merge develop (#42)
* WIP: Add Initial Version (alpha-beta-gamma) (#1) * Add initial WIP project version * Update src code * Update documentation * Add requirements * add script name_check (#4) * Add initial WIP project version * add check_nickname.py, check_nickname_sync and check_nickname_async in it add social_networks.txt * add check_nickname.py, check_nickname_sync and check_nickname_async in it add social_networks.txt * new main.py * new base: develop add many files * fix inheritance in Runner * fix check_nickname fix social_networks.txt * Little fixes * Return default main value Co-authored-by: manmolecular <[email protected]> * Add script: region check (#5) * Added number to Possiblekeys in osint.py. Added number as kwarg in main.py. Script defines the region where the phone number is registrated * Changed number->phone * Little fixes, update requirements Co-authored-by: manmolecular <[email protected]> * add script (email_verifier) (#7) * add script (email_verifier) * add library * change req and so on * used black * Little fixes * Main and .gitignore fixes Co-authored-by: Minerm <[email protected]> Co-authored-by: manmolecular <[email protected]> * Add script to get allowed http methods. (#10) * Add script to get allowed http methods. * 'Handle' more probable exceptions * Changed name of script directory * Remove wildcard import * Add random method check. Alter script response. * Little fixes * Fix methods variable * Fix typo in requirements Co-authored-by: manmolecular <[email protected]> * Add script to calculate hash of favicon.ico for Shodan (#13) * Add script to calculate hash of favicon.ico * Remove '\n' * Change variable name * Core fixes. Provide global variables. Update runner. Upgrade module-package system. (#14) * Clean init all the modules with the __init__.py file * Remove unused gitkeeps * Add base inits for script packages * Update main file * Set __file__ variable at the module level * Add inits for the modules * Modify all the modules * Delete one more .gitkeep * Add WIP test for user_greeting * Update test module for user_greeting * Fix module runner a bit * Add relative imports to the modules * Add run tests script * Update README.md * Fix module-package runner * Update requirements * Format everything with Black * Handle module and execution errors with runner * Awesome cookie checker (#6) * made cookie checker task * added requirements.txt * refactored the code & adapted to the new project structure * small fix that processes exception * Little fixes Co-authored-by: manmolecular <[email protected]> * Added a function for retrieving location and provider info by IP address. (#12) * Added IP address as one of the possible keys. * Init commit. * Init commit. * Added dosctring. * Removed some emptry lines. * get_ip_info was moved into Runner class. * The IP key shouldn't be here. * Reworked exception handling mechanism. * Codestyle fix. * Removed some test code. * Moved script to proper dir. * Fixed response returned in case of error. * Fixed exception handling. * Request now uses the validated IP. * Found a better variable name for validated IP. * Removed unnecessary variables. * Init commit. * Runner class was moved into this module. * Set default IP to Google DNS Resolver address (to be more stable) * Add default values; set default ip to 8.8.8.8; set default city to Ashburn * Apply Black linter on the main module file Co-authored-by: manmolecular <[email protected]> * Add simple server mocking test example (#20) * Add simple web server mocking example * Add some types * Add tests for favicon hash (#22) * Add tests for favicon hash * Apply Black linting * Suppress server output logging Co-authored-by: manmolecular <[email protected]> * Test allowed_methods. Modify allowed_methods. (#21) * * Make allowed_methods also return methods on which server did not response. * Add tests for allowed_methods module. * Fix output * Change docstring * Linting with Black Co-authored-by: manmolecular <[email protected]> * Fix tests timeouts (#25) * Add tests defaults (#26) * Boost up/improvement: Add multiprocessing CaseManager (processes, threads, parallel case execution) (#27) * Add multiprocessing CaseManager * Add more info about case to the manager * Update logging format * Set optimal threads and processes quantity * simple email generator (#9) * Made simple email generator, modified requirements.txt * deleted __main__ rubbish, modified success message * added a check on username availability * Update __main__.py * Update __main__.py * modified names of methods and atributes * Update requirements.txt * reduced number of domen names, possible emails; reduced reversing and optimized code; moved project to convert/ dir; led project to a new view * fixed bug with command prompt; got rid of json; moved service symbols to a separate class; optimized code; made cosmetic changes * some fixes * some fixes * Add fixes Co-authored-by: manmolecular <[email protected]> * Added phone number generator and normaliser script file (#11) * Added phone number generator and normaliser script file * Added feature directory and empty files * Added module.py * Added Runner class to main.py * Cleaned up the comments and reformatted code * Added library to the main requirements.txt * Changed module.py * Changed module.py * Deleted old script file * Fixed requirements bug * Add phone_num_generator module * Corrected double brackets and dot format mistakes * Something went wrong last time, so no2 * Added unittests and local number format * Fix main module runner * Remove code duplicate Co-authored-by: manmolecular <[email protected]> * Get title (#23) * add main code * add __init__.py,__main__.py,module.py,test_module.py * fix module.py fix test_module.py * add test_module.py * add requirements.txt * fix tests,module.py add new lines in __main__.py and __init__.py * Remove old format string * Delete test_module from check_nickname * Module fixes Co-authored-by: manmolecular <[email protected]> * Suppress Requests keep-alive socket warnings (#33) * Iknowwhatyoudownload (#24) * added torrent module * underscores bugfix * added docstrings * updated requirements * changed directory * Added required changes * Fix base runners * Remove API key, fix main runner * Linting with Black Co-authored-by: omarkelov <[email protected]> Co-authored-by: Anton Nikolaev <[email protected]> * add test_module.py in email_verifier (#29) * add test_module.py * Add functions (test_pass_false / true_arguments) * Fix comparison * Fix return types Co-authored-by: Minerm <[email protected]> Co-authored-by: manmolecular <[email protected]> * Fix validator keys (#35) * Develop: fixes, improvements, etc. (#36) * Suppress insecure request warning messages * Update requirements.txt * Add base scenario, add yaml support * Update structure; include results saving * Improvements - skip not applicable scripts, fix workers system (#39) * Fix executors * Optimize imports * Add results to gitignore * Add 'required' field to define required args * Ignore results from 'results' directory * Add 'required' field to base classes * Skip not applicable scripts * Fix quantity of processes * Set the execution timeout to 5 mins per case * Add phone case to the examples * JSON Russian language and encoding support * Add core default values * Remove hardcoded quantity of workers * Increase quantity of cases up to 10 * Fix indentation in runner * Add seed (initial) data to scan for * Email generator fix and tests (#38) * added tests * fixed incorrect behavior * extension of tests, cosmetic changes * Add google_search module (#37) * Add module scraping search results. * Add tests to google_search script * Add tests and do minor refactoring * Add input type test * Apply black linting * Add request delay when needed * Remove redundant import * Fixes (#40) * Add 'required' field for the google search module * Add beatifulsoup to requirements * Check nickname (#28) * add main code * add __init__.py,__main__.py,module.py,test_module.py * fix module.py fix test_module.py * add test_module.py * add requirements.txt * fix tests,module.py add new lines in __main__.py and __init__.py * add test_module.py * delete get_title * add some tests to test_module.py fix social_networks.txt * fix styles modify social_networks.txt * fix module.py fix test_module.py * Cosmetic fixes Co-authored-by: manmolecular <[email protected]> * Update README.md * Add Tornado-based web-server. Support REST API methods. Implement task manager. (#41) * Modify environment files * Move saver to another module * Add SQLite database handling * Add Tornado server * Add main server runner * Move saver to another module * Add multiprocessing * Add docker-compose and postgres * Update database handling * Update environment files * Remove unused imports from main.py * Update database handlers * Update task manager; handle task status * Fix task spawner * Little cosmetic fixes, format files * Format with Black * Add environment variables * Add limit parameter to the task list handler * Don't initialize task spawner, it's not required * Remove single case wrapper from the main.py * Add Docker support for server * Fix makefile: spaces to tabs * Format with Black * Cosmetic: add new line to dockerignore * Add healthcheckers * Add CLI interface * Add color logging * Update gitignore * Add parents for scripts in logging * Fix makefile * Add screenshots * Update README.md * Update README.md Co-authored-by: Iandmee <[email protected]> Co-authored-by: sph-668 <[email protected]> Co-authored-by: Neo <[email protected]> Co-authored-by: Minerm <[email protected]> Co-authored-by: Nikita Kryukov <[email protected]> Co-authored-by: HochuOlivie <[email protected]> Co-authored-by: Timur <[email protected]> Co-authored-by: Matvey Sergeev <[email protected]> Co-authored-by: marinepalyan <[email protected]> Co-authored-by: katerina <[email protected]> Co-authored-by: omarkelov <[email protected]>
1 parent b0589a8 commit 3d3a025

File tree

134 files changed

+4431
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+4431
-2
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*
2+
.*
3+
!src
4+
!server.py
5+
!requirements.txt
6+
!docker/server/wait-for-it.sh

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# Custom
2+
.idea/
3+
.DS_Store
4+
results/*.json
5+
16
# Byte-compiled / optimized / DLL files
27
__pycache__/
38
*.py[cod]

Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: up up_build test clean
2+
3+
up:
4+
docker-compose up -d
5+
6+
up_build:
7+
docker-compose up -d --build --force-recreate
8+
9+
tests:
10+
python3 -W ignore:ResourceWarning -m unittest discover -v -b
11+
12+
clean:
13+
docker-compose down

README.md

+272-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,272 @@
1-
# osint-framework
2-
:eyes: WIP: All-in-one OSINT Tools
1+
# OSINT Framework
2+
3+
[![Required OS](https://img.shields.io/badge/OS-Linux%20based-blue)](https://en.wikipedia.org/wiki/Linux)
4+
[![Python3 Version](https://img.shields.io/badge/python-3.7%2B-blue)](https://www.python.org/downloads/)
5+
[![License](https://img.shields.io/badge/license-GPL--2.0-blue)](/LICENSE)
6+
[![Code Style](https://img.shields.io/badge/code%20style-black-000000)](https://github.com/psf/black)
7+
[![Last Commit](https://img.shields.io/github/last-commit/osint-dev-team/osint-framework)](https://github.com/osint-dev-team/osint-framework)
8+
9+
<p align="center">
10+
:fork_and_knife: All-in-one OSINT/RECON Swiss Knife
11+
</p>
12+
13+
<p align="center">
14+
<img src="/assets/screenshots/logo.png?raw=true" alt="OSINT Framework Logo" width="50%" height="50%" />
15+
</p>
16+
17+
## Screenshots
18+
19+
<div align="center">
20+
<img src="/assets/screenshots/cli.png?raw=true" alt="OSINT Framework CLI interface">
21+
<p align="center"><i>CLI interface</i></p>
22+
</div>
23+
24+
25+
## Installing
26+
```bash
27+
virtualenv -p python3 venv (or python3 -m venv venv)
28+
source venv/bin/activate
29+
pip3 install -r requirements.txt
30+
```
31+
32+
## Testing
33+
```bash
34+
make tests
35+
```
36+
37+
## Running
38+
### As a framework
39+
To run the framework with a command-line interface:
40+
```bash
41+
python3 cli.py -h
42+
```
43+
### As a REST API web service
44+
45+
<div align="center">
46+
<img src="/assets/screenshots/docker.png?raw=true" alt="OSINT Framework Docker usage">
47+
</div>
48+
49+
To run the framework as a web service via docker and docker-compose:
50+
```bash
51+
make up
52+
```
53+
or
54+
```bash
55+
docker-compose up
56+
```
57+
## As a separated module
58+
Basic:
59+
```python3
60+
python3 -m src.scripts.<category>.<name> any_arguments_here
61+
```
62+
Example command:
63+
```bash
64+
python3 -m src.scripts.other.user_greeting JohnDoe
65+
```
66+
Example output:
67+
```
68+
{'message': "Successfully finished! (args: (), kwargs: {'username': "
69+
"'johndoe'})",
70+
'result': 'Hello, JohnDoe!',
71+
'status': 'success'}
72+
73+
```
74+
75+
## REST API web service usage
76+
1. Create the task:
77+
```http
78+
POST /api/tasks/create HTTP/1.1
79+
Host: localhost:8888
80+
Content-Type: application/json
81+
82+
[
83+
{
84+
"case": "base",
85+
"name": "testname-profile",
86+
"description": "Base example for 'testname' user profile",
87+
"kwargs": {
88+
"username": "testname",
89+
"email": "[email protected]",
90+
"fullname": "Test Name"
91+
}
92+
},
93+
{
94+
"case": "osint",
95+
"name": "johndoe-profile",
96+
"description": "Osint example for 'johndoe' user profile",
97+
"kwargs": {
98+
"username": "johndoe",
99+
"email": "[email protected]",
100+
"fullname": "John Doe"
101+
}
102+
},
103+
{
104+
"case": "recon",
105+
"name": "facebook-website",
106+
"description": "Recon example for 'facebook.com' website",
107+
"kwargs": {
108+
"url": "https://facebook.com"
109+
}
110+
},
111+
{
112+
"case": "recon",
113+
"name": "vk-website",
114+
"description": "Recon example for 'vk.com' website",
115+
"kwargs": {
116+
"url": "https://vk.com"
117+
}
118+
},
119+
{
120+
"case": "recon",
121+
"name": "mail-website",
122+
"description": "Recon example for 'mail.ru' website",
123+
"kwargs": {
124+
"url": "https://mail.ru"
125+
}
126+
},
127+
{
128+
"case": "recon",
129+
"name": "8-8-8-8-host",
130+
"description": "Recon example for '8.8.8.8' host",
131+
"kwargs": {
132+
"ip": "8.8.8.8"
133+
}
134+
},
135+
{
136+
"case": "recon",
137+
"name": "92-63-64-162-host",
138+
"description": "Recon example for '92.63.64.162' host",
139+
"kwargs": {
140+
"ip": "92.63.64.162"
141+
}
142+
},
143+
{
144+
"case": "recon",
145+
"name": "13-91-95-74-host",
146+
"description": "Recon example for '13.91.95.74' host",
147+
"kwargs": {
148+
"ip": "13.91.95.74"
149+
}
150+
},
151+
{
152+
"case": "recon",
153+
"name": "87-240-190-78-host",
154+
"description": "Recon example for '87.240.190.78' host",
155+
"kwargs": {
156+
"ip": "87.240.190.78"
157+
}
158+
},
159+
{
160+
"case": "osint",
161+
"name": "phone-check",
162+
"description": "check information about the phone number",
163+
"kwargs": {
164+
"phone": 89138111111
165+
}
166+
}
167+
]
168+
```
169+
2. Check tasks status:
170+
```http
171+
GET /api/tasks/list HTTP/1.1
172+
Host: localhost:8888
173+
```
174+
3. Get the results when the task is done:
175+
```http
176+
GET /api/results?task_id=<YOUR_TASK_ID> HTTP/1.1
177+
Host: localhost:8888
178+
```
179+
180+
## Create your own script
181+
Use the following structure:
182+
1. Create your own module directory in the following way:
183+
```
184+
/src/scripts/<choose_your_category_here>/<your_script_name>/<script_files>
185+
```
186+
2. Provide the following structure of your script directory:
187+
```
188+
your_script_name
189+
├── requirements.txt - provide required libraries
190+
├── __init__.py - use this module to set the default parent directory (you can copy this file from any other script)
191+
├── __main__.py - use this module to provide some basic interface to use your script as a module (the same as if __name__ == "__main__")
192+
├── module.py - use this module to describe the basic logic of your module (you can import it in the __main__.py to provide interface)
193+
└── test_module.py - use this module for unittest tests
194+
```
195+
3. Create the `__init__.py` file. An example of the `__init__.py` boilerplate structure can be seen below:
196+
```python3
197+
import sys
198+
from pathlib import Path
199+
200+
__root_dir = Path(__file__).parents[4]
201+
sys.path.append(str(__root_dir))
202+
203+
```
204+
4. Create the `__main__.py` file. An example of the `__main__.py` boilerplate structure can be seen below:
205+
```python3
206+
#!/usr/bin/env python3
207+
208+
from pprint import pprint
209+
from sys import argv
210+
211+
from src.core.utils.module import run_module
212+
from .module import Runner
213+
214+
result = run_module(Runner, args=argv, arg_name="username", arg_default="johndoe")
215+
pprint(result)
216+
```
217+
5. Create the module itself. An example of the basic `module.py` file can be seen below:
218+
```python3
219+
#!/usr/bin/env python3
220+
221+
# Import any required runner
222+
# 1. OsintRunner - for OSINT scripts
223+
# 2. ReconRunner - for RECON scripts
224+
# 3. BaseRunner - for out-of-scope scripts ("other")
225+
from src.core.base.osint import OsintRunner, BaseRunner, ReconRunner, PossibleKeys
226+
227+
# Import 'ScriptResponse' to return good responses from the module, like
228+
# 1. ScriptResponse.success - if everything is good
229+
# 2. ScriptResponse.error - if everything is bad
230+
from src.core.utils.response import ScriptResponse
231+
232+
# Validate your named arguments. For example, this validator
233+
# will raise 'KeyError' if you will try to put 'hostname' argument
234+
# into the 'OsintRunner' runner, and so on
235+
from src.core.utils.validators import validate_kwargs
236+
237+
# You can use OsintRunner, ReconRunner or BaseRunner as the base class
238+
class Runner(OsintRunner):
239+
"""
240+
Basic script example
241+
"""
242+
243+
# Define required arguments here
244+
required = ["my_argument"]
245+
246+
def __init__(self, logger: str = __name__):
247+
"""
248+
Re-init base class instance with this function.
249+
Simply put, you need to provide proper logger name
250+
to the parent class, so please, save this structure for
251+
the init function.
252+
:param logger: logger to use (name of _this_ runner by default)
253+
"""
254+
super(Runner, self).__init__(logger)
255+
256+
# Validate input arguments (if you need some validation)
257+
@validate_kwargs(PossibleKeys.KEYS)
258+
def run(self, *args, **kwargs) -> ScriptResponse.success or ScriptResponse.error:
259+
"""
260+
The main '.run()' function to run your script.
261+
Note: this function is always synchronous, without any
262+
async/await init. You can use 'asyncio.run(...)' here,
263+
but don't put any 'async' before function definition
264+
:param args: args that you provide (not used for now)
265+
:param kwargs: kwargs that you provide (required to run something!)
266+
:return: ScriptResponse message (error or success)
267+
"""
268+
argument = kwargs.get("my_argument", "Arguments were not provided!")
269+
...
270+
return ScriptResponse.success(message=f"Script finished with argument {argument}")
271+
```
272+
6. For `test_module.py` you can use any required tests (as you wish). A test case for your module is required to keep the project clean.

assets/screenshots/cli.png

2.21 MB
Loading

assets/screenshots/docker.png

46.8 KB
Loading

assets/screenshots/logo.png

65.3 KB
Loading

cli.py

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env python3
2+
3+
"""
4+
Main runner.
5+
"""
6+
7+
from logging import basicConfig, INFO
8+
9+
from src.cli.handlers.files import FileManager
10+
from src.cli.interface.arguments import parse_args
11+
from src.cli.interface.validators import check_arg_length, check_py_version
12+
from src.cli.interface.opener import show_opener
13+
from src.core.runner.manager import CaseManager
14+
from pathlib import Path
15+
16+
17+
basicConfig(level=INFO)
18+
19+
20+
if __name__ == "__main__":
21+
# fmt: off
22+
23+
show_opener()
24+
check_py_version()
25+
check_arg_length()
26+
scenario = str(parse_args().scenario)
27+
28+
if scenario.endswith("json"):
29+
cases = FileManager.load_json_scenario(scenario)
30+
else:
31+
cases = FileManager.load_yaml_scenario(scenario)
32+
33+
manager = CaseManager(cases)
34+
results = list(manager.multi_case_runner())
35+
36+
FileManager.save_results(results, name=Path(scenario).stem)
37+
38+
# fmt: on

docker-compose.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: "3.8"
2+
3+
services:
4+
db:
5+
container_name: osint-framework-db
6+
image: postgres:alpine
7+
environment:
8+
POSTGRES_HOST_AUTH_METHOD: trust
9+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-osint_framework}
10+
POSTGRES_USER: ${POSTGRES_USER:-osint_framework}
11+
PGDATA: /data/postgres
12+
healthcheck:
13+
test: pg_isready -U osint_framework
14+
interval: 30s
15+
timeout: 5s
16+
retries: 5
17+
volumes:
18+
- postgres:/data/postgres
19+
networks:
20+
- postgres
21+
ports:
22+
- "5432:5432"
23+
server:
24+
container_name: osint-framework-server
25+
image: osint-framework-server:1.0
26+
depends_on:
27+
- db
28+
environment:
29+
POSTGRES_DATABASE: ${POSTGRES_DATABASE:-osint}
30+
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-osint_framework}
31+
POSTGRES_USER: ${POSTGRES_USER:-osint_framework}
32+
POSTGRES_HOST: ${POSTGRES_HOST:-osint-framework-db}
33+
POSTGRES_PORT: ${POSTGRES_PORT:-5432}
34+
build:
35+
context: .
36+
target: osint-framework-server
37+
dockerfile: docker/server/Dockerfile
38+
healthcheck:
39+
test: curl --fail -s http://localhost:8888/api/health || exit 1
40+
interval: 30s
41+
timeout: 5s
42+
retries: 5
43+
ports:
44+
- "8888:8888"
45+
networks:
46+
- postgres
47+
networks:
48+
postgres:
49+
driver: bridge
50+
volumes:
51+
postgres:

0 commit comments

Comments
 (0)