Skip to content

Instantly share code, notes, and snippets.

@JJ
Created November 28, 2022 07:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JJ/b16d4a197cbea3b0ead38f4abfe105b6 to your computer and use it in GitHub Desktop.
Save JJ/b16d4a197cbea3b0ead38f4abfe105b6 to your computer and use it in GitHub Desktop.
Parsing malware files with Raku
sub MAIN (Str :$fi = '', Str :$fo = '') {
# some genes in the binary
my token gen1 {'InterfaceSpeedTester9Calc'}
my token gen2 {'ScheduledCtrl9UpdateJobERK'}
my token gen3 {'ScanHardwareInfoPSt'}
my regex sparkling2 {
[
<gen1>|<gen2>|^<gen3>$
]
}
my $c = 1;
for "$fo/$fi".IO.lines -> $line {
if $line ~~ &sparkling2 {say "Sparkling Goblin complex regex found: "; say $line; say "in line $c"; say "in file $fi"; say " "; }
$c++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment