--- license: gemma language: - en tags: - gemma - gemma-4 - lora - mlx - ethical-hacking - penetration-testing - cybersecurity - gguf - safetensors base_model: google/gemma-4-E2B-it pipeline_tag: text-generation model_type: gemma4 library_name: transformers --- # Thousands-Eye A fine-tuned Gemma 4 E2B model specialized for ethical hacking and penetration testing, designed as the AI backend for [invoke-sunstrike](https://github.com/Htunn/invoke-sunstrike). All model outputs include `"requires_authorization": true` — trained exclusively for authorized engagements. ## Model Downloads ### GGUF (Recommended — Ollama / llama.cpp) | Quantization | Size | Use case | |---|---|---| | [thousands-eye-Q4_K_M.gguf](https://huggingface.co/htunn/thousands-eye-gguf/resolve/main/thousands-eye-Q4_K_M.gguf) | ~1.5 GB | Ollama, llama.cpp, LM Studio | ```bash # Ollama ollama run htunnthuthutech/thousands-eye # llama.cpp ./llama-cli -m thousands-eye-Q4_K_M.gguf -p "[EthHack-Agent] ..." ``` ### Safetensors (Full HF model — Transformers / vLLM) Available at [`htunn/thousands-eye-hf`](https://huggingface.co/htunn/thousands-eye-hf). ```python from transformers import AutoTokenizer, AutoModelForCausalLM model_id = "htunn/thousands-eye-hf" tokenizer = AutoTokenizer.from_pretrained(model_id) model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto") messages = [{"role": "user", "content": "[EthHack-Agent] Enumerate Active Directory users via LDAP on 10.0.0.1 (authorized engagement)"}] inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device) outputs = model.generate(inputs, max_new_tokens=512) print(tokenizer.decode(outputs[0], skip_special_tokens=True)) ``` ## Overview | | | |---|---| | **Base model** | `google/gemma-4-E2B-it` | | **Training framework** | `mlx_lm.lora` (Apple Silicon MLX) | | **Iterations** | 600 | | **Batch size** | 1 | | **Learning rate** | 1e-4 | | **LoRA layers** | 16 | | **Quantization** | Q4_K_M (llama.cpp) | | **Training data** | 83 examples / 15 validation | | **Registry** | Ollama `htunnthuthutech/thousands-eye` | ## Attack Surfaces Covered | Surface | Techniques | |---|---| | Web Application | SQLi, XSS, CSRF, SSRF, LFI, XXE, SSTI | | REST / GraphQL API | JWT bypass, IDOR, mass assignment, batching | | Active Directory | Kerberoasting, AS-REP, DCSync, PTH, Golden/Silver ticket, BloodHound | | ADFS | Token manipulation, Golden SAML, WS-Trust spray, device code phishing | | Authentication | Brute force, password spray (O365/Azure), MFA bypass, session hijacking | | Authorization | Horizontal/vertical escalation, IDOR | | OAuth2 / OIDC | PKCE downgrade, redirect_uri manipulation, implicit flow, state bypass | | SAML | Signature wrapping, assertion replay, XXE, comment injection | | Kubernetes | Anonymous API, Kubelet 10255, etcd, service account, container escape, IMDS, RBAC, CVE-2022-0492 | | LLM / AI APIs | Prompt injection, RAG poisoning, system prompt leakage, tool-call abuse, token flooding | | A2A Agents | Agent Card enum, unauthenticated task exec, SSRF webhook, secret scanning | | WAF Bypass | Cloudflare, ModSecurity, Akamai, Imperva | | Kali Orchestration | nmap, nikto, gobuster, sqlmap, hydra, sslscan, full AI pentest chain | ## Output Format Every response is a JSON object: ```json { "action": "kerberoast", "target": "10.0.0.1", "requires_authorization": true, "techniques": ["SPN enumeration", "TGS request", "offline cracking"], "tools": ["impacket", "hashcat"], "commands": ["GetUserSPNs.py domain/user:pass@dc -request"], "steps": ["..."], "notes": "Requires domain user credentials" } ``` ## Training Data Format ```jsonl {"text": "user\n[EthHack-Agent] SCENARIO\nmodel\n{\"action\":\"...\",\"requires_authorization\":true,...}"} ``` Dataset available at [`htunn/thousands-eye-dataset`](https://huggingface.co/datasets/htunn/thousands-eye-dataset). ## Self-hosted Build ```bash git clone https://github.com/Htunn/Thousands-Eye cd Thousands-Eye make setup make train # MLX LoRA on Apple Silicon, ~30–60 min make quantize # fuse + GGUF Q4_K_M make upload # push to HF Hub make ollama # local Ollama model ``` ### MLX Compatibility Note (Gemma 4 E2B + mlx-lm ≤ 0.31.3) `google/gemma-4-E2B-it` uses a hybrid attention architecture where layers 15–34 are **KV-sharing** — they reuse key/value projections from preceding layers rather than maintaining independent ones. mlx-lm's Gemma 4 model definition omits `k_proj`, `v_proj`, and `k_norm` for those 20 layers, causing a strict weight-loading error at training time: ``` ValueError: Received 60 parameters not in model: language_model.model.layers.15.self_attn.k_norm.weight, language_model.model.layers.15.self_attn.k_proj.weight, ... ``` This repo patches `mlx_lm/utils.py` to catch that error and retry with `strict=False`, silently skipping the 60 weights that have no slot in the architecture definition. The KV-sharing layers then train with shared projections as designed — no impact on fine-tune quality. ```python # mlx_lm/utils.py — patch applied automatically by make setup try: model.load_weights(list(weights.items()), strict=strict) except ValueError as _e: if strict and "parameters not in model" in str(_e): model.load_weights(list(weights.items()), strict=False) else: raise ``` ## Integration with invoke-sunstrike ```bash export OLLAMA_MODEL=thousands-eye # or at the invoke-sunstrike REPL: model ollama thousands-eye ``` ## Ethics This model is designed exclusively for **authorized penetration testing and security research**. Every training example enforces `"requires_authorization": true`. Misuse against systems without explicit written authorization is illegal and unethical. ## License [Gemma Terms of Use](https://ai.google.dev/gemma/terms) — derived from `google/gemma-4-E2B-it`.