fixed problem with platform check on scripts
git-svn-id: file:///home/svn/framework3/trunk@11527 4d416f70-5f16-0410-b530-b9f4589650da
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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%")
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
#
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ##################
|
||||
|
||||
|
||||
@@ -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 ##################
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user