Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,84 @@
|
|
| 1 |
-
---
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- es
|
| 4 |
+
license: apache-2.0
|
| 5 |
+
library_name: transformers
|
| 6 |
+
tags:
|
| 7 |
+
- network-administration
|
| 8 |
+
- security
|
| 9 |
+
- nmap
|
| 10 |
+
- ufw
|
| 11 |
+
- text-to-code
|
| 12 |
+
- codet5
|
| 13 |
+
base_model: Salesforce/codet5-small
|
| 14 |
+
model_name: Grape-Syrah
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# Model Card for Grape-Syrah
|
| 18 |
+
|
| 19 |
+
Grape-Syrah is a specialized lightweight AI model designed to translate natural language instructions (in Spanish) into executable Linux Bash commands focused on network administration, security auditing, and diagnostics. It is based on the Salesforce/codet5-small architecture and has been fine-tuned to act as a local network terminal assistant.
|
| 20 |
+
|
| 21 |
+
## Model Description
|
| 22 |
+
|
| 23 |
+
- **Model Name:** Grape-Syrah
|
| 24 |
+
- **Base Model:** Salesforce/codet5-small
|
| 25 |
+
- **Task:** Text-to-Text Generation (Natural Language to Bash)
|
| 26 |
+
- **Domain:** Network Security, Diagnostics, and Firewall Management
|
| 27 |
+
- **Language:** Spanish (Instructions) -> Bash (Code)
|
| 28 |
+
- **Input Format:** `Contexto: ['hostname=ip', 'gateway=ip'] | Natural language instruction`
|
| 29 |
+
|
| 30 |
+
This model has been specifically trained to handle network-specific tasks including port scanning, connectivity testing, DNS resolution, and firewall configuration. It is designed to understand complex context constraints, distinguishing between local environment variables and external targets.
|
| 31 |
+
|
| 32 |
+
## Intended Use
|
| 33 |
+
|
| 34 |
+
This model is intended to be used as a CLI assistant for system administrators, DevOps engineers, or cybersecurity professionals who need to generate precise network commands from Spanish natural language queries.
|
| 35 |
+
|
| 36 |
+
## Key Capabilities
|
| 37 |
+
|
| 38 |
+
### Network Discovery & Scanning
|
| 39 |
+
- **Nmap Proficiency:** Generates complex `nmap` commands including version detection (`-sV`), OS detection (`-O`), aggressive scanning (`-A`), and specific port ranges.
|
| 40 |
+
- **Stealth & Evasion:** Understands requests for scans without ping (`-Pn`), fast scans (`-F`), or specific protocol scans (`-sU`).
|
| 41 |
+
|
| 42 |
+
### Connectivity & Diagnostics
|
| 43 |
+
- **Status Checks:** Handles `ping`, `traceroute`, and `mtr` for both IPv4 and IPv6.
|
| 44 |
+
- **Socket Inspection:** Uses `ss` and `netstat` to identify listening ports, established connections, and specific processes.
|
| 45 |
+
- **Routing & Addressing:** Manages `ip addr`, `ip route`, `ip neigh` (ARP), and `hostname` commands.
|
| 46 |
+
|
| 47 |
+
### DNS & Information Gathering
|
| 48 |
+
- **Resolution:** Proficient with `dig`, `nslookup`, and `host` for forward and reverse lookups, identifying record types (MX, NS, TXT, SOA).
|
| 49 |
+
- **Web Recon:** Uses `curl -I` and `wget` to inspect headers or retrieve connectivity status.
|
| 50 |
+
|
| 51 |
+
### Firewall Management (UFW)
|
| 52 |
+
- **Context Awareness:** Can distinguish between global rules (e.g., "open port 80") and context-specific rules (e.g., "block traffic from the attacker IP").
|
| 53 |
+
- **Syntax Precision:** Correctly generates complex `ufw` syntax, including `allow from <IP> to any port <PORT>`.
|
| 54 |
+
|
| 55 |
+
### Safety & Precision
|
| 56 |
+
- **Context Adherence:** Accurately maps natural language hostnames (e.g., "backup server") to the IPs provided in the context context.
|
| 57 |
+
- **Hallucination Reduction:** Avoids inventing IPs. If a target is not in the context, it defaults to standard public targets (e.g., Google DNS) or localhosts only when implied by the prompt.
|
| 58 |
+
- **Ambiguity Resolution:** Can interpret colloquial requests like "my internet is slow" or "who is on my wifi" into technical commands (`ping`, `ip neigh`).
|
| 59 |
+
|
| 60 |
+
## How to Get Started
|
| 61 |
+
|
| 62 |
+
You can use this model with the `transformers` library.
|
| 63 |
+
|
| 64 |
+
```python
|
| 65 |
+
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
| 66 |
+
|
| 67 |
+
model_name = "jrodriiguezg/grape-syrah"
|
| 68 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 69 |
+
model = T5ForConditionalGeneration.from_pretrained(model_name)
|
| 70 |
+
|
| 71 |
+
# Define the context (simulated network environment)
|
| 72 |
+
context = "Contexto: ['srv_web=192.168.1.50', 'attacker=203.0.113.5']"
|
| 73 |
+
instruction = "bloquea todo el trafico entrante desde la ip del atacante"
|
| 74 |
+
|
| 75 |
+
# Prepare input
|
| 76 |
+
input_text = f"translate Spanish to Bash: {context} | {instruction}"
|
| 77 |
+
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
| 78 |
+
|
| 79 |
+
# Generate command
|
| 80 |
+
outputs = model.generate(input_ids, max_length=128)
|
| 81 |
+
command = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 82 |
+
|
| 83 |
+
print(command)
|
| 84 |
+
# Output: ufw deny from 203.0.113.5
|