code style

This commit is contained in:
Christian Mehlmauer 2014-12-11 23:30:20 +01:00
parent 00b16eee1f
commit de88908493
No known key found for this signature in database
GPG Key ID: BCFF4FA966BC32C7
10 changed files with 69 additions and 20 deletions

View File

@ -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

View File

@ -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']

View File

@ -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

View File

@ -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|

View File

@ -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

View File

@ -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}")

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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