Skip to content

Commit

Permalink
creating a scan via API call
Browse files Browse the repository at this point in the history
  • Loading branch information
lambomc committed Oct 11, 2023
1 parent d51de11 commit 27c287c
Show file tree
Hide file tree
Showing 2 changed files with 682 additions and 0 deletions.
83 changes: 83 additions & 0 deletions engines/nmap/JupyterNotebook.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"TEST CASE: test_scan_nmap\n",
"{\n",
" \"details\": {\n",
" \"scan_id\": \"665\"\n",
" }, \n",
" \"page\": \"startscan\", \n",
" \"status\": \"accepted\"\n",
"}\n",
"\n"
]
}
],
"source": [
"import json, requests, time \n",
"\n",
"print(\"TEST CASE: test_scan_nmap\")\n",
"post_data = {\n",
" \"assets\": [{\n",
" \"id\": 3,\n",
" \"value\": \"8.8.8.8\",\n",
" \"criticity\": \"low\",\n",
" \"datatype\": \"ip\"\n",
" },{\n",
" \"id\": 3,\n",
" \"value\": \"patrowl.io\",\n",
" \"criticity\": \"high\",\n",
" \"datatype\": \"domain\"\n",
" }],\n",
" \"options\": {\n",
" \"ports\": ['53', '56', '80', '443'],\n",
" \"no_ping\": 0,\n",
" \"no_dns\": 0,\n",
" \"detect_service_version\": 1\n",
" },\n",
" \"scan_id\": \"665\"\n",
"}\n",
"r = requests.post(url='http://0.0.0.0:5001/engines/nmap/startscan',\n",
" data=json.dumps(post_data),\n",
" headers = {'Content-type': 'application/json', 'Accept': 'application/json'})\n",
"\n",
"print(r.text)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.16"
},
"orig_nbformat": 4,
"vscode": {
"interpreter": {
"hash": "103830a904f3ae59b8ba079b3739593939c985deb32dfe4cef8446492d50f9ef"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 27c287c

Please sign in to comment.