-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathMSFExploits.pl
executable file
·53 lines (44 loc) · 1.36 KB
/
MSFExploits.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/perl
use strict;
use warnings;
use lib qw(MSFExploits);
use 5.10.0;
no warnings 'experimental';
use Term::ANSIColor;
use Data::Dump::Color qw(dump);
use Try::Tiny;
use LWP::UserAgent;
use JSON::XS;
my @files = ();
my %packages = ();
my $script_directory = $ENV{PWD};
print $script_directory ;
@files = `find MSFExploits -type f -name \\*\\.pm | grep -v "Exploit\\.pm\\|Module\\.pm"`;
my $r = LWP::UserAgent->new();
foreach my $file (@files) {
chomp $file;
my $package = '';
($package) = $file;
$package =~ s/(MSFExploits\/|\.pm)//gi;
$package =~ s/\//::/gi;
eval "use $package;";
if($@) {
#print color("bold yellow"), "Error While Loading Package : $package\n\t\t[File] => $file\n\t\t[Message] => " . dump($@) . "\n\n";
} else {
$packages{$package}->{FILE} = $file;
print "$package\n";
my $obj = $package->new();
print dump($obj);
my $json_file = $file;
$json_file =~ s/\.pm/\.json/gi;
open FILE, ">", $json_file or die("$file couldn't be open : " . $@);
print FILE JSON::XS->new->utf8->pretty->convert_blessed->encode($obj);
close FILE;
}
}
foreach my $package (sort keys %packages) {
my $file = $packages{$package}->{FILE};
# print color("bold green"), "\n[+] Good : $file ($package)\n";
my $object = $package->new() if($package->can("new"));
# print dump($object);
}