Skip to content

Commit 9b4c2fe

Browse files
Land rapid7#19493, Improve documentation for testing the post exploitation API against opened sessions
2 parents f91c95b + 6fcdd57 commit 9b4c2fe

File tree

1 file changed

+71
-2
lines changed

1 file changed

+71
-2
lines changed

docs/metasploit-framework.wiki/Loading-Test-Modules.md

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
By default test modules in Metasploit are not loaded when Metasploit starts. To load them, run `loadpath test/modules` after which you should see output similar to the following:
1+
Metasploit offers inbuilt test modules which can be used for verifying Metasploit's post-exploitations work with currently opened sessions.
2+
These modules are intended to be used by developers to test updates to ensure they don't break core functionality
3+
and should not be used during normal operations. These modules also as part of the automated test suite within pull requests.
4+
5+
By default the test modules in Metasploit are not loaded when Metasploit starts. To load them, run `loadpath test/modules` after which you should see output similar to the following:
26

37
```msf
48
msf6 > loadpath test/modules
@@ -9,4 +13,69 @@ Loaded 38 modules:
913
msf6 >
1014
```
1115

12-
These modules are intended to be used by developers to test updates to ensure they don't break core functionality and should not be used during normal operations. If you do happen to break the functionality of one of these modules, it is highly recommended that you look at what you are proposing within your PR and ensure that you are not accidentally breaking unintended functionality. If you do need to break certain functionality in order to add a given feature, and there is no other way to go around this, be sure to let one of the Metasploit team members know this so that appropriate updates can be made to these scripts and any associated code that may be updated by your change (assuming it is has been signed off and approved by the team).
16+
The modules can be searched for:
17+
18+
```msf
19+
msf6 > search post/test
20+
21+
Matching Modules
22+
================
23+
24+
# Name Disclosure Date Rank Check Description
25+
- ---- --------------- ---- ----- -----------
26+
0 post/test/cmd_exec . normal No Meterpreter cmd_exec test
27+
1 post/test/railgun . normal No Railgun API Tests
28+
2 post/test/extapi . normal No Test Meterpreter ExtAPI Stuff
29+
3 post/test/get_env . normal No Test Post::Common Get Envs
30+
4 post/test/services . normal No Test Post::Windows::Services
31+
5 post/test/all . normal No Test all applicable post modules
32+
... etc etc ...
33+
```
34+
35+
Example of running the test module against an opened session:
36+
37+
```
38+
msf6 > use post/test/cmd_exec
39+
msf6 post(test/cmd_exec) > run session=-1
40+
...
41+
[*] Testing complete in 2.04 seconds
42+
[*] Passed: 6; Failed: 0; Skipped: 0
43+
[*] Post module execution completed
44+
```
45+
46+
The `post/test/all` module is an aggregate module that can be used to quickly run all of the applicable test modules
47+
against a currently open session:
48+
49+
```msf
50+
msf6 post(test/all) > run session=-1
51+
52+
[*] Applicable modules:
53+
Valid modules for x86/windows session 1
54+
=======================================
55+
56+
# Name is_session_platform is_session_type
57+
- ---- ------------------- ---------------
58+
0 test/railgun_reverse_lookups Yes Yes
59+
1 test/search Yes Yes
60+
2 test/services Yes Yes
61+
3 test/meterpreter Yes Yes
62+
4 test/cmd_exec Yes Yes
63+
5 test/extapi Yes Yes
64+
6 test/file Yes Yes
65+
7 test/get_env Yes Yes
66+
8 test/railgun Yes Yes
67+
9 test/registry Yes Yes
68+
10 test/unix No Yes
69+
11 test/mssql Yes No
70+
12 test/mysql Yes No
71+
13 test/postgres Yes No
72+
14 test/smb Yes No
73+
74+
[*] Running test/cmd_exec against session -1
75+
[*] --------------------------------------------------------------------------------
76+
... etc etc ...
77+
78+
[*] Running test/extapi against session -1
79+
[*] --------------------------------------------------------------------------------
80+
... etc etc ...
81+
```

0 commit comments

Comments
 (0)