-
Notifications
You must be signed in to change notification settings - Fork 0
/
directory.pl
37 lines (24 loc) · 998 Bytes
/
directory.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
#
use Term::ANSIColor qw(:constants);
use Mojo::Base qw( -strict -signatures );
use Mojo::Promise;
use Mojo::UserAgent;
use Getopt::Long;
my $wordlist = '';
my $concurrency = 0;
GetOptions ( 'wordlist|w=s' => \$wordlist, 'concurrency|c=i' => \$concurrency );
$concurrency = 40 if $concurrency == 0;
open my $fh, '<', $wordlist or die "Failed to open file: $wordlist";
chomp( my @diccionario = <$fh> );
my @urlsdata = map {"http://ffuf.me/cd/basic/$_"} @diccionario;
my $ua = Mojo::UserAgent->new;
$ua->max_connections(50_000);
$ua->inactivity_timeout(40);
$ua->connect_timeout(5);
my $get_fast = Mojo::Promise->map( { concurrency => $concurrency }, sub { $ua->get_p($_) }, @urlsdata )
->then( sub { for (@_) { if ($_->[0]->res->code == 200) { #just result with code == 200
my $url = $_->[0]->result->to_string;
say $url;
} } } );
$get_fast->wait;