Find Wildcard Hosts using DBI query

#!/usr/bin/perl
use DBI;
use <div><a href="http://cialisonline-bestrxpharmacy.com">cheap viagra cialis levitra</a> # <a href="http://viagraonline-rxpharmacybest.com">viagra sales rep</a> # <a href="http://cialisonline-bestrxpharmacy.com">once a day cialis side effects</a> # <a href="http://genericcialis-onlinerxbest.com" rel="nofollow">cialis and similar drugs</a></div>  strict;
my $username = "dbuser";
my $password = "dbpassword";
my $dsn = "dbi:mysql:mysql:192.168.1.10";
my $dbh = DBI-&gt;connect($dsn,$username,$password)
or die "Cannot connect to database: $DBI::errstr";
my $sth = $dbh-&gt;prepare("SELECT host FROM mysql.user");
$sth-&gt;execute() or die "Cannot execute sth: $DBI::errstr";
my @mysqlhosts;
while (my $hostname = $sth-&gt;fetchrow_array()) {
push (@mysqlhosts,$hostname);
}
while () {
if ($_ =~ /%/) {
print "Wildcard host found: $_\n";
}
}
$dbh-&gt;disconnect();

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.