Data missing on /logs/get_json?target=
Please describe the issue or question and share your OS and Python version.
OS: x Ubuntu OS Version: x 22.04.2 LTS Python Version: x Python 3.10.12
Hi! in my program that i made to use nettacker i would like to replicate a function of the real UI , the function where you go on crawler and click on a host and inside there is a html table with all the events of that host. i currently did it with /logs/get_json?target=192.168.254.12, in response to that i get this json:
[{"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "22", "event": "host: 192.168.254.12 method: tcp_connect_send_and_receive ports: '22' timeout: 3.0 conditions: ssh: - -OpenSSH_", "json_event": {"timeout": 3.0, "host": "192.168.254.12", "ports": "22", "method": "tcp_connect_send_and_receive", "response": {"ssl_flag": false, "conditions_results": {"ssh": ["-OpenSSH_"]}}}}, {"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "3389", "event": "host: 192.168.254.12 method: tcp_connect_send_and_receive ports: '3389' timeout: 3.0 conditions: open_port: - ''", "json_event": {"timeout": 3.0, "host": "192.168.254.12", "ports": "3389", "method": "tcp_connect_send_and_receive", "response": {"ssl_flag": false, "conditions_results": {"open_port": [""]}}}}, {"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "3306", "event": "host: 192.168.254.12 method: tcp_connect_send_and_receive ports: '3306' timeout: 3.0 conditions: mysql: - is not allowed to connect to this MySQL server", "json_event": {"timeout": 3.0, "host": "192.168.254.12", "ports": "3306", "method": "tcp_connect_send_and_receive", "response": {"ssl_flag": false, "conditions_results": {"mysql": ["is not allowed to connect to this MySQL server"]}}}}, {"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "8081", "event": "host: 192.168.254.12 method: tcp_connect_send_and_receive ports: '8081' timeout: 3.0 conditions: http: - HTTP/1.1 400", "json_event": {"timeout": 3.0, "host": "192.168.254.12", "ports": "8081", "method": "tcp_connect_send_and_receive", "response": {"ssl_flag": true, "conditions_results": {"http": ["HTTP/1.1 400"]}}}}, {"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "", "event": "host: 192.168.254.12 method: socket_icmp timeout: 3.0 conditions: host: 192.168.254.12 response_time: 0.0008175373077392578 ssl_flag: false", "json_event": {"timeout": 3.0, "host": "192.168.254.12", "method": "socket_icmp", "response": {"ssl_flag": false, "conditions_results": {"host": "192.168.254.12", "response_time": 0.0008175373077392578, "ssl_flag": false}}}}, {"scan_unique_id": "xlcbpjisyjvzbcgidjzjgqxuiztvtqkg", "target": "192.168.254.12", "port": "8081", "event": "allow_redirects: false headers: User-Agent: Nettacker 0.3.2 TRENT method: get ssl: false timeout: 3.0 url: https://192.168.254.12:8081 conditions: log: '404' status_code: - '404'", "json_event": {"timeout": 3.0, "headers": {"User-Agent": "Nettacker 0.3.2 TRENT"}, "allow_redirects": false, "ssl": false, "url": "https://192.168.254.12:8081", "method": "get", "response": {"conditions_results": {"status_code": ["404"], "log": "404"}}}}]
the problem here is that the module name is missing, if we go on the nettacker UI and press on a host we see a table with the same data that i have in the json but there is also the module name, which i can't figure out where is located.
Where i can also find the module name?
When i list all the hosts they all have a module_name array with all the modules but then when i get the json i cannot determine which scan module a event has used, thank you very much!
@ErtyDess The problem you are facing is because the logs found in /logs/get_json/ does not contain the information you require, in order to obtain the actual result of the scan that has full information about the scan_modules and everything is to get the result json from /results/get_json. In order to get the result from /results/get_json you will need the id of the scan that can be found using the /results/get_list, after that you can use that id in form of /results/get_json?id=$ID to get the result json that contains all your required information. You can refer to API wiki for more information.
Link to wiki: https://github.com/OWASP/Nettacker/wiki/API#get-a-scan-result