diff --git a/scripts/meterpreter/domain_list_gen.rb b/scripts/meterpreter/domain_list_gen.rb index eec689bdd6..fb1c47c44f 100644 --- a/scripts/meterpreter/domain_list_gen.rb +++ b/scripts/meterpreter/domain_list_gen.rb @@ -24,16 +24,35 @@ def unsupported end #------------------------------------------------------------------------------- #Set General Variables used in the script -@client = client + +@client = client users = "" list = [] host = @client.sys.config.sysinfo['Computer'] -current_user = client.sys.config.getuid.scan(/\S*\\(.*)/) -domain = @client.fs.file.expand_path("%USERDOMAIN%") +current_user = @client.sys.config.getuid.scan(/\S*\\(.*)/) + +def reg_getvaldata(key,valname) + value = nil + begin + root_key, base_key = @client.sys.registry.splitkey(key) + open_key = @client.sys.registry.open_key(root_key, base_key, KEY_READ) + v = open_key.query_value(valname) + value = v.data + open_key.close + end + return value +end + +domain = reg_getvaldata("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon","DefaultDomainName") +if domain == "" + print_error("domain not found") +end + # Create Filename info to be appended to downloaded files filenameinfo = "_" + ::Time.now.strftime("%Y%m%d.%M%S") -platform = client.platform.scan(/(win32|win64|php)/) -unsupported if not platform + +unsupported if client.platfom !~ /win32|win64/i + # Create a directory for the logs logs = ::File.join(Msf::Config.log_directory, 'scripts','domain_admins') # Create the log directory @@ -78,3 +97,4 @@ if list.index(current_user.join.chomp.downcase) else print_error("Current session running as #{domain}\\#{current_user.join.chomp} is not running as Domain Admin") end + diff --git a/scripts/meterpreter/gettelnet.rb b/scripts/meterpreter/gettelnet.rb index 16544f63e2..6f88a4a0a8 100644 --- a/scripts/meterpreter/gettelnet.rb +++ b/scripts/meterpreter/gettelnet.rb @@ -149,8 +149,8 @@ enbl = nil end } -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform + +unsupported if client.platfom !~ /win32|win64/i if enbl message diff --git a/scripts/meterpreter/prefetchtool.rb b/scripts/meterpreter/prefetchtool.rb index 331973a289..f86e49084a 100644 --- a/scripts/meterpreter/prefetchtool.rb +++ b/scripts/meterpreter/prefetchtool.rb @@ -140,8 +140,7 @@ check_update = false raise Rex::Script::Completed end } -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i prefetch_local = ::File.join(Msf::Config.data_directory, "prefetch.exe") if !(::File.exist?(prefetch_local)) diff --git a/scripts/meterpreter/schtasksabuse.rb b/scripts/meterpreter/schtasksabuse.rb index 0a6df5eb97..1bb0e06629 100644 --- a/scripts/meterpreter/schtasksabuse.rb +++ b/scripts/meterpreter/schtasksabuse.rb @@ -147,8 +147,7 @@ end } -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i print_status("Meterpreter session running as #{session.sys.config.getuid}") if help == 0 && commands.length != 0 abuse(session,targets,commands,username,password,delay) diff --git a/scripts/meterpreter/scraper.rb b/scripts/meterpreter/scraper.rb index bc1f1cf5d5..74068f8a13 100644 --- a/scripts/meterpreter/scraper.rb +++ b/scripts/meterpreter/scraper.rb @@ -72,8 +72,7 @@ logs = ::File.join(Msf::Config.log_directory, 'scripts','scraper', host + "_" + # Create the log directory ::FileUtils.mkdir_p(logs) -platform = client.platform.scan(/(win32|win64|php)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i begin tmp = client.fs.file.expand_path("%TEMP%") diff --git a/scripts/meterpreter/screen_unlock.rb b/scripts/meterpreter/screen_unlock.rb index 14c0a35613..c818737c41 100644 --- a/scripts/meterpreter/screen_unlock.rb +++ b/scripts/meterpreter/screen_unlock.rb @@ -35,8 +35,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i os = client.sys.config.sysinfo['OS'] targets.each do |t| diff --git a/scripts/meterpreter/search_dwld.rb b/scripts/meterpreter/search_dwld.rb index fe44e980bf..f89c5c3354 100644 --- a/scripts/meterpreter/search_dwld.rb +++ b/scripts/meterpreter/search_dwld.rb @@ -71,8 +71,7 @@ def unsupported end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i # Get arguments basedir = args[0] || "C:\\" filter = args[1] || "office" diff --git a/scripts/meterpreter/srt_webdrive_priv.rb b/scripts/meterpreter/srt_webdrive_priv.rb index 381558fafb..d42f7c2740 100644 --- a/scripts/meterpreter/srt_webdrive_priv.rb +++ b/scripts/meterpreter/srt_webdrive_priv.rb @@ -46,8 +46,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i # # Option parsing # diff --git a/scripts/meterpreter/uploadexec.rb b/scripts/meterpreter/uploadexec.rb index 55a086cef5..a56d8926e1 100644 --- a/scripts/meterpreter/uploadexec.rb +++ b/scripts/meterpreter/uploadexec.rb @@ -86,8 +86,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i #parsing of Options file = "" cmdopt = nil diff --git a/scripts/meterpreter/virtualbox_sysenter_dos.rb b/scripts/meterpreter/virtualbox_sysenter_dos.rb index aa634fd69a..ff0c5bd9a4 100644 --- a/scripts/meterpreter/virtualbox_sysenter_dos.rb +++ b/scripts/meterpreter/virtualbox_sysenter_dos.rb @@ -22,8 +22,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i # Spawn calculator pid = client.sys.process.execute("calc.exe", nil, {'Hidden' => 'true'}).pid diff --git a/scripts/meterpreter/vnc.rb b/scripts/meterpreter/vnc.rb index 359ee8f1bd..5225d104c9 100644 --- a/scripts/meterpreter/vnc.rb +++ b/scripts/meterpreter/vnc.rb @@ -79,8 +79,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i # # Create the raw payload diff --git a/scripts/meterpreter/winbf.rb b/scripts/meterpreter/winbf.rb index 86fe3cd9c3..7b54d2a2d5 100644 --- a/scripts/meterpreter/winbf.rb +++ b/scripts/meterpreter/winbf.rb @@ -145,8 +145,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i ################## MAIN ################## diff --git a/scripts/meterpreter/winenum.rb b/scripts/meterpreter/winenum.rb index fe992d6ac7..260f16863b 100644 --- a/scripts/meterpreter/winenum.rb +++ b/scripts/meterpreter/winenum.rb @@ -561,8 +561,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i ################## MAIN ################## diff --git a/scripts/meterpreter/wmic.rb b/scripts/meterpreter/wmic.rb index bc0f7fd871..451c9f99c3 100644 --- a/scripts/meterpreter/wmic.rb +++ b/scripts/meterpreter/wmic.rb @@ -126,8 +126,7 @@ end raise RuntimeError, "Empty command list" end } -platform = client.platform.scan(/(win32|win64)/) -unsupported if not platform +unsupported if client.platfom !~ /win32|win64/i if outfile == nil print_status wmicexec(session,commands)