NullSec YARA

February 27, 2026 ยท View on GitHub

Clojure pattern matching engine demonstrating immutable data and functional programming.

Features

  • Immutable Data - Thread-safe by design
  • Lazy Sequences - Memory-efficient file scanning
  • Persistent Collections - Efficient structural sharing
  • REPL Development - Interactive rule testing
  • Pattern Matching - Hex, ASCII, and regex patterns

Built-in Rules

IDNameSeverityDescription
MAL001Suspicious PEHighPE file indicators
MAL002Packed ExecutableMediumUPX packing
MAL003Shellcode PatternCriticalCommon shellcode
STR001Suspicious URLsMediumC2/malicious URLs
STR002Crypto WalletMediumWallet addresses
CMD001Suspicious CommandsHighMalicious commands
CRED001Hardcoded CredsHighPasswords/API keys
NET001Network IndicatorsLowNetwork functions

Build

# With Leiningen
lein uberjar

# Run
java -jar target/uberjar/nullsec-yara-1.0.0-standalone.jar

# REPL
lein repl

Usage

# Scan file
java -jar yara.jar suspicious.exe

# Show matched strings
java -jar yara.jar -s malware.bin

# JSON output
java -jar yara.jar -j sample.dll

# Custom rules
java -jar yara.jar -r custom.yar target.exe

REPL Usage

; Load namespace
(require '[yara.core :as yara])

; Scan file
(yara/scan-data (yara/read-file-bytes "sample.exe") yara/builtin-rules)

; Custom rule
(def my-rule (yara/->Rule "TEST" "Test Rule" "Custom" :high
               [{:id "$test" :type :ascii :value "suspicious"}]
               "all of them"))

Pattern Types

  • :hex - Hexadecimal byte patterns
  • :ascii - ASCII string search
  • :regex - Regular expression patterns

Author

bad-antics | Twitter

License

MIT