Advertisement
Guest User

Untitled

a guest
Aug 6th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use DBI;
  4. use warnings;
  5. use Data::Dumper;
  6.  
  7.  
  8.  
  9. $host = "localhost";
  10. $user = "root";
  11. $pass = "potato3";
  12. $database = "faz";
  13. $db = "faz";
  14. $query_tables = "show tables";
  15. $dbh = DBI->connect("DBI:mysql:$db:$host", $user, $pass);
  16.  
  17. $sqlQuery = $dbh->prepare($query_tables) or die "Can't prepare $query: $dbh->errstr\n";
  18.  
  19. $rv = $sqlQuery->execute or die "can't execute the query: $sqlQuery->errstr";
  20.  
  21. while (@row= $sqlQuery->fetchrow_array()) {
  22.  
  23. my $tables = $row[0];
  24. print "$tables\n";
  25.  
  26. $myquery = $dbh->prepare("SELECT * FROM `$tables`") or die "Can't prepare $query: $dbh->errstr\n";
  27. $myquery->execute or die "can't execute the query: $sqlQuery->errstr";
  28.  
  29. while (@table_data = $myquery->fetchrow_array) {
  30.  
  31. print Dumper(@table_data);
  32.  
  33. ($id,$itime,$dtime,$cluster_id,$device_id,$log_id,$subtype,$type,$timestamp,$pri,$policyid,$serial,$attack_id,$severity,$carrier_ep,$profile,$sensor,$src,$dst,$src_port,$icmp_id,$dst_port,$icmp_type,$icmp_code,$src_int,$dst_int,$status,$proto,$service,$user,$group,$ref,$count,$incident_serialno,$msg,$vd,$custom,$identidx) = split ',', @table_data;
  34.  
  35. print "The Device ID is $device_id\n";
  36. }
  37. }
  38.  
  39.  
  40. Error I am getting is
  41.  
  42.  
  43. Use of uninitialized value $device_id in concatenation (.) or string at ./log.pl line 34.
  44. The Device ID is
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement