Skip to content

Commit

Permalink
remove lib for time measuring
Browse files Browse the repository at this point in the history
  • Loading branch information
htrgouvea committed May 12, 2021
1 parent 4ae3a77 commit a443403
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions nozaki.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Functions::Helper;
use Functions::Parser;
use Engine::Fuzzer;
use Time::HiRes qw(gettimeofday tv_interval);
use Getopt::Long qw(:config no_ignore_case pass_through);

my $wordlist_queue = Thread::Queue -> new();
Expand Down Expand Up @@ -49,7 +48,7 @@ sub fill_queue {
for (1 .. $n) {
return unless (@{$list} > 0);

if (eof($list->[0])) {
if (eof($list -> [0])) {
close shift @{$list};
(@{$list} > 0) || $wordlist_queue->end();
next
Expand Down Expand Up @@ -94,52 +93,45 @@ sub run_fuzzer {
} glob($wordlist);

fill_queue(\@current, 10 * $tasks);

my $start_at = [gettimeofday];

async {
fuzzer_thread($target, $methods, $agent, \%headers, $accept, $timeout, $return, $payload, $json, $delay, $exclude, $skipssl);
} for 1 .. $tasks;

while (threads->list(threads::running) > 0) {
while (threads -> list(threads::running) > 0) {
fill_queue(\@current, $tasks);
}

map { $_ -> join() } threads -> list(threads::all);

my $elapsed = tv_interval($start_at);

return 0;
}

sub main {
my ($workflow, $target, $help);
my ($workflow, $target);

Getopt::Long::GetOptions (
"workflow=s" => \$workflow,
"W|workflow=s" => \$workflow,
"u|url=s" => \$target,
"h|help" => \$help
);

return Functions::Helper -> new() if $help;

die "No target specified" unless $target;

if ($workflow) {
my $rules = Functions::Parser -> new($workflow);

for my $rule (@$rules) {
delete $rule->{description};
delete $rule -> {description};
my $args = [ map { "--$_" . ($rule->{$_} ? "=$rule->{$_}" : "") } keys %{$rule} ];
run_fuzzer($args, $target);
}

return 1;
}

else {
run_fuzzer(\@ARGV, $target);
if ($target) {
return run_fuzzer(\@ARGV, $target);
}

return 0;
return Functions::Helper -> new();
}

exit main();

0 comments on commit a443403

Please sign in to comment.