Questions about this topic? Sign up to ask in the talk tab.
Kolkata
From NetSec
Revision as of 19:37, 27 April 2012 by User (Talk | contribs) (Created page with "<syntaxhighlight lang="perl"> #!/usr/bin/perl # @url http://www.blackhatacademy.org/ # @author fxm+hats use strict; use LWP::Simple; use Getopt::Long; use YAML::XS; use LWP::Us...")
<syntaxhighlight lang="perl">
- !/usr/bin/perl
- @url http://www.blackhatacademy.org/
- @author fxm+hats
use strict; use LWP::Simple; use Getopt::Long; use YAML::XS; use LWP::UserAgent; use HTTP::Request; use HTTP::Response; use Digest::MD5 qw(md5_hex); use Data::Dumper;
my $opts; my %tree; my $sigtree = \%tree; my $sigdir = '/home/fxm/Desktop/Code/appscan/sigs';
my $custom = undef; my $debug = 0;
&check_args; &load_sigs;
my $digestobj = Digest::MD5->new; my $ua = new LWP::UserAgent;
- my $content;
- $ua->agent("Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/534.10 (KHTML, like Gecko) Chrome/8.0.552.237 Safari/534.10");
- my $req = new HTTP::Request GET => "$fullurl";
- my $res = $ua->request($req);
- if ($res->is_error) {
- print $res->status_line;
- }
- if ($res->is_success) {
- $content = $res->content;
- my $md5 = $digestobj->add("$content");
- my $final = $md5->hexdigest;
- print "MD5:\t\t$final\n";
- print "Version:\t$ver_hash{$final}\n\n";
- }
sub load_sigs {
if (defined $custom && -f "$sigdir/$custom.yml") { print "Loaded custom profile $custom\n"; $sigtree->{$custom} = YAML::XS::LoadFile("$sigdir/$custom.yml"); } else { opendir(SIGDIR, "$sigdir") or die $!; my @fingerprints = grep { /\.yml$/ && -f "$sigdir/$_" } readdir(SIGDIR); foreach my $yf (@fingerprints) { my $yfname = $yf; $yfname =~ s/\.yml//; $sigtree->{$yfname} = YAML::XS::LoadFile("$sigdir/$yf"); printf "Loaded '%s' (%s)\n", $sigtree->{$yfname}->{'app_name'}, $yf; } } closedir(SIGDIR);
}
sub check_args {
$opts = GetOptions( "custom=s" => \$custom, "debug" => \$debug );
}
print Dumper $sigtree; </syntaxhighlight>