Created
November 28, 2022 07:30
-
-
Save JJ/b16d4a197cbea3b0ead38f4abfe105b6 to your computer and use it in GitHub Desktop.
Parsing malware files with Raku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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