Skip to content

Commit 6871ff0

Browse files
committed
Add post module sample
1 parent c9e26ad commit 6871ff0

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# web site for more information on licensing and terms of use.
5+
# http://metasploit.com/
6+
##
7+
8+
require 'msf/core'
9+
require 'msf/core/post/common'
10+
11+
###
12+
#
13+
# This post module sample shows how we can execute a command on the compromised machine
14+
#
15+
###
16+
class Metasploit4 < Msf::Post
17+
18+
include Msf::Post::Common
19+
20+
def initialize(info={})
21+
super(update_info(info,
22+
'Name' => 'Sample Post Module',
23+
'Description' => %q{Sample Post Module},
24+
'License' => MSF_LICENSE,
25+
'Author' => [ 'sinn3r'],
26+
'Platform' => [ 'win'],
27+
'SessionTypes' => [ "shell", "meterpreter" ]
28+
))
29+
end
30+
31+
#
32+
# This post module runs a ipconfig command and returns the output
33+
#
34+
def run
35+
print_status("Executing ipconfig on remote machine")
36+
o = cmd_exec("ipconfig")
37+
print_line(o)
38+
end
39+
40+
end

0 commit comments

Comments
 (0)