
RESTful API, die Nmap umschließt, für automatisierte Netzwerkscans, Port-Erkennung, Dienstaufzählung und Schwachstellenanalyse mit optionaler KI-gestützter Berichterstellung.
Verwendet Python 3.10, Debian, Python-Nmap und das Flask-Framework, um eine Nmap-API zu erstellen, die Scans mit guter Geschwindigkeit online durchführen kann und einfach bereitzustellen ist.
Dies ist eine Implementierung für unser College-PCL-Projekt, das sich noch in der Entwicklung befindet und ständig aktualisiert wird.
GET /api/p1/{auth_key}/{target}
GET /api/p2/{auth_key}/{target}
GET /api/p3/{auth_key}/{target}
GET /api/p4/{auth_key}/{target}
GET /api/p5/{auth_key}/{target}
| Parameter | Typ | Beschreibung |
|---|---|---|
auth_key | string | Erforderlich. Der API-Authentifizierungsschlüssel |
target | string | Erforderlich. Der Ziel-Hostname und die IP |
GET /api/p1/
GET /api/p2/
GET /api/p3/
GET /api/p4/
GET /api/p5/
GET /api/p6/
GET /api/p7/
GET /api/p8/
GET /api/p9/
GET /api/p10/
GET /api/p11/
GET /api/p12/
GET /api/p13/
GET /register/<int:user_id>/<string:password>
| Parameter | Typ | Beschreibung |
|---|---|---|
ID | Int | Benutzer-ID |
Passwd | String | Benutzer-Passwort |
GPT-Funktionalität mit einem Chunking-Modul hinzugefügt.
Die Methodik basiert auf der Funktionsweise von Langchain GPT embeddings. Grundsätzlich läuft der Vorgang wie folgt ab:
Daten -> Chunks_Generator ─┐ ┌─> AI_Schleife -> Daten_Extraktion -> Rückgabe_Daten
├─> Chunk1 ─┤
├─> Chunk2 ─┤
├─> Chunk3 ─┤
└─> Chunk N ─┘
KI-Code:
def AI(analize: str) -> dict[str, any]:
prompt = f"""
Do a NMAP scan analysis on the provided NMAP scan information
The NMAP output must return in a JSON format accorging to the provided
output format. The data must be accurate in regards towards a pentest report.
The data must follow the following rules:
1) The NMAP scans must be done from a pentester point of view
2) The final output must be minimal according to the format given.
3) The final output must be kept to a minimal.
4) If a value not found in the scan just mention an empty string.
5) Analyze everything even the smallest of data.
6) Completely analyze the data provided and give a confirm answer using the output format.
The output format:
{{
"critical score": [""],
"os information": [""],
"open ports": [""],
"open services": [""],
"vulnerable service": [""],
"found cve": [""]
}}
NMAP Data to be analyzed: {analize}
"""
messages = [{"content": prompt, "role": "assistant"}]
response = openai.ChatCompletion.create(
model=model_engine,
messages=messages,
max_tokens=2500,
n=1,
stop=None,
)
response = response['choices'][0]['message']['content']
ai_output = {
"markdown": response
}
return ai_output
Standard_Schlüssel: e43d4
neuere Updates sind noch in Arbeit
| Parameter | Rückgabedaten | Beschreibung | Nmap-Befehl |
|---|
p1 | json | Effektiver Scan | -Pn -sV -T4 -O -F |
p2 | json | Einfacher Scan | -Pn -T4 -A -v |
p3 | json | Scan mit niedrigem Stromverbrauch | -Pn -sS -sU -T4 -A -v |
p4 | json | Teilweise intensiver Scan | -Pn -p- -T4 -A -v |
p5 | json | Vollständig intensiver Scan | -Pn -sS -sU -T4 -A -PE -PP -PY -g 53 --script=vuln |
p6 | json | Umfassende Dienstversionserkennung | -Pn -sV -p- -A |
p7 | json | Aggressiver Scan mit Betriebssystemerkennung | -Pn -sS -sV -O -T4 -A |
p8 | json | Skript-Scan auf häufige Schwachstellen | -Pn -sC |
p9 | json | Intensiver Scan, alle TCP-Ports | -Pn -p 1-65535 -T4 -A -v |
p10 | json | UDP-Scan | -Pn -sU -T4 |
p11 | json | Dienst- und Versionserkennung der Top-Ports | -Pn -sV --top-ports 100 |
p12 | json | Aggressiver Scan mit NSE-Skripten auf Schwachstellen | -Pn -sS -sV -T4 --script=default,discovery,vuln |
p13 | json | Schneller Scan auf häufige Ports | -Pn -F |