commit
f5e162e2e2
4 changed files with 91 additions and 0 deletions
@ -0,0 +1,2 @@ |
||||
hack |
||||
hacked |
@ -0,0 +1,73 @@ |
||||
#!/usr/bin/perl -w |
||||
use strict; |
||||
use XML::Simple; |
||||
use Data::Dumper; |
||||
|
||||
# Date |
||||
use POSIX qw(strftime); |
||||
my $date = strftime "%d/%m/%Y %H:%M", localtime; |
||||
|
||||
# Functions |
||||
sub uniq { |
||||
my %seen; |
||||
grep !$seen{$_}++, @_; |
||||
} |
||||
|
||||
print "\033[33m \nDEFACEMENT CHECK [" . $date . "]\n\nSearching for suspects ...\n"; |
||||
print "FOUND \t\t=> URLs\n"; |
||||
|
||||
# Import config |
||||
my @search; |
||||
my $keywords = 'conf/keywords.cfg'; |
||||
if (open(my $f, '<:encoding(UTF-8)', $keywords)) { |
||||
while (my $row = <$f>) { |
||||
chomp $row; |
||||
push @search, $row; |
||||
} |
||||
} else { |
||||
warn "Could not open file '$keywords' $!"; |
||||
} |
||||
|
||||
# Open XML files |
||||
my @files = glob( "sitemap/*.xml" ); |
||||
my $file; |
||||
|
||||
foreach $file (@files) |
||||
{ |
||||
my $xml = new XML::Simple (KeyAttr=>[]); |
||||
my $url; |
||||
my $data = $xml->XMLin($file); |
||||
|
||||
foreach $url (@{$data->{url}}) |
||||
{ |
||||
my $survey = $url->{loc}; |
||||
# Create a user agent object |
||||
use LWP::UserAgent; |
||||
my $ua = LWP::UserAgent->new; |
||||
# Create a request |
||||
my $req = HTTP::Request->new(GET => $survey); |
||||
# Pass request to the user agent and get a response back |
||||
my $res = $ua->request($req); |
||||
my $site = $res->content; |
||||
|
||||
my @found; |
||||
my $total_found = 0; |
||||
|
||||
foreach my $s (@search) { |
||||
foreach (grep(/$s/i, split(/\n/, $site))) { |
||||
push @found, $_; |
||||
} |
||||
} |
||||
|
||||
# Results |
||||
foreach (uniq(@found)) { |
||||
$total_found++; |
||||
# print $total_found . " : " . $_ . "\n"; # VERBOSE MODE |
||||
} |
||||
if ($total_found == 0) { |
||||
print "\033[32m" . $total_found . "\t\t=> " . $survey. "\n"; |
||||
} else { |
||||
print "\033[31m" . $total_found . "\t\t=> " . $survey. "\n"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,4 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> |
||||
<url><loc>http://example.com/</loc></url> |
||||
<url><loc>http://example.com/test</loc></url> |
||||
</urlset> |
@ -0,0 +1,12 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"> |
||||
<url><loc>http://www.firewall-services.com/</loc></url> |
||||
<url><loc>http://www.firewall-services.com/clubs-entreprises.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/contact.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/espace-presse.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/formations.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/index.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/nos-competences.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/passeport.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/plan.html</loc></url> |
||||
<url><loc>http://www.firewall-services.com/prolibre.html</loc></url> |
||||
</urlset> |
Loading…
Reference in new issue