SHARE
TWEET

[Perl] SSH Scanner

1337ings Oct 16th, 2016 1,878 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/perl
  2. #########################################
  3. #
  4. #    /!\ C O M M A N D S /!\
  5. #
  6. #       perl scanner.pl
  7. #
  8. #  Check ssh.txt for ssh devices.
  9. #
  10. #
  11. #    /!\ C R E D I T S /!\
  12. #
  13. #   Chris Poole | @codingplanets
  14. #
  15. #  Not intended for illegal use.
  16. #########################################
  17. use IO::Socket;
  18. sub ipgen(){
  19. my $range1 = 223;
  20. my $range2 = 254;              
  21. $oct1 = int(rand($range1)) + 1;
  22. $oct2 = int(rand($range2)) + 1;
  23. $oct3 = int(rand($range2)) + 1;
  24. $oct4 = int(rand($range2)) + 1;
  25.  
  26. if($oct1 == 127 || $oct1 == 172 || $oct1 == 192 || $oct1 == 10){
  27. $ip = &ipgen();
  28. }else{
  29. $ip = "$oct1.$oct2.$oct3.$oct4";
  30. }
  31. return $ip;  
  32. }
  33. print " ____________________________________\n";
  34. print "|                                    |\n";
  35. print "|            R A N D O M             |\n";
  36. print "|                                    |\n";
  37. print "|        S S H  S C A N N E R        |\n";
  38. print "|____________________________________|\n";
  39. print " ____________________________________\n";
  40. print "|                                    |\n";
  41. print "|          C O D E D  B Y            |\n";
  42. print "|                                    |\n";
  43. print "|     Chris Poole | codingplanets    |\n";
  44. print "|____________________________________|\n";
  45.  
  46. while(1==1){
  47. $target = &ipgen();
  48. print "[!] Scanning -> $target \n";
  49. my $sock = new IO::Socket::INET (
  50.                  PeerAddr => $target,
  51.                  PeerPort => '22',
  52.                  Proto => 'tcp',
  53.                  Timeout => '3',
  54.                  );
  55. if($sock){
  56. print "[!] SUCCESS -> $target \n";
  57. open(DAT, ">>ssh.txt") || die("Cannot Open Output File");
  58. print DAT "SUCCESS: $target \n";
  59. close(DAT);
  60. }
  61. close($sock);
  62. }
RAW Paste Data
Top