26 lines
594 B
Perl
26 lines
594 B
Perl
#!/usr/bin/perl
|
|
|
|
use DBI;
|
|
use strict;
|
|
|
|
my $username = "dbuser";
|
|
my $password = "dbpassword";
|
|
my $dsn = "dbi:mysql:mysql:192.168.1.10";
|
|
my $dbh = DBI->connect($dsn,$username,$password) or die "Cannot connect to database: $DBI::errstr";
|
|
|
|
my $sth = $dbh->prepare("SELECT host FROM mysql.user");
|
|
|
|
$sth->execute() or die "Cannot execute sth: $DBI::errstr";
|
|
|
|
my @mysqlhosts;
|
|
while (my $hostname = $sth->fetchrow_array()) {
|
|
push (@mysqlhosts,$hostname);
|
|
}
|
|
|
|
while (<@mysqlhosts>) {
|
|
if ($_ =~ /%/) {
|
|
print "Wildcard host found: $_\n";
|
|
}
|
|
}
|
|
$dbh->disconnect();
|