elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Perl] ScanPort 0.5
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Perl] ScanPort 0.5  (Leído 1,530 veces)
BigBear


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] ScanPort 0.5
« en: 3 Diciembre 2011, 16:33 pm »

Simple scanner port en perl

Código
  1. #!usr/bin/perl
  2. #ScanPort 0.5
  3. #Examples
  4. #perl scan.pl -target localhost -option fast
  5. #perl scan.pl -target localhost -option full -parameters 1-100
  6.  
  7. use IO::Socket;
  8. use Getopt::Long;
  9.  
  10. GetOptions(
  11. "-target=s" => \$target,
  12. "-option=s" => \$opcion,
  13. "-parameters=s"=>\$parameters
  14. );
  15.  
  16. head();
  17. unless($target) {
  18. sintax();
  19. } else {
  20. if ($opcion eq "fast") {
  21. scanuno($target);
  22. }
  23. if ($opcion eq "full" and $parameters) {
  24. if($parameters=~/(.*)-(.*)/) {
  25. my $start = $1;
  26. my $end = $2;
  27. scandos($target,$start,$end);
  28. }
  29. }
  30. }
  31.  
  32. copyright();
  33.  
  34. sub scanuno {
  35.  
  36. my %ports = ("21"=>"ftp",
  37. "22"=>"ssh",
  38. "25"=>"smtp",
  39. "80"=>"http",
  40. "110"=>"pop3",
  41. "3306"=>"mysql"
  42. );
  43.  
  44. print "\n[+] Scanning $_[0]\n\n\n";
  45.  
  46. for my $port(keys %ports) {
  47.  
  48. if (new IO::Socket::INET(PeerAddr => $_[0],PeerPort => $port,Proto => "tcp",Timeout  => 0.5)) {
  49. print "[Port] : ".$port." [Service] : ".$ports{$port}."\n";
  50. }
  51. }
  52. print "\n\n[+] Scan Finish\n";
  53. }
  54.  
  55.  
  56. sub scandos {
  57.  
  58. print "\n[+] Scanning $_[0]\n\n\n";
  59.  
  60. for my $port($_[1]..$_[2]) {
  61.  
  62. if (new IO::Socket::INET(PeerAddr => $_[0],PeerPort => $port,Proto => "tcp",Timeout  => 0.5)) {
  63. print "[Port] : $port\n";
  64. }
  65. }
  66. print "\n\n[+] Scan Finish\n";
  67. }
  68.  
  69. sub head {
  70. print "-- == ScanPort 0.5 == --\n\n";
  71. }
  72.  
  73. sub copyright {
  74. print "\n\n(C) Doddy Hackman 2011\n\n";
  75. }
  76.  
  77. sub sintax {
  78. print "\n[+] sintax : $0 -target target -option fast/full -parameters 1-9999\n";
  79. }
  80.  
  81.  
  82. # The End ?
  83.  


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
perl
Scripting
nobo 0 3,197 Último mensaje 22 Febrero 2005, 07:49 am
por nobo
Perl
Scripting
zhynar_X 2 2,226 Último mensaje 12 Enero 2008, 04:36 am
por GroK
-=PERL=-
Scripting
D4RIO 1 5,714 Último mensaje 25 Febrero 2008, 17:27 pm
por D4RIO
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,836 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[C] ScanPort
Programación C/C++
BigBear 0 1,642 Último mensaje 8 Enero 2012, 18:42 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines