
API RESTful che avvolge Nmap per scansione automatica della rete, rilevamento delle porte, enumerazione dei servizi e analisi delle vulnerabilità, con generazione opzionale di report basata su intelligenza artificiale.
Utilizza python3.10, Debian, python-Nmap e il framework Flask per creare un'API Nmap in grado di eseguire scansioni ad alta velocità online e facile da distribuire.
Questa è un'implementazione per il nostro progetto universitario PCL, ancora in fase di sviluppo e costantemente aggiornato.
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}
| Parametro | Tipo | Descrizione |
|---|---|---|
auth_key | string | Obbligatoria. La chiave auth dell'API |
target | string | Obbligatorio. L'hostname e IP di destinazione |
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>
| Parametro | Tipo | Descrizione |
|---|---|---|
ID | Int | ID utente |
Passwd | String | Password utente |
Aggiunta funzionalità GPT con modulo di chunking.
La metodologia si basa su come funzionano gli embedding di Langchain GPT. In pratica l'operazione funziona così:
Data -> Chunks_generator ─┐ ┌─> AI_Loop -> Data_Extraction -> Return_Data
├─> Chunk1 ─┤
├─> Chunk2 ─┤
├─> Chunk3 ─┤
└─> Chunk N ─┘
Codice AI:
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
Default_Key: e43d4
gli aggiornamenti più recenti sono ancora in corso
| Parametro | Dati di ritorno | Descrizione | Comando Nmap |
|---|
p1 | json | Scansione efficace | -Pn -sV -T4 -O -F |
p2 | json | Scansione semplice | -Pn -T4 -A -v |
p3 | json | Scansione a basso consumo | -Pn -sS -sU -T4 -A -v |
p4 | json | Scansione intensiva parziale | -Pn -p- -T4 -A -v |
p5 | json | Scansione intensiva completa | -Pn -sS -sU -T4 -A -PE -PP -PY -g 53 --script=vuln |
p6 | json | Rilevamento completo delle versioni dei servizi | -Pn -sV -p- -A |
p7 | json | Scansione aggressiva con rilevamento OS | -Pn -sS -sV -O -T4 -A |
p8 | json | Scansione script per vulnerabilità comuni | -Pn -sC |
p9 | json | Scansione intensiva, tutte le porte TCP | -Pn -p 1-65535 -T4 -A -v |
p10 | json | Scansione UDP | -Pn -sU -T4 |
p11 | json | Rilevamento servizi e versioni per le porte principali | -Pn -sV --top-ports 100 |
p12 | json | Scansione aggressiva con script NSE per vulnerabilità | -Pn -sS -sV -T4 --script=default,discovery,vuln |
p13 | json | Scansione rapida per le porte comuni | -Pn -F |