Views
No views yet
Contexto: ['hostname=ip', 'gateway=ip'] | Natural language instructionnmap commands including version detection (-sV), OS detection (-O), aggressive scanning (-A), and specific port ranges.-Pn), fast scans (-F), or specific protocol scans (-sU).ping, traceroute, and mtr for both IPv4 and IPv6.ss and netstat to identify listening ports, established connections, and specific processes.ip addr, ip route, ip neigh (ARP), and hostname commands.dig, nslookup, and host for forward and reverse lookups, identifying record types (MX, NS, TXT, SOA).curl -I and wget to inspect headers or retrieve connectivity status.ufw syntax, including allow from <IP> to any port <PORT>.ping, ip neigh).transformers library.1from transformers import AutoTokenizer, T5ForConditionalGeneration
2
3model_name = "jrodriiguezg/grape-syrah"
4tokenizer = AutoTokenizer.from_pretrained(model_name)
5model = T5ForConditionalGeneration.from_pretrained(model_name)
6
7# Define the context (simulated network environment)
8context = "Contexto: ['srv_web=192.168.1.50', 'attacker=203.0.113.5']"
9instruction = "bloquea todo el trafico entrante desde la ip del atacante"
10
11# Prepare input
12input_text = f"translate Spanish to Bash: {context} | {instruction}"
13input_ids = tokenizer(input_text, return_tensors="pt").input_ids
14
15# Generate command
16outputs = model.generate(input_ids, max_length=128)
17command = tokenizer.decode(outputs[0], skip_special_tokens=True)
18
19print(command)
20# Output: ufw deny from 203.0.113.5