-
-
Notifications
You must be signed in to change notification settings - Fork 768
API
Ali Razmjoo edited this page Apr 20, 2018
·
19 revisions
WebUI/API Manual usage explained in the Usage page but let's get into the requests structure now.
API usage porposes are depend on the users, Some of them may want to scan their local company to monitor the network, This feature let all security staff to use OWASP Nettacker on a shared server safely (You may enable the HTTPS).
- Run the API
python nettacker.py --start-api
- you will get the API Key printed on the screen
C:\Users\Zombie\Documents\GitHub\OWASP-Nettacker>python nettacker.py --start-api
______ __ _____ _____
/ __ \ \ / /\ / ____| __ \
| | | \ \ /\ / / \ | (___ | |__) |
| | | |\ \/ \/ / /\ \ \___ \| ___/
| |__| | \ /\ / ____ \ ____) | | Version 0.0.1
\____/ \/ \/_/ \_\_____/|_| SAME
_ _ _ _ _
| \ | | | | | | | |
github.com/viraintel | \| | ___| |_| |_ __ _ ___| | _____ _ __
owasp.org | . ` |/ _ \ __| __/ _` |/ __| |/ / _ \ '__|
viraintel.com | |\ | __/ |_| || (_| | (__| < __/ |
|_| \_|\___|\__|\__\__,_|\___|_|\_\___|_|
* API Key: 8370bd0a0b9a98ac25b341833fb0fb07
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
- you must send API key through the request each time you send a request in
GET
orPOST
in the value namedkey
or you will get401
error.
>>> import requests
>>> r = requests.get('http://127.0.0.1:5000')
>>> r.status_code
401
>>> print r.content
{
"msg": "invalid API key",
"status": "error"
}
>>> r = requests.get('http://127.0.0.1:5000/?key=8370bd0a0b9a98ac25b341833fb0fb07')
>>> r.status_code
200
>>> print r.content
{
"msg": "please read documentations https://github.com/viraintel/OWASP-Nettacker/wiki",
"status": "ok"
}
>>> r = requests.post('http://127.0.0.1:5000/', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07"})
>>> r.status_code
200
>>> print r.content
{
"msg": "please read documentations https://github.com/viraintel/OWASP-Nettacker/wiki",
"status": "ok"
}
>>>
- Note: all HTTP keys could be sent with the
GET
orPOST
request. - New scan must be submitted to
/new/scan
URL path inGET
orPOST
request.
>>> r = requests.post('http://127.0.0.1:5000/new/scan', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07", "targets": "127.0.0.1,owasp.org", "scan_method": "tcp_connect_port_scan"})
>>> r.status_code
200
>>> print r.content
{
"check_ranges": false,
"check_subdomains": false,
"graph_flag": "d3_tree_v2_graph",
"language": "en",
"log_in_file": "results/results_2018_01_25_12_58_27_oefugjlsak.html",
"methods_args": null,
"passwds": null,
"ping_flag": false,
"ports": null,
"profile": null,
"retries": 3,
"scan_id": "dab63b8db15268293942e8ac2b1c3129",
"scan_method": [
"tcp_connect_port_scan"
],
"socks_proxy": null,
"targets": [
"owasp.org",
"127.0.0.1"
],
"thread_number": 100,
"thread_number_host": 30,
"time_sleep": 0.0,
"timeout_sec": 3,
"users": null,
"verbose_level": 0
}
>>>
- Note:
targets
andscan_method
are necessary. - Note:
scan_method
could be empty if you define theprofile
>>> r = requests.post('http://127.0.0.1:5000/new/scan', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07"})
>>> print r.content
{
"msg": "Cannot specify the target(s)",
"status": "error"
}
>>> r = requests.post('http://127.0.0.1:5000/new/scan', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07", "targets": "127.0.0.1"})
>>> print r.content
{
"msg": "please choose your scan method!",
"status": "error"
}
>>> r = requests.post('http://127.0.0.1:5000/new/scan', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07", "targets": "127.0.0.1", "scan_method": "dir_scan,tcp_connect_port_scan"})
>>> print r.content
{
"check_ranges": false,
"check_subdomains": false,
"graph_flag": "d3_tree_v2_graph",
"language": "en",
"log_in_file": "results/results_2018_01_25_13_01_03_sprzyedkmt.html",
"methods_args": null,
"passwds": null,
"ping_flag": false,
"ports": null,
"profile": null,
"retries": 3,
"scan_id": "23a5ee20c5478055273926ec1badbd5c",
"scan_method": [
"dir_scan",
"tcp_connect_port_scan"
],
"socks_proxy": null,
"targets": [
"127.0.0.1"
],
"thread_number": 100,
"thread_number_host": 30,
"time_sleep": 0.0,
"timeout_sec": 3,
"users": null,
"verbose_level": 0
}
>>> r = requests.post('http://127.0.0.1:5000/new/scan', data={"key": "8370bd0a0b9a98ac25b341833fb0fb07", "targets": "127.0.0.1", "profile": "information_gathering"})
>>> print r.content
{
"check_ranges": false,
"check_subdomains": false,
"graph_flag": "d3_tree_v2_graph",
"language": "en",
"log_in_file": "results/results_2018_01_25_13_01_21_cqaeseaxfw.html",
"methods_args": null,
"passwds": null,
"ping_flag": false,
"ports": null,
"profile": [
"information_gathering"
],
"retries": 3,
"scan_id": "f6f54949c7f41657d61336fa6cbee963",
"scan_method": [
"tcp_connect_port_scan"
],
"socks_proxy": null,
"targets": [
"127.0.0.1"
],
"thread_number": 100,
"thread_number_host": 30,
"time_sleep": 0.0,
"timeout_sec": 3,
"users": null,
"verbose_level": 0
}
>>>
- all variables in JSON you've got in results could be changed in
GET
/POST
method, you can fill them all just like normal CLI commands. (e.g. same scan method name (modules), you can separate with,
, you can useports
like80,100-200,1000,2000
, set users and passwdsuser1,user2
,passwd1,passwd2
) - Note: you cannot use
read_from_file:/tmp/users.txt
syntax inmethods_args
. if you want to send a big password list, just send it through thePOST
requests and separated with,
.