From aa03db1f5c4a694d258879ccdf0dcaaf7f576355 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Tue, 25 Apr 2017 23:31:39 -0500 Subject: [PATCH] update meterpreter scripts to check the right prerequisites --- scripts/meterpreter/arp_scanner.rb | 2 +- scripts/meterpreter/checkvm.rb | 2 +- scripts/meterpreter/credcollect.rb | 9 ++------- scripts/meterpreter/domain_list_gen.rb | 2 +- scripts/meterpreter/dumplinks.rb | 2 +- scripts/meterpreter/duplicate.rb | 2 +- scripts/meterpreter/enum_firefox.rb | 2 +- scripts/meterpreter/enum_logged_on_users.rb | 2 +- scripts/meterpreter/enum_powershell_env.rb | 2 +- scripts/meterpreter/enum_putty.rb | 2 +- scripts/meterpreter/enum_vmware.rb | 2 +- scripts/meterpreter/event_manager.rb | 2 +- scripts/meterpreter/file_collector.rb | 2 +- scripts/meterpreter/get_application_list.rb | 2 +- scripts/meterpreter/get_env.rb | 2 +- scripts/meterpreter/get_filezilla_creds.rb | 2 +- scripts/meterpreter/get_pidgin_creds.rb | 2 +- scripts/meterpreter/get_valid_community.rb | 2 +- scripts/meterpreter/getcountermeasure.rb | 2 +- scripts/meterpreter/getgui.rb | 2 +- scripts/meterpreter/gettelnet.rb | 2 +- scripts/meterpreter/getvncpw.rb | 2 +- scripts/meterpreter/hashdump.rb | 2 +- scripts/meterpreter/hostsedit.rb | 2 +- scripts/meterpreter/keylogrecorder.rb | 2 +- scripts/meterpreter/metsvc.rb | 2 +- scripts/meterpreter/migrate.rb | 2 +- scripts/meterpreter/multi_meter_inject.rb | 2 +- scripts/meterpreter/netenum.rb | 2 +- scripts/meterpreter/packetrecorder.rb | 2 +- scripts/meterpreter/panda_2007_pavsrv51.rb | 2 +- scripts/meterpreter/pml_driver_config.rb | 2 +- scripts/meterpreter/prefetchtool.rb | 2 +- scripts/meterpreter/process_memdump.rb | 6 +++--- scripts/meterpreter/remotewinenum.rb | 2 +- scripts/meterpreter/scheduleme.rb | 2 +- scripts/meterpreter/schtasksabuse.rb | 2 +- scripts/meterpreter/scraper.rb | 2 +- scripts/meterpreter/screen_unlock.rb | 2 +- scripts/meterpreter/screenspy.rb | 2 +- scripts/meterpreter/search_dwld.rb | 2 +- scripts/meterpreter/service_manager.rb | 2 +- scripts/meterpreter/sound_recorder.rb | 2 +- scripts/meterpreter/srt_webdrive_priv.rb | 2 +- scripts/meterpreter/uploadexec.rb | 4 ++-- scripts/meterpreter/virtualbox_sysenter_dos.rb | 2 +- scripts/meterpreter/vnc.rb | 2 +- scripts/meterpreter/webcam.rb | 2 +- scripts/meterpreter/win32-sshclient.rb | 2 +- scripts/meterpreter/win32-sshserver.rb | 2 +- scripts/meterpreter/winbf.rb | 2 +- scripts/meterpreter/winenum.rb | 2 +- scripts/meterpreter/wmic.rb | 2 +- 53 files changed, 57 insertions(+), 62 deletions(-) diff --git a/scripts/meterpreter/arp_scanner.rb b/scripts/meterpreter/arp_scanner.rb index b6c52a3105..c3136d45c6 100644 --- a/scripts/meterpreter/arp_scanner.rb +++ b/scripts/meterpreter/arp_scanner.rb @@ -102,7 +102,7 @@ cidr2scan = "" save2log = true end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if args.length > 0 if save2log save_found(arp_scan(cidr2scan)) diff --git a/scripts/meterpreter/checkvm.rb b/scripts/meterpreter/checkvm.rb index 96d7ce66e6..67e0089ac4 100644 --- a/scripts/meterpreter/checkvm.rb +++ b/scripts/meterpreter/checkvm.rb @@ -344,7 +344,7 @@ def qemuchk(session) end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' print_status("Checking if target is a Virtual Machine .....") found = hypervchk(session) found = vmwarechk(session) if not found diff --git a/scripts/meterpreter/credcollect.rb b/scripts/meterpreter/credcollect.rb index f54774e0e6..491aa7c60d 100644 --- a/scripts/meterpreter/credcollect.rb +++ b/scripts/meterpreter/credcollect.rb @@ -26,14 +26,9 @@ opts.parse(args) { |opt, idx, val| end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' # Collect even without a database to store them. - if client.framework.db.active - db_ok = true - else - db_ok = false - end - + db_ok = client.framework.db.active # Make sure we're rockin Priv and Incognito client.core.use("priv") if not client.respond_to?("priv") diff --git a/scripts/meterpreter/domain_list_gen.rb b/scripts/meterpreter/domain_list_gen.rb index a8efd15057..6f94542784 100644 --- a/scripts/meterpreter/domain_list_gen.rb +++ b/scripts/meterpreter/domain_list_gen.rb @@ -56,7 +56,7 @@ end # Create Filename info to be appended to downloaded files filenameinfo = "_" + ::Time.now.strftime("%Y%m%d.%M%S") -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' # Create a directory for the logs logs = ::File.join(Msf::Config.log_directory, 'scripts','domain_admins') diff --git a/scripts/meterpreter/dumplinks.rb b/scripts/meterpreter/dumplinks.rb index 6e93936f3c..f1f5f062c6 100644 --- a/scripts/meterpreter/dumplinks.rb +++ b/scripts/meterpreter/dumplinks.rb @@ -369,7 +369,7 @@ def get_time(lo_byte, hi_byte) end return time end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' enum_users(os).each do |user| if user['userpath'] print_status "Extracting lnk files for user #{user['username']} at #{user['userpath']}..." diff --git a/scripts/meterpreter/duplicate.rb b/scripts/meterpreter/duplicate.rb index 080f9ded93..582088c6e9 100644 --- a/scripts/meterpreter/duplicate.rb +++ b/scripts/meterpreter/duplicate.rb @@ -84,7 +84,7 @@ mul.exploit_simple( 'RunAsJob' => true ) -if client.platform =~ /win32|win64/ +if client.platform == 'windows' server = client.sys.process.open print_status("Current server process: #{server.name} (#{server.pid})") diff --git a/scripts/meterpreter/enum_firefox.rb b/scripts/meterpreter/enum_firefox.rb index acd1c62880..e9d6d23f21 100644 --- a/scripts/meterpreter/enum_firefox.rb +++ b/scripts/meterpreter/enum_firefox.rb @@ -254,7 +254,7 @@ end kill_frfx = true end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if frfxchk user = @client.sys.config.getuid if not is_system? diff --git a/scripts/meterpreter/enum_logged_on_users.rb b/scripts/meterpreter/enum_logged_on_users.rb index 138f41b704..6573bed3e0 100644 --- a/scripts/meterpreter/enum_logged_on_users.rb +++ b/scripts/meterpreter/enum_logged_on_users.rb @@ -89,7 +89,7 @@ end ls_current end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if args.length == 0 print_line "Meterpreter Script for enumerating Current logged users and users that have loged in to the system." print_line(@@exec_opts.usage) diff --git a/scripts/meterpreter/enum_powershell_env.rb b/scripts/meterpreter/enum_powershell_env.rb index d3fab5da07..e477a1fb7e 100644 --- a/scripts/meterpreter/enum_powershell_env.rb +++ b/scripts/meterpreter/enum_powershell_env.rb @@ -124,7 +124,7 @@ def enum_powershell end end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' enum_powershell else print_error("This version of Meterpreter is not supported with this Script!") diff --git a/scripts/meterpreter/enum_putty.rb b/scripts/meterpreter/enum_putty.rb index 5eae76195b..6b2bcd344e 100644 --- a/scripts/meterpreter/enum_putty.rb +++ b/scripts/meterpreter/enum_putty.rb @@ -91,7 +91,7 @@ def enum_saved_sessions(reg_key_base) end end end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' hkcu_base.each do |hkb| if check_putty(hkb) enum_known_ssh_hosts(hkb) diff --git a/scripts/meterpreter/enum_vmware.rb b/scripts/meterpreter/enum_vmware.rb index c19a8fb200..64b51eae2c 100644 --- a/scripts/meterpreter/enum_vmware.rb +++ b/scripts/meterpreter/enum_vmware.rb @@ -297,7 +297,7 @@ def enum_vmwarewrk end end end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if check_vmsoft vmware_products = check_prods() if vmware_products.include?("VMware VirtualCenter") diff --git a/scripts/meterpreter/event_manager.rb b/scripts/meterpreter/event_manager.rb index 0a6594b463..ed20614fc7 100644 --- a/scripts/meterpreter/event_manager.rb +++ b/scripts/meterpreter/event_manager.rb @@ -204,7 +204,7 @@ opts.parse(args) { |opt, idx, val| } # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' # Print usage & exit if the user didn't specify an action # to default to just running for all logs) diff --git a/scripts/meterpreter/file_collector.rb b/scripts/meterpreter/file_collector.rb index 1597e59431..80d3efd92e 100644 --- a/scripts/meterpreter/file_collector.rb +++ b/scripts/meterpreter/file_collector.rb @@ -33,7 +33,7 @@ def usage end # Check that we are running under the right type of Meterpreter -if client.platform =~ /win32|win64/ +if client.platform == 'windows' # Parse the options if args.length > 0 @opts.parse(args) { |opt, idx, val| diff --git a/scripts/meterpreter/get_application_list.rb b/scripts/meterpreter/get_application_list.rb index 1186eaf3b6..3681d24c83 100644 --- a/scripts/meterpreter/get_application_list.rb +++ b/scripts/meterpreter/get_application_list.rb @@ -62,7 +62,7 @@ opts.parse(args) { |opt, idx, val| end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' app_list else print_error("This version of Meterpreter is not supported with this Script!") diff --git a/scripts/meterpreter/get_env.rb b/scripts/meterpreter/get_env.rb index b33d05be4b..f0b6e773ea 100644 --- a/scripts/meterpreter/get_env.rb +++ b/scripts/meterpreter/get_env.rb @@ -40,7 +40,7 @@ opts.parse(args) { |opt, idx, val| end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' list_env_vars(var_names) else print_error("This version of Meterpreter is not supported with this Script!") diff --git a/scripts/meterpreter/get_filezilla_creds.rb b/scripts/meterpreter/get_filezilla_creds.rb index 6d87539409..a88c26fd9b 100644 --- a/scripts/meterpreter/get_filezilla_creds.rb +++ b/scripts/meterpreter/get_filezilla_creds.rb @@ -150,7 +150,7 @@ def enum_users(os) end ################## MAIN ################## -if client.platform =~ /win32|win64/ +if client.platform == 'windows' print_status("Running Meterpreter FileZilla Credential harvester script") print_status("All services are logged at #{dest}") enum_users(os).each do |u| diff --git a/scripts/meterpreter/get_pidgin_creds.rb b/scripts/meterpreter/get_pidgin_creds.rb index 78d4f41d54..fe1a2cbf6c 100644 --- a/scripts/meterpreter/get_pidgin_creds.rb +++ b/scripts/meterpreter/get_pidgin_creds.rb @@ -183,7 +183,7 @@ end #------------------------------------------------------------------------------- ################## MAIN ################## -if client.platform =~ /win32|win64/ +if client.platform == 'windows' print_status("Running Meterpreter Pidgin Credential harvester script") print_status("All services are logged at #{dest}") enum_users(os).each do |u| diff --git a/scripts/meterpreter/get_valid_community.rb b/scripts/meterpreter/get_valid_community.rb index 54c5bce348..a31ba47f56 100644 --- a/scripts/meterpreter/get_valid_community.rb +++ b/scripts/meterpreter/get_valid_community.rb @@ -38,7 +38,7 @@ end end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' print_status("Searching for community strings...") strs = get_community(session) if strs diff --git a/scripts/meterpreter/getcountermeasure.rb b/scripts/meterpreter/getcountermeasure.rb index 804a4417e9..a987d322ec 100644 --- a/scripts/meterpreter/getcountermeasure.rb +++ b/scripts/meterpreter/getcountermeasure.rb @@ -364,7 +364,7 @@ killfw = false end } # get the version of windows -if client.platform =~ /win32|win64/ +if client.platform == 'windows' wnvr = session.sys.config.sysinfo["OS"] print_status("Running Getcountermeasure on the target...") check(session,avs,killbt) diff --git a/scripts/meterpreter/getgui.rb b/scripts/meterpreter/getgui.rb index ebd59c91a0..520ce1f760 100644 --- a/scripts/meterpreter/getgui.rb +++ b/scripts/meterpreter/getgui.rb @@ -151,7 +151,7 @@ frwrd = nil end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if args.length > 0 if enbl or (usr and pass) message diff --git a/scripts/meterpreter/gettelnet.rb b/scripts/meterpreter/gettelnet.rb index 3f43493ea4..50035d78c6 100644 --- a/scripts/meterpreter/gettelnet.rb +++ b/scripts/meterpreter/gettelnet.rb @@ -155,7 +155,7 @@ enbl = nil } -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' if enbl or (usr!= nil && pass != nil) message diff --git a/scripts/meterpreter/getvncpw.rb b/scripts/meterpreter/getvncpw.rb index 900bb9906f..c26943730c 100644 --- a/scripts/meterpreter/getvncpw.rb +++ b/scripts/meterpreter/getvncpw.rb @@ -81,7 +81,7 @@ keytosearch = nil keytosearch = val end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if keytosearch == nil print_status("Searching for VNC Passwords in the registry....") keys.each { |key| diff --git a/scripts/meterpreter/hashdump.rb b/scripts/meterpreter/hashdump.rb index b53fdb5d82..537e940774 100644 --- a/scripts/meterpreter/hashdump.rb +++ b/scripts/meterpreter/hashdump.rb @@ -244,7 +244,7 @@ def decrypt_user_hash(rid, hbootkey, enchash, pass) d1o << d2.final d1o + d2o end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' begin print_status("Obtaining the boot key...") diff --git a/scripts/meterpreter/hostsedit.rb b/scripts/meterpreter/hostsedit.rb index 03694044e9..68aaa60978 100644 --- a/scripts/meterpreter/hostsedit.rb +++ b/scripts/meterpreter/hostsedit.rb @@ -74,7 +74,7 @@ def cleardnscach(session) print_status("Clearing the DNS Cache") session.sys.process.execute("cmd /c ipconfig /flushdns",nil, {'Hidden' => true}) end -if client.platform =~ /win32|win64/ +if client.platform == 'windows' @@exec_opts.parse(args) { |opt, idx, val| case opt when "-e" diff --git a/scripts/meterpreter/keylogrecorder.rb b/scripts/meterpreter/keylogrecorder.rb index 3ddb44fdda..e4043d5784 100644 --- a/scripts/meterpreter/keylogrecorder.rb +++ b/scripts/meterpreter/keylogrecorder.rb @@ -196,7 +196,7 @@ kill = false kill = true end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if (captype.to_i == 2) if startkeylogger(session) keycap(session, keytime, logfile) diff --git a/scripts/meterpreter/metsvc.rb b/scripts/meterpreter/metsvc.rb index 7eafcef435..6c277d9f15 100644 --- a/scripts/meterpreter/metsvc.rb +++ b/scripts/meterpreter/metsvc.rb @@ -42,7 +42,7 @@ rport = 31337 install = false autoconn = false remove = false -if client.platform =~ /win32|win64/ +if client.platform == 'windows' # # Option parsing diff --git a/scripts/meterpreter/migrate.rb b/scripts/meterpreter/migrate.rb index c8d1a1760b..989ce76bc9 100644 --- a/scripts/meterpreter/migrate.rb +++ b/scripts/meterpreter/migrate.rb @@ -61,7 +61,7 @@ end ### Main ### -if client.platform =~ /win32|win64/ +if client.platform == 'windows' server = client.sys.process.open original_pid = server.pid print_status("Current server process: #{server.name} (#{server.pid})") diff --git a/scripts/meterpreter/multi_meter_inject.rb b/scripts/meterpreter/multi_meter_inject.rb index c167769728..af2c745a6c 100644 --- a/scripts/meterpreter/multi_meter_inject.rb +++ b/scripts/meterpreter/multi_meter_inject.rb @@ -122,7 +122,7 @@ end } # Check for version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' # Create a exploit/multi/handler if desired create_multi_handler(payload_type) if start_handler diff --git a/scripts/meterpreter/netenum.rb b/scripts/meterpreter/netenum.rb index 4ddcd77a6c..3b7445543e 100644 --- a/scripts/meterpreter/netenum.rb +++ b/scripts/meterpreter/netenum.rb @@ -311,7 +311,7 @@ srvrc = nil end } -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if pngsp == 1 if range != nil message(logs) diff --git a/scripts/meterpreter/packetrecorder.rb b/scripts/meterpreter/packetrecorder.rb index ba3e5dc1e2..b4429cab05 100644 --- a/scripts/meterpreter/packetrecorder.rb +++ b/scripts/meterpreter/packetrecorder.rb @@ -200,7 +200,7 @@ end } # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' if !int_id.nil? or !list_int.nil? if not is_uac_enabled? or is_admin? diff --git a/scripts/meterpreter/panda_2007_pavsrv51.rb b/scripts/meterpreter/panda_2007_pavsrv51.rb index 0d30420f2e..811bad7f41 100644 --- a/scripts/meterpreter/panda_2007_pavsrv51.rb +++ b/scripts/meterpreter/panda_2007_pavsrv51.rb @@ -62,7 +62,7 @@ end if rhost.nil? or rport.nil? usage -elsif client.platform =~ /win32|win64/ +elsif client.platform == 'windows' client.sys.process.get_processes().each do |m| if ( m['name'] =~ /PAVSRV51\.EXE/ ) diff --git a/scripts/meterpreter/pml_driver_config.rb b/scripts/meterpreter/pml_driver_config.rb index 55e3df6474..0063572253 100644 --- a/scripts/meterpreter/pml_driver_config.rb +++ b/scripts/meterpreter/pml_driver_config.rb @@ -63,7 +63,7 @@ end if rhost.nil? or rport.nil? usage -if client.platform =~ /win32|win64/ +if client.platform == 'windows' client.sys.process.get_processes().each do |m| if ( m['name'] =~ /HPZipm12\.exe/ ) diff --git a/scripts/meterpreter/prefetchtool.rb b/scripts/meterpreter/prefetchtool.rb index 97e346b5ff..1e9361996e 100644 --- a/scripts/meterpreter/prefetchtool.rb +++ b/scripts/meterpreter/prefetchtool.rb @@ -147,7 +147,7 @@ check_update = false raise Rex::Script::Completed end } -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' prefetch_local = ::File.join(Msf::Config.data_directory, "prefetch.exe") if !(::File.exist?(prefetch_local)) diff --git a/scripts/meterpreter/process_memdump.rb b/scripts/meterpreter/process_memdump.rb index 3d8c825364..a93560e38e 100644 --- a/scripts/meterpreter/process_memdump.rb +++ b/scripts/meterpreter/process_memdump.rb @@ -147,9 +147,9 @@ def get_mem_usage( pid ) # Note: As we get the raw structure back from railgun we need to account # for SIZE_T variables being 32bit on x86 and 64bit on x64 mem = nil - if( @client.platform =~ /win32/ ) + if( @client.arch == 'x86' ) mem = pmc[12..15].unpack('V').first - elsif( @client.platform =~ /win64/ ) + elsif( @client.arch == 'x64' ) mem = pmc[16..23].unpack('Q').first end return (mem/1024) @@ -165,7 +165,7 @@ def get_mem_usage( pid ) end # Main -if client.platform =~ /win32|win64/ +if client.platform == 'windows' if resource resource.each do |r| next if r.strip.length < 1 diff --git a/scripts/meterpreter/remotewinenum.rb b/scripts/meterpreter/remotewinenum.rb index 1e5385f678..655ec06d3e 100644 --- a/scripts/meterpreter/remotewinenum.rb +++ b/scripts/meterpreter/remotewinenum.rb @@ -144,7 +144,7 @@ def helpmsg @@exec_opts.usage) end ################## MAIN ################## -if client.platform =~ /win32|win64/ +if client.platform == 'windows' localos = session.sys.config.sysinfo # Check that the command is not being ran on a Win2k host diff --git a/scripts/meterpreter/scheduleme.rb b/scripts/meterpreter/scheduleme.rb index 4f3e9d72fe..a54ae6f857 100644 --- a/scripts/meterpreter/scheduleme.rb +++ b/scripts/meterpreter/scheduleme.rb @@ -241,7 +241,7 @@ password = nil end } -if client.platform =~ /win32|win64/ +if client.platform != 'windows' if helpcall == 1 usage() elsif cmd == nil && file == nil diff --git a/scripts/meterpreter/schtasksabuse.rb b/scripts/meterpreter/schtasksabuse.rb index ba8498a9a5..54e5a9edf7 100644 --- a/scripts/meterpreter/schtasksabuse.rb +++ b/scripts/meterpreter/schtasksabuse.rb @@ -153,7 +153,7 @@ end } -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' 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 0e18c77172..cb10fe38e0 100644 --- a/scripts/meterpreter/scraper.rb +++ b/scripts/meterpreter/scraper.rb @@ -77,7 +77,7 @@ logs = ::File.join(Msf::Config.log_directory, 'scripts','scraper', host + "_" + # Create the log directory ::FileUtils.mkdir_p(logs) -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' begin tmp = client.sys.config.getenv('TEMP') diff --git a/scripts/meterpreter/screen_unlock.rb b/scripts/meterpreter/screen_unlock.rb index 14dd1036e3..b8f7deb056 100644 --- a/scripts/meterpreter/screen_unlock.rb +++ b/scripts/meterpreter/screen_unlock.rb @@ -43,7 +43,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' os = client.sys.config.sysinfo['OS'] targets.each do |t| diff --git a/scripts/meterpreter/screenspy.rb b/scripts/meterpreter/screenspy.rb index 77c1f86b84..9041a0c8b1 100644 --- a/scripts/meterpreter/screenspy.rb +++ b/scripts/meterpreter/screenspy.rb @@ -60,7 +60,7 @@ def wrong_meter_version(meter = meter_type) end # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' session = client diff --git a/scripts/meterpreter/search_dwld.rb b/scripts/meterpreter/search_dwld.rb index 1c5148bfc4..bfdfe212ae 100644 --- a/scripts/meterpreter/search_dwld.rb +++ b/scripts/meterpreter/search_dwld.rb @@ -83,7 +83,7 @@ def unsupported end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' # Get arguments basedir = args[0] || "C:\\" filter = args[1] || "office" diff --git a/scripts/meterpreter/service_manager.rb b/scripts/meterpreter/service_manager.rb index 322136a22d..cd01b2e57c 100644 --- a/scripts/meterpreter/service_manager.rb +++ b/scripts/meterpreter/service_manager.rb @@ -70,7 +70,7 @@ end ################## Main ################## # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' @exec_opts.parse(args) { |opt, idx, val| case opt diff --git a/scripts/meterpreter/sound_recorder.rb b/scripts/meterpreter/sound_recorder.rb index a930ae628c..64a8c8921f 100644 --- a/scripts/meterpreter/sound_recorder.rb +++ b/scripts/meterpreter/sound_recorder.rb @@ -85,7 +85,7 @@ end } # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' # Create Folder for logs and get path for logs if not log_folder diff --git a/scripts/meterpreter/srt_webdrive_priv.rb b/scripts/meterpreter/srt_webdrive_priv.rb index 8d1f683124..e638d669aa 100644 --- a/scripts/meterpreter/srt_webdrive_priv.rb +++ b/scripts/meterpreter/srt_webdrive_priv.rb @@ -51,7 +51,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' # # Option parsing # diff --git a/scripts/meterpreter/uploadexec.rb b/scripts/meterpreter/uploadexec.rb index 4eefc6dd4b..525c6b15d1 100644 --- a/scripts/meterpreter/uploadexec.rb +++ b/scripts/meterpreter/uploadexec.rb @@ -93,7 +93,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' #parsing of Options file = "" cmdopt = nil @@ -132,7 +132,7 @@ print_status("Running Upload and Execute Meterpreter script....") exec = upload(session,file,path) if sleep_sec print_status("\tSleeping for #{sleep_sec}s...") - Rex.sleep(sleep_sec) + Rex.sleep(sleep_sec) end cmd_on_trgt_exec(session,exec,cmdopt,verbose) if remove == 1 diff --git a/scripts/meterpreter/virtualbox_sysenter_dos.rb b/scripts/meterpreter/virtualbox_sysenter_dos.rb index 47615b559b..9c78a06f5e 100644 --- a/scripts/meterpreter/virtualbox_sysenter_dos.rb +++ b/scripts/meterpreter/virtualbox_sysenter_dos.rb @@ -27,7 +27,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' # 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 2ebfd24bae..df964f7fee 100644 --- a/scripts/meterpreter/vnc.rb +++ b/scripts/meterpreter/vnc.rb @@ -88,7 +88,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' # # Create the raw payload diff --git a/scripts/meterpreter/webcam.rb b/scripts/meterpreter/webcam.rb index e52da0a992..4e6bfd3b7f 100644 --- a/scripts/meterpreter/webcam.rb +++ b/scripts/meterpreter/webcam.rb @@ -60,7 +60,7 @@ opts.parse(args) { |opt, idx, val| end } -if !(client.platform =~ /win32|win64/) +if client.platform != 'windows' print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end diff --git a/scripts/meterpreter/win32-sshclient.rb b/scripts/meterpreter/win32-sshclient.rb index 6b0c1a525f..e66d796c61 100644 --- a/scripts/meterpreter/win32-sshclient.rb +++ b/scripts/meterpreter/win32-sshclient.rb @@ -307,7 +307,7 @@ downloaded = nil } # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' if not rhost or not username diff --git a/scripts/meterpreter/win32-sshserver.rb b/scripts/meterpreter/win32-sshserver.rb index 5b48e2fbcd..ba99c74782 100644 --- a/scripts/meterpreter/win32-sshserver.rb +++ b/scripts/meterpreter/win32-sshserver.rb @@ -179,7 +179,7 @@ type = "auto" } # Check for Version of Meterpreter -wrong_meter_version(meter_type) if meter_type !~ /win32|win64/i +wrong_meter_version(meter_type) if meter_type != 'windows' # # Uninstall if selected diff --git a/scripts/meterpreter/winbf.rb b/scripts/meterpreter/winbf.rb index 3f58014368..832f3a5cb2 100644 --- a/scripts/meterpreter/winbf.rb +++ b/scripts/meterpreter/winbf.rb @@ -150,7 +150,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' ################## MAIN ################## diff --git a/scripts/meterpreter/winenum.rb b/scripts/meterpreter/winenum.rb index 864aebd70a..c88d36a890 100644 --- a/scripts/meterpreter/winenum.rb +++ b/scripts/meterpreter/winenum.rb @@ -569,7 +569,7 @@ def unsupported print_error("This version of Meterpreter is not supported with this Script!") raise Rex::Script::Completed end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' ################## MAIN ################## diff --git a/scripts/meterpreter/wmic.rb b/scripts/meterpreter/wmic.rb index a2ae3d1b9d..a9af509a89 100644 --- a/scripts/meterpreter/wmic.rb +++ b/scripts/meterpreter/wmic.rb @@ -127,7 +127,7 @@ end if args.length == 0 usage end -unsupported if client.platform !~ /win32|win64/i +unsupported if client.platform != 'windows' if outfile == nil print_status wmicexec(session,commands)