Advertisement
Condomenium

poopv1

Apr 1st, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.65 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. ##
  4. ## Tscan v2.0 by Daenerys Tygarian
  5. ## Last official update: 14/11/2011
  6. ##
  7.  
  8. ## Import statements
  9. use IO::Socket;
  10. use Term::ANSIColor;
  11. use Shell;
  12. use Getopt::Long;
  13.  
  14. ## Options
  15. my $verbose = '';
  16. my $rangeGe = '';
  17.  
  18. GetOptions ('v' => \$verbose,
  19. 'ip=s' => \$rangeGe);
  20.  
  21. system(clear);
  22.  
  23. print "--\n";
  24. print "-- tScan v2.0 --\n";
  25. print "-- By Daenerys Tygarian ---\n";
  26. print "--\n";
  27. print "\n\n";
  28. print "use the '-v' option to see the IP-addresses";
  29. print "\n";
  30. print "that are being scanned. Use the '-ip' option to";
  31. print "\n";
  32. print "specify a network, like: 139.4.x.x";
  33. print "\n";
  34. print "These networks aren't checked, so enter a good one.";
  35. print "\n\n";
  36.  
  37. #### Range IP Generator ####
  38. sub rangeIPGenerator() {
  39. $range1 = 254;
  40. @octs = split(/\./,$rangeGe);
  41.  
  42. if (@octs[0] eq 'x') {
  43. @octs[0] = int(rand($range1)) + 1;
  44. }
  45. if (@octs[1] eq 'x') {
  46. @octs[1] = int(rand($range1)) + 1;
  47. }
  48. if (@octs[2] eq 'x') {
  49. @octs[2] = int(rand($range1)) + 1;
  50. }
  51. if (@octs[3] eq 'x') {
  52. @octs[3] = int(rand($range1)) + 1;
  53. }
  54.  
  55. $ip = "@octs[0].@octs[1].@octs[2].@octs[3]";
  56. return $ip;
  57.  
  58. }
  59.  
  60. #### Random IP Generator ####
  61. sub randomIPGenerator() {
  62. $range1 = 254;
  63.  
  64. $oct1 = int(rand($range1)) + 1;
  65. $oct2 = int(rand($range1)) + 1;
  66. $oct3 = int(rand($range1)) + 1;
  67. $oct4 = int(rand($range1)) + 1;
  68.  
  69. ## Scanning private IP's and the loopback isn't
  70. ## usefull, so we filter them out.
  71.  
  72. if ($oct1 == 127 || $oct1 == 172 || $oct1 == 192 || $oct1 == 10) {
  73. $ip = &randomIPGenerator();
  74. } else {
  75. ## Combine all the octals and create 1 valid IP address.
  76. $ip = "$oct1.$oct2.$oct3.$oct4";
  77. }
  78. return $ip;
  79. }
  80.  
  81. #### getTarget ####
  82. sub getTarget() {
  83. if ($rangeGe) {
  84. $target = rangeIPGenerator();
  85. } else {
  86. $target = randomIPGenerator();
  87. }
  88. return $target;
  89. }
  90.  
  91. #### Scanner ####
  92. sub scanner() {
  93. print "Scan started. Use -v to see some output.";
  94. print "\n\n";
  95.  
  96. while (1) {
  97. $target = getTarget();
  98. if ($verbose) {
  99. print " ---> SCANNING: $target <--- Hold steady. \n";
  100. }
  101. my $sock = new IO::Socket::INET(
  102. PeerAddr => $target,
  103. PeerPort => '23',
  104. Proto => 'tcp',
  105. Timeout => '3');
  106. if($sock) {
  107.  
  108. print colored ("\n ---> SUCCES: $target <--- Good job. \n\n", 'red');
  109. open(DAT, ">>Succes.txt") || die("Error writing to file.");
  110. print DAT "---> SUCCES: $target \n";
  111. close(DAT);
  112. }
  113. close($sock);
  114. }
  115. }
  116.  
  117. scanner();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement