Skip to content

Instantly share code, notes, and snippets.

@macostag
Last active April 15, 2018 19:43
Show Gist options
  • Select an option

  • Save macostag/2cb852c0d3d32510b246787355f6b64b to your computer and use it in GitHub Desktop.

Select an option

Save macostag/2cb852c0d3d32510b246787355f6b64b to your computer and use it in GitHub Desktop.
# Start postgresql services
> service postgresql start
# Initialize the database
> msfdb init
# Delete and reinitialize the database
> msfdb reinit
# Delete database and stop using it
> msfdb delete
# Start the database
> msfdb start
# Stop the database
> msfdb stop
# Confirm that Metasploit is successfully connected to the database.
msf> db_status
# Display the currently selected workspaces
msf> workspace
# Change the current workspace to Lab-Test
msf> workspace Lab-Test
# Create a workspace
msf> workspace -a Lab-Test
# Delete a workspace
msf> workspace -d Lab-Test
# Import nmap scan
msf> db_import scan-lab-report.xml
# Export data outside the Metasploit environment
msf> db_export -f xml /root/Exported.xml
# Confirm the presence of data in our database
msf> hots -h
# Another way to search the database
msf> services -h
# Manage found and used credentials for targets in our database
msf> creds -h
# In the event of a successful hash dump, this information will be stored in our database
msf> loot -h
# Show the framework and console library version numbers
msf> version
# Set a value in the global datastore
msf> setg
# Timestamp on the screen to all output associated with delivering exploits to targets
msf> set TimestampOutput true
# Logging all information typed into all interactive sessions on exploited target systems
msf> set SessionLogging true
# Logging everything typed into msfconsole
msf> set ConsoleLogging true
# Log location
> ls -la /root/.msf4/logs
# Detailed debugging information
msf> set LogLevel <0-3>
> cat /root/.msf4/logs/framework.log
# Saved configuration to: /root/.msf4/config
msf> save
# Run the commands stored in the supplied files:
msf> resource [FILE].rc
> msfconsole -r [FILE].rc
# Communicate with a host, similar to interacting via netcat, taking advantage of any configured session pivoting:
msf> connect [options] <host> <port>
# Starting IRB shell:
msf> irb
# Upgrade a shell to a meterpreter session on many platforms
msf> sessions -u
# Run a script or module on the session given with -i
msf> sessions -s checkvm -i 1,3-5
# Route traffic destined to a given subnet through a supplied session.
msf> route add
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment