code style
This commit is contained in:
parent
00b16eee1f
commit
de88908493
|
@ -46,8 +46,13 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
end
|
||||
|
||||
def verbose; datastore['VERBOSE']; end
|
||||
def uri; datastore['URI'].to_s; end
|
||||
def verbose
|
||||
datastore['VERBOSE']
|
||||
end
|
||||
|
||||
def uri
|
||||
datastore['URI'].to_s
|
||||
end
|
||||
|
||||
def timeout
|
||||
(datastore['TIMEOUT'] || 60).to_i
|
||||
|
|
|
@ -105,8 +105,13 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
end
|
||||
|
||||
# Helper methods
|
||||
def user; datastore['USERNAME']; end
|
||||
def pass; datastore['PASSWORD'] || ''; end
|
||||
def user
|
||||
datastore['USERNAME']
|
||||
end
|
||||
|
||||
def pass
|
||||
datastore['PASSWORD'] || ''
|
||||
end
|
||||
|
||||
def send_auth_request_cgi(opts={}, timeout=nil)
|
||||
timeout ||= datastore['TIMEOUT']
|
||||
|
|
|
@ -115,7 +115,9 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
end
|
||||
|
||||
# @return [Boolean] user wants the persistence to be restarted constantly if it exits
|
||||
def keepalive?; datastore['KEEPALIVE']; end
|
||||
def keepalive?
|
||||
datastore['KEEPALIVE']
|
||||
end
|
||||
|
||||
# useful if you want to remove the persistence.
|
||||
# prints out a list of paths to remove and commands to run.
|
||||
|
@ -133,10 +135,14 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
end
|
||||
|
||||
# @return [Boolean] user wants to launch the LaunchAgent immediately
|
||||
def run_now?; datastore['RUN_NOW']; end
|
||||
def run_now?
|
||||
datastore['RUN_NOW']
|
||||
end
|
||||
|
||||
# @return [String] username of the session
|
||||
def user; @user ||= cmd_exec('whoami').strip; end
|
||||
def user
|
||||
@user ||= cmd_exec('whoami').strip
|
||||
end
|
||||
|
||||
# drops the file to disk, then makes it executable
|
||||
# @param [String] exe the executable to drop
|
||||
|
|
|
@ -227,8 +227,14 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
end
|
||||
|
||||
# helper methods for accessing datastore
|
||||
def using_native_target?; target.name =~ /native/i; end
|
||||
def using_cmd_target?; target.name =~ /cmd/i; end
|
||||
def using_native_target?
|
||||
target.name =~ /native/i
|
||||
end
|
||||
|
||||
def using_cmd_target?
|
||||
target.name =~ /cmd/i
|
||||
end
|
||||
|
||||
def drop_path
|
||||
@_drop_path ||= datastore['TMP_FILE'].gsub('<random>') { Rex::Text.rand_text_alpha(10) }
|
||||
end
|
||||
|
@ -239,7 +245,10 @@ class Metasploit3 < Msf::Exploit::Local
|
|||
end
|
||||
|
||||
# helper methods for dealing with sudo's vn num
|
||||
def parse_vn(vn_str); vn_str.split(/[\.p]/).map(&:to_i); end
|
||||
def parse_vn(vn_str)
|
||||
vn_str.split(/[\.p]/).map(&:to_i)
|
||||
end
|
||||
|
||||
def vn_bt(vn, ranges) # e.g. ('1.7.1', [['1.7.0', '1.7.6p44']])
|
||||
vn_parts = parse_vn(vn)
|
||||
ranges.any? do |range|
|
||||
|
|
|
@ -78,7 +78,9 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
return Exploit::CheckCode::Safe
|
||||
end
|
||||
|
||||
def make_nops(num); "C" * num; end
|
||||
def make_nops(num)
|
||||
"C" * num
|
||||
end
|
||||
|
||||
def exploit
|
||||
connect_login
|
||||
|
|
|
@ -137,9 +137,17 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
private
|
||||
|
||||
def prev_error_log_path; datastore['ERROR_LOG']; end
|
||||
def ctl_path; @ctl_path ||= whereis("cupsctl"); end
|
||||
def strip_http_headers(http); http.gsub(/\A(^.*\r\n)*/, ''); end
|
||||
def prev_error_log_path
|
||||
datastore['ERROR_LOG']
|
||||
end
|
||||
|
||||
def ctl_path
|
||||
@ctl_path ||= whereis("cupsctl")
|
||||
end
|
||||
|
||||
def strip_http_headers(http)
|
||||
http.gsub(/\A(^.*\r\n)*/, '')
|
||||
end
|
||||
|
||||
def whereis(exe)
|
||||
line = cmd_exec("whereis #{exe}")
|
||||
|
|
|
@ -126,7 +126,9 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
|
||||
# @return [String] hostname
|
||||
def host; session.session_host; end
|
||||
def host
|
||||
session.session_host
|
||||
end
|
||||
|
||||
# @return [Bool] system version is 10.7
|
||||
def lion?
|
||||
|
|
|
@ -217,5 +217,7 @@ class Metasploit3 < Msf::Post
|
|||
end
|
||||
|
||||
# path to osascript on the remote system
|
||||
def osascript_path; datastore['OSASCRIPT_PATH'].shellescape; end
|
||||
def osascript_path
|
||||
datastore['OSASCRIPT_PATH'].shellescape
|
||||
end
|
||||
end
|
||||
|
|
|
@ -123,6 +123,11 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
private
|
||||
|
||||
def poll_timeout; POLL_TIMEOUT; end
|
||||
def fail_with(msg); raise msg; end
|
||||
def poll_timeout
|
||||
POLL_TIMEOUT
|
||||
end
|
||||
|
||||
def fail_with(msg)
|
||||
raise msg
|
||||
end
|
||||
end
|
||||
|
|
|
@ -144,6 +144,11 @@ class Metasploit3 < Msf::Post
|
|||
|
||||
private
|
||||
|
||||
def poll_timeout; POLL_TIMEOUT; end
|
||||
def fail_with(msg); raise msg; end
|
||||
def poll_timeout
|
||||
POLL_TIMEOUT
|
||||
end
|
||||
|
||||
def fail_with(msg)
|
||||
raise msg
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue