Skip to content

Commit 70191bf

Browse files
committed
Land rapid7#5627, more cmd_exec fixes
2 parents a30144f + ae17269 commit 70191bf

File tree

5 files changed

+3
-33
lines changed

5 files changed

+3
-33
lines changed

modules/post/linux/gather/enum_configs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_host
5252
when /meterpreter/
5353
host = sysinfo["Computer"]
5454
when /shell/
55-
host = session.shell_command_token("hostname").chomp
55+
host = cmd_exec("hostname").chomp
5656
end
5757

5858
return host

modules/post/linux/gather/enum_network.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def get_host
8989
when /meterpreter/
9090
host = sysinfo["Computer"]
9191
when /shell/
92-
host = session.shell_command_token("hostname").chomp
92+
host = cmd_exec("hostname").chomp
9393
end
9494

9595
print_status("Running module against #{host}")

modules/post/linux/gather/enum_protections.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def get_host
5151
when /meterpreter/
5252
host = sysinfo["Computer"]
5353
when /shell/
54-
host = session.shell_command_token("hostname").chomp
54+
host = cmd_exec("hostname").chomp
5555
end
5656

5757
return host

modules/post/linux/gather/enum_system.rb

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,31 +79,12 @@ def save(msg, data, ctype = 'text/plain')
7979
print_status("#{msg} stored in #{loot}")
8080
end
8181

82-
def get_host
83-
case session.type
84-
when /meterpreter/
85-
host = sysinfo["Computer"]
86-
when /shell/
87-
host = session.shell_command_token("hostname").chomp
88-
end
89-
90-
print_status("Running module against #{host}")
91-
92-
host
93-
end
94-
9582
def execute(cmd)
9683
vprint_status("Execute: #{cmd}")
9784
output = cmd_exec(cmd)
9885
output
9986
end
10087

101-
def cat_file(filename)
102-
vprint_status("Download: #{filename}")
103-
output = read_file(filename)
104-
output
105-
end
106-
10788
def get_packages(distro)
10889
packages_installed = ""
10990
case distro

modules/post/linux/gather/enum_users_history.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,6 @@ def save(msg, data, ctype = 'text/plain')
6666
print_status("#{msg} stored in #{loot.to_s}")
6767
end
6868

69-
def get_host
70-
case session.type
71-
when /meterpreter/
72-
host = sysinfo['Computer']
73-
when /shell/
74-
host = session.shell_command_token('hostname').chomp
75-
end
76-
print_status("Running module against #{host}")
77-
host
78-
end
79-
8069
def execute(cmd)
8170
vprint_status("Execute: #{cmd}")
8271
output = cmd_exec(cmd)

0 commit comments

Comments
 (0)