mirror of https://github.com/OWASP/Nettacker.git
changed nettacker's data directory naming (#1100)
* changed nettacker's data directory naming * migration from .data to .nettacker * ruff fixes * documentation update
This commit is contained in:
parent
0f30544584
commit
a373e23c28
|
|
@ -1 +0,0 @@
|
||||||
### Nettacker's data path
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
### Nettacker's results path
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
### Nettacker's tmp path
|
|
||||||
|
|
@ -19,7 +19,7 @@ logs.txt
|
||||||
*.log
|
*.log
|
||||||
results.*
|
results.*
|
||||||
.owasp-nettacker*
|
.owasp-nettacker*
|
||||||
.data*
|
.nettacker/data*
|
||||||
*.DS_Store
|
*.DS_Store
|
||||||
*.swp
|
*.swp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,8 @@ $ docker-compose up -d && docker exec -it nettacker-nettacker-1 /bin/bash
|
||||||
# poetry run python nettacker.py -i owasp.org -s -m port_scan
|
# poetry run python nettacker.py -i owasp.org -s -m port_scan
|
||||||
```
|
```
|
||||||
* Results are accessible from your (https://localhost:5000) or https://nettacker-api.z3r0d4y.com:5000/ (pointed to your localhost)
|
* Results are accessible from your (https://localhost:5000) or https://nettacker-api.z3r0d4y.com:5000/ (pointed to your localhost)
|
||||||
* The local database is `.data/nettacker.db` (sqlite).
|
* The local database is `.nettacker/data/nettacker.db` (sqlite).
|
||||||
* Default results path is `.data/results`
|
* Default results path is `.nettacker/data/results`
|
||||||
* `docker-compose` will share your nettacker folder, so you will not lose any data after `docker-compose down`
|
* `docker-compose` will share your nettacker folder, so you will not lose any data after `docker-compose down`
|
||||||
* To see the API key in you can run `docker logs nettacker_nettacker_1`.
|
* To see the API key in you can run `docker logs nettacker_nettacker_1`.
|
||||||
* More details and setup without docker https://github.com/OWASP/Nettacker/wiki/Installation
|
* More details and setup without docker https://github.com/OWASP/Nettacker/wiki/Installation
|
||||||
|
|
|
||||||
46
docs/API.md
46
docs/API.md
|
|
@ -85,15 +85,15 @@ To submit a new scan follow this step.
|
||||||
"check_ranges": false,
|
"check_ranges": false,
|
||||||
"check_subdomains": false,
|
"check_subdomains": false,
|
||||||
"database_host": "",
|
"database_host": "",
|
||||||
"database_name": "/home/am4n/owasp-nettacker/.data/nettacker.db",
|
"database_name": "/home/am4n/owasp-nettacker/.nettacker/data/nettacker.db",
|
||||||
"database_password": "",
|
"database_password": "",
|
||||||
"database_port": "",
|
"database_port": "",
|
||||||
"database_type": "sqlite",
|
"database_type": "sqlite",
|
||||||
"database_username": "",
|
"database_username": "",
|
||||||
"graph_flag": "d3_tree_v2_graph",
|
"graph_flag": "d3_tree_v2_graph",
|
||||||
"home_path": "/home/am4n/owasp-nettacker/.data",
|
"home_path": "/home/am4n/owasp-nettacker/.nettacker/data",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"log_in_file": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_36_56_mibtrtoacd.html",
|
"log_in_file": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_36_56_mibtrtoacd.html",
|
||||||
"methods_args": {
|
"methods_args": {
|
||||||
"as_user_set": "set_successfully"
|
"as_user_set": "set_successfully"
|
||||||
},
|
},
|
||||||
|
|
@ -101,7 +101,7 @@ To submit a new scan follow this step.
|
||||||
"ping_flag": false,
|
"ping_flag": false,
|
||||||
"ports": null,
|
"ports": null,
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"results_path": "/home/am4n/owasp-nettacker/.data/results",
|
"results_path": "/home/am4n/owasp-nettacker/.nettacker/data/results",
|
||||||
"retries": 3,
|
"retries": 3,
|
||||||
"scan_method": [
|
"scan_method": [
|
||||||
"port_scan"
|
"port_scan"
|
||||||
|
|
@ -114,7 +114,7 @@ To submit a new scan follow this step.
|
||||||
"thread_number_host": 5,
|
"thread_number_host": 5,
|
||||||
"time_sleep": 0.0,
|
"time_sleep": 0.0,
|
||||||
"timeout_sec": 3,
|
"timeout_sec": 3,
|
||||||
"tmp_path": "/home/am4n/owasp-nettacker/.data/tmp",
|
"tmp_path": "/home/am4n/owasp-nettacker/.nettacker/data/tmp",
|
||||||
"users": null,
|
"users": null,
|
||||||
"verbose_level": 0
|
"verbose_level": 0
|
||||||
}
|
}
|
||||||
|
|
@ -138,15 +138,15 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"check_ranges": false,
|
"check_ranges": false,
|
||||||
"check_subdomains": false,
|
"check_subdomains": false,
|
||||||
"database_host": "",
|
"database_host": "",
|
||||||
"database_name": "/home/am4n/owasp-nettacker/.data/nettacker.db",
|
"database_name": "/home/am4n/owasp-nettacker/.nettacker/data/nettacker.db",
|
||||||
"database_password": "",
|
"database_password": "",
|
||||||
"database_port": "",
|
"database_port": "",
|
||||||
"database_type": "sqlite",
|
"database_type": "sqlite",
|
||||||
"database_username": "",
|
"database_username": "",
|
||||||
"graph_flag": "d3_tree_v2_graph",
|
"graph_flag": "d3_tree_v2_graph",
|
||||||
"home_path": "/home/am4n/owasp-nettacker/.data",
|
"home_path": "/home/am4n/owasp-nettacker/.nettacker/data",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"log_in_file": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_47_08_dugacttfmf.html",
|
"log_in_file": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_47_08_dugacttfmf.html",
|
||||||
"methods_args": {
|
"methods_args": {
|
||||||
"as_user_set": "set_successfully"
|
"as_user_set": "set_successfully"
|
||||||
},
|
},
|
||||||
|
|
@ -154,7 +154,7 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"ping_flag": false,
|
"ping_flag": false,
|
||||||
"ports": null,
|
"ports": null,
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"results_path": "/home/am4n/owasp-nettacker/.data/results",
|
"results_path": "/home/am4n/owasp-nettacker/.nettacker/data/results",
|
||||||
"retries": 3,
|
"retries": 3,
|
||||||
"scan_method": [
|
"scan_method": [
|
||||||
"dir_scan",
|
"dir_scan",
|
||||||
|
|
@ -168,7 +168,7 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"thread_number_host": 5,
|
"thread_number_host": 5,
|
||||||
"time_sleep": 0.0,
|
"time_sleep": 0.0,
|
||||||
"timeout_sec": 3,
|
"timeout_sec": 3,
|
||||||
"tmp_path": "/home/am4n/owasp-nettacker/.data/tmp",
|
"tmp_path": "/home/am4n/owasp-nettacker/.nettacker/data/tmp",
|
||||||
"users": null,
|
"users": null,
|
||||||
"verbose_level": 0
|
"verbose_level": 0
|
||||||
}
|
}
|
||||||
|
|
@ -179,15 +179,15 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"check_ranges": false,
|
"check_ranges": false,
|
||||||
"check_subdomains": false,
|
"check_subdomains": false,
|
||||||
"database_host": "",
|
"database_host": "",
|
||||||
"database_name": "/home/am4n/owasp-nettacker/.data/nettacker.db",
|
"database_name": "/home/am4n/owasp-nettacker/.nettacker/data/nettacker.db",
|
||||||
"database_password": "",
|
"database_password": "",
|
||||||
"database_port": "",
|
"database_port": "",
|
||||||
"database_type": "sqlite",
|
"database_type": "sqlite",
|
||||||
"database_username": "",
|
"database_username": "",
|
||||||
"graph_flag": "d3_tree_v2_graph",
|
"graph_flag": "d3_tree_v2_graph",
|
||||||
"home_path": "/home/am4n/owasp-nettacker/.data",
|
"home_path": "/home/am4n/owasp-nettacker/.nettacker/data",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"log_in_file": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_50_09_xjqatmkngn.html",
|
"log_in_file": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_50_09_xjqatmkngn.html",
|
||||||
"methods_args": {
|
"methods_args": {
|
||||||
"as_user_set": "set_successfully"
|
"as_user_set": "set_successfully"
|
||||||
},
|
},
|
||||||
|
|
@ -195,7 +195,7 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"ping_flag": false,
|
"ping_flag": false,
|
||||||
"ports": null,
|
"ports": null,
|
||||||
"profile": "information_gathering",
|
"profile": "information_gathering",
|
||||||
"results_path": "/home/am4n/owasp-nettacker/.data/results",
|
"results_path": "/home/am4n/owasp-nettacker/.nettacker/data/results",
|
||||||
"retries": 3,
|
"retries": 3,
|
||||||
"scan_method": [
|
"scan_method": [
|
||||||
"port_scan"
|
"port_scan"
|
||||||
|
|
@ -208,7 +208,7 @@ u'{"msg":"please choose your scan method!","status":"error"}\n'
|
||||||
"thread_number_host": 5,
|
"thread_number_host": 5,
|
||||||
"time_sleep": 0.0,
|
"time_sleep": 0.0,
|
||||||
"timeout_sec": 3,
|
"timeout_sec": 3,
|
||||||
"tmp_path": "/home/am4n/owasp-nettacker/.data/tmp",
|
"tmp_path": "/home/am4n/owasp-nettacker/.nettacker/data/tmp",
|
||||||
"users": null,
|
"users": null,
|
||||||
"verbose_level": 0
|
"verbose_level": 0
|
||||||
}
|
}
|
||||||
|
|
@ -285,7 +285,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_11_04_17_pisajfbfyp.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_11_04_17_pisajfbfyp.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -M 100",
|
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -M 100",
|
||||||
"scan_id": "b745337b4feeb99cee3eb4ff4cb45fad",
|
"scan_id": "b745337b4feeb99cee3eb4ff4cb45fad",
|
||||||
|
|
@ -302,7 +302,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_11_04_04_bdzipsmtcc.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_11_04_04_bdzipsmtcc.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all",
|
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all",
|
||||||
"scan_id": "8e9a1b2fd03cb7b969d99beea1cff2aa",
|
"scan_id": "8e9a1b2fd03cb7b969d99beea1cff2aa",
|
||||||
|
|
@ -319,7 +319,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_11_03_23_ubytvgauvj.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_11_03_23_ubytvgauvj.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -M 100 -t 1000",
|
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -M 100 -t 1000",
|
||||||
"scan_id": "7d84af54f343e19671d1c52357bf928f",
|
"scan_id": "7d84af54f343e19671d1c52357bf928f",
|
||||||
|
|
@ -336,7 +336,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_59_29_oyzxmegtuk.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_59_29_oyzxmegtuk.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -t 1000",
|
"scan_cmd": "nettacker.py -i 127.0.0.1 -m all -t 1000",
|
||||||
"scan_id": "d944c9a02053fd387d1e3343fec6b320",
|
"scan_id": "d944c9a02053fd387d1e3343fec6b320",
|
||||||
|
|
@ -353,7 +353,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": "information_gathering",
|
"profile": "information_gathering",
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_50_09_xjqatmkngn.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_50_09_xjqatmkngn.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "Through the OWASP Nettacker API",
|
"scan_cmd": "Through the OWASP Nettacker API",
|
||||||
"scan_id": "05ba4e5b839b5ba525c9a35baa8864a1",
|
"scan_id": "05ba4e5b839b5ba525c9a35baa8864a1",
|
||||||
|
|
@ -370,7 +370,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_47_08_dugacttfmf.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_47_08_dugacttfmf.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "Through the OWASP Nettacker API",
|
"scan_cmd": "Through the OWASP Nettacker API",
|
||||||
"scan_id": "18af7af856b4ceefac659a59c4908088",
|
"scan_id": "18af7af856b4ceefac659a59c4908088",
|
||||||
|
|
@ -387,7 +387,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_35_10_jvxotwxako.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_35_10_jvxotwxako.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "Through the OWASP Nettacker API",
|
"scan_cmd": "Through the OWASP Nettacker API",
|
||||||
"scan_id": "78d253c3a28d2bb4f467ac040ccaa854",
|
"scan_id": "78d253c3a28d2bb4f467ac040ccaa854",
|
||||||
|
|
@ -404,7 +404,7 @@ To enable session-based requests, like (e.g. Python `requests.session()` or brow
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"ports": "default",
|
"ports": "default",
|
||||||
"profile": null,
|
"profile": null,
|
||||||
"report_filename": "/home/am4n/owasp-nettacker/.data/results/results_2020_06_09_10_36_56_mibtrtoacd.html",
|
"report_filename": "/home/am4n/owasp-nettacker/.nettacker/data/results/results_2020_06_09_10_36_56_mibtrtoacd.html",
|
||||||
"report_type": "HTML",
|
"report_type": "HTML",
|
||||||
"scan_cmd": "Through the OWASP Nettacker API",
|
"scan_cmd": "Through the OWASP Nettacker API",
|
||||||
"scan_id": "708e1dcf0f2ce9fe71038ccea7bf28bb",
|
"scan_id": "708e1dcf0f2ce9fe71038ccea7bf28bb",
|
||||||
|
|
|
||||||
|
|
@ -7,4 +7,4 @@ OWASP Nettacker API files are stored in here.
|
||||||
* `engine.py` is entry point of API and main functions
|
* `engine.py` is entry point of API and main functions
|
||||||
* `api_core.py` has core functions
|
* `api_core.py` has core functions
|
||||||
* `start_scan.py` run new scans
|
* `start_scan.py` run new scans
|
||||||
* `database.sqlite3` an empty API database for sample, its copy to `./.data/database.sqlite3` and stores data i there.
|
* `database.sqlite3` an empty API database for sample, its copy to `./.nettacker/data/database.sqlite3` and stores data in there.
|
||||||
|
|
@ -62,7 +62,7 @@ sensitive_headers = {
|
||||||
class ApiConfig(ConfigBase):
|
class ApiConfig(ConfigBase):
|
||||||
"""OWASP Nettacker API Default Configuration"""
|
"""OWASP Nettacker API Default Configuration"""
|
||||||
|
|
||||||
api_access_log = str(CWD / ".data/nettacker.log")
|
api_access_log = str(CWD / ".nettacker/data/nettacker.log")
|
||||||
api_access_key = generate_random_token(32)
|
api_access_key = generate_random_token(32)
|
||||||
api_client_whitelisted_ips = [] # disabled - to enable please put an array with list of ips/cidr/ranges
|
api_client_whitelisted_ips = [] # disabled - to enable please put an array with list of ips/cidr/ranges
|
||||||
# [
|
# [
|
||||||
|
|
@ -98,7 +98,7 @@ class DbConfig(ConfigBase):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
engine = "sqlite"
|
engine = "sqlite"
|
||||||
name = str(CWD / ".data/nettacker.db")
|
name = str(CWD / ".nettacker/data/nettacker.db")
|
||||||
host = ""
|
host = ""
|
||||||
port = ""
|
port = ""
|
||||||
username = ""
|
username = ""
|
||||||
|
|
@ -114,8 +114,9 @@ class PathConfig:
|
||||||
a JSON contain the working, tmp and results path
|
a JSON contain the working, tmp and results path
|
||||||
"""
|
"""
|
||||||
|
|
||||||
data_dir = CWD / ".data"
|
data_dir = CWD / ".nettacker/data"
|
||||||
database_file = CWD / ".data/nettacker.db"
|
new_database_file = CWD / ".nettacker/data/nettacker.db"
|
||||||
|
old_database_file = CWD / ".data/nettacker.db"
|
||||||
graph_dir = PACKAGE_PATH / "lib/graph"
|
graph_dir = PACKAGE_PATH / "lib/graph"
|
||||||
home_dir = CWD
|
home_dir = CWD
|
||||||
locale_dir = PACKAGE_PATH / "locale"
|
locale_dir = PACKAGE_PATH / "locale"
|
||||||
|
|
@ -124,8 +125,8 @@ class PathConfig:
|
||||||
modules_dir = PACKAGE_PATH / "modules"
|
modules_dir = PACKAGE_PATH / "modules"
|
||||||
payloads_dir = PACKAGE_PATH / "lib/payloads"
|
payloads_dir = PACKAGE_PATH / "lib/payloads"
|
||||||
release_name_file = PACKAGE_PATH / "release_name.txt"
|
release_name_file = PACKAGE_PATH / "release_name.txt"
|
||||||
results_dir = CWD / ".data/results"
|
results_dir = CWD / ".nettacker/data/results"
|
||||||
tmp_dir = CWD / ".data/tmp"
|
tmp_dir = CWD / ".nettacker/data/tmp"
|
||||||
web_static_dir = PACKAGE_PATH / "web/static"
|
web_static_dir = PACKAGE_PATH / "web/static"
|
||||||
user_agents_file = PACKAGE_PATH / "lib/payloads/User-Agents/web_browsers_user_agents.txt"
|
user_agents_file = PACKAGE_PATH / "lib/payloads/User-Agents/web_browsers_user_agents.txt"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
import shutil
|
||||||
import socket
|
import socket
|
||||||
import sys
|
import sys
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
|
|
@ -76,7 +77,12 @@ class Nettacker(ArgParser):
|
||||||
|
|
||||||
if Config.db.engine == "sqlite":
|
if Config.db.engine == "sqlite":
|
||||||
try:
|
try:
|
||||||
if not Config.path.database_file.exists():
|
if not Config.path.new_database_file.exists():
|
||||||
|
Config.path.new_database_file.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
if Config.path.old_database_file.exists():
|
||||||
|
shutil.copy(Config.path.old_database_file, Config.path.new_database_file)
|
||||||
|
log.warn("Database files migrated from .data to .nettacker ...")
|
||||||
|
else:
|
||||||
sqlite_create_tables()
|
sqlite_create_tables()
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
die_failure("cannot access the directory {0}".format(Config.path.home_dir))
|
die_failure("cannot access the directory {0}".format(Config.path.home_dir))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue