Skip to content

Instantly share code, notes, and snippets.

@AlexDaniel
Created June 5, 2016 21:05
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 AlexDaniel/35252aa967456a31c28aafaf1c612320 to your computer and use it in GitHub Desktop.
Save AlexDaniel/35252aa967456a31c28aafaf1c612320 to your computer and use it in GitHub Desktop.
perl6 segfault
#!/usr/bin/env perl6
use JSON::Tiny;
# Some data to work with
mkdir ‘data-for-segfault’;
my $script = 「sleep 0.1s」;
spurt ‘data-for-segfault/a’, $script;
spurt ‘data-for-segfault/b’, $script;
chmod 0o755, "data-for-segfault/a", "exploitd/b";
spurt ‘foo.json’, 「{"targets": ["a","b","c","d","e"]}」;
# Code
my $config = from-json slurp ‘foo.json’;
my $targets = $config<targets>;
my $exploits = ‘data-for-segfault’.IO.dir.map: {.path};
say "targets are $targets[]";
for $targets.race(batch => 2, degree => 2) -> $target {
for $exploits -> $exploit {
shell "$exploit $target";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment