ensure binary mode when opening files, whitespace fixes
git-svn-id: file:///home/svn/framework3/trunk@9653 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
1c9059eeb1
commit
0882838491
|
@ -79,7 +79,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
def run
|
||||
print_status("Attempting to retrieve #{datastore['RPATH']}...")
|
||||
|
||||
lfd = File.open(datastore['LPATH'], 'w')
|
||||
lfd = File.open(datastore['LPATH'], 'wb')
|
||||
|
||||
connect
|
||||
data = ndmp_recv()
|
||||
|
|
|
@ -415,7 +415,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
user,pass = record.split(",")
|
||||
accts["#{pass.chomp}"] = "#{user}"
|
||||
end
|
||||
::File.open(ordfltpss, "r").each_line do |l|
|
||||
::File.open(ordfltpss, "rb").each_line do |l|
|
||||
accrcrd = l.split(",")
|
||||
if accts.has_key?(accrcrd[2])
|
||||
print_status("\tDefault pass for account #{accrcrd[0]} is #{accrcrd[1]} ")
|
||||
|
|
|
@ -48,27 +48,22 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
print_status("Starting brute force on #{rhost}, using sids from #{list}...")
|
||||
|
||||
fd = File.open(list).each do |sid|
|
||||
fd = File.open(list, 'rb').each do |sid|
|
||||
login = "(DESCRIPTION=(CONNECT_DATA=(SID=#{sid})(CID=(PROGRAM=)(HOST=MSF)(USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=#{rhost})(PORT=#{rport})))"
|
||||
pkt = tns_packet(login)
|
||||
|
||||
login = "(DESCRIPTION=(CONNECT_DATA=(SID=#{sid})(CID=(PROGRAM=)(HOST=MSF)(USER=)))(ADDRESS=(PROTOCOL=tcp)(HOST=#{rhost})(PORT=#{rport})))"
|
||||
begin
|
||||
connect
|
||||
rescue => e
|
||||
print_error("#{e}")
|
||||
disconnect
|
||||
return
|
||||
end
|
||||
|
||||
pkt = tns_packet(login)
|
||||
|
||||
begin
|
||||
connect
|
||||
rescue => e
|
||||
print_error("#{e}")
|
||||
sock.put(pkt)
|
||||
select(nil,nil,nil,s.to_i)
|
||||
res = sock.get_once(-1,3)
|
||||
disconnect
|
||||
return
|
||||
end
|
||||
|
||||
sock.put(pkt)
|
||||
|
||||
select(nil,nil,nil,s.to_i)
|
||||
|
||||
res = sock.get_once(-1,3)
|
||||
|
||||
disconnect
|
||||
|
||||
if ( res and res =~ /ERROR_STACK/ )
|
||||
''
|
||||
|
|
|
@ -25,9 +25,9 @@ class Metasploit3 < Msf::Auxiliary
|
|||
super(update_info(info,
|
||||
'Name' => 'Generic Emailer (SMTP)',
|
||||
'Description' => %q{
|
||||
This module can be used to automate email delivery.
|
||||
This code is based on Joshua Abraham's email script for social
|
||||
engineering.
|
||||
This module can be used to automate email delivery.
|
||||
This code is based on Joshua Abraham's email script for social
|
||||
engineering.
|
||||
},
|
||||
'License' => MSF_LICENSE,
|
||||
'Version' => '$Revision$',
|
||||
|
@ -50,7 +50,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
def run
|
||||
|
||||
fileconf = File.open(datastore['YAML_CONFIG'])
|
||||
fileconf = File.open(datastore['YAML_CONFIG'], "rb")
|
||||
yamlconf = YAML::load(fileconf)
|
||||
|
||||
fileto = yamlconf['to']
|
||||
|
@ -82,9 +82,8 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
datastore['MAILFROM'] = from
|
||||
|
||||
msg = File.open(msg_file).read
|
||||
|
||||
email_sig = File.open(sig_file).read
|
||||
msg = File.open(msg_file, 'rb').read
|
||||
email_sig = File.open(sig_file, 'rb').read
|
||||
|
||||
if (type !~ /text/i and type !~ /text\/html/i)
|
||||
print_error("YAML config: #{type}")
|
||||
|
@ -136,7 +135,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
|
||||
File.open(fileto).each do |l|
|
||||
File.open(fileto, 'rb').each do |l|
|
||||
next if l !~ /\@/
|
||||
|
||||
nem = l.split(',')
|
||||
|
@ -153,7 +152,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
if sig
|
||||
data_sig = File.open(sig_file).read
|
||||
data_sig = File.open(sig_file, 'rb').read
|
||||
email_msg_body = "#{email_msg_body}\n#{data_sig}"
|
||||
end
|
||||
|
||||
|
@ -171,7 +170,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
if attachment
|
||||
if attachment_file_name
|
||||
data_attachment = File.open(attachment_file).read
|
||||
data_attachment = File.open(attachment_file, 'rb').read
|
||||
mime_msg.add_part(Rex::Text.encode_base64(data_attachment, "\r\n"), attachment_file_type, "base64", "attachment; filename=\"#{attachment_file_name}\"")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -113,7 +113,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
#for writing file with all email's found
|
||||
def write_output(data)
|
||||
print_status("Writing email address list to #{datastore['OUTFILE']}...")
|
||||
::File.open(datastore['OUTFILE'], "a") do |fd|
|
||||
::File.open(datastore['OUTFILE'], "ab") do |fd|
|
||||
fd.write(data)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -149,7 +149,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
def finger_user_common
|
||||
if(! @common)
|
||||
File.open(datastore['USERS_FILE'], "r") do |fd|
|
||||
File.open(datastore['USERS_FILE'], "rb") do |fd|
|
||||
data = fd.read(fd.stat.size)
|
||||
@common = data.split(/\n/).compact.uniq
|
||||
@common.delete("")
|
||||
|
|
|
@ -97,7 +97,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -92,7 +92,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -90,7 +90,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
@ -121,7 +121,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
dm = datastore['NoDetailMessages']
|
||||
|
||||
queue = []
|
||||
File.open(datastore['DICTIONARY']).each_line do |testd|
|
||||
File.open(datastore['DICTIONARY'], 'rb').each_line do |testd|
|
||||
queue << testd.strip + '/'
|
||||
end
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404S']).each do |str|
|
||||
File.open(datastore['HTTP404S'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
@ -126,7 +126,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
webdav_req = %q|<?xml version="1.0" encoding="utf-8"?><propfind xmlns="DAV:"><prop><getcontentlength xmlns="DAV:"/><getlastmodified xmlns="DAV:"/><executable xmlns="http://apache.org/dav/props/"/><resourcetype xmlns="DAV:"/><checked-in xmlns="DAV:"/><checked-out xmlns="DAV:"/></prop></propfind>|
|
||||
|
||||
File.open(datastore['DICTIONARY']).each do |testf|
|
||||
File.open(datastore['DICTIONARY'], 'rb').each do |testf|
|
||||
begin
|
||||
testfdir = testf.chomp + '/'
|
||||
res = send_request_cgi({
|
||||
|
|
|
@ -77,7 +77,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
print_status("OUTFILE did not exist, creating..")
|
||||
end
|
||||
|
||||
File.open(file_name, 'a') do |fd|
|
||||
File.open(file_name, 'ab') do |fd|
|
||||
fd.write(data)
|
||||
end
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
print_status("OUTFILE did not exist, creating..")
|
||||
end
|
||||
|
||||
File.open(file_name, 'a') do |fd|
|
||||
File.open(file_name, 'ab') do |fd|
|
||||
fd.write(data)
|
||||
end
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
queue = []
|
||||
|
||||
File.open(datastore['DICTIONARY']).each do |testf|
|
||||
File.open(datastore['DICTIONARY'], 'rb').each do |testf|
|
||||
queue << testf.strip
|
||||
end
|
||||
|
||||
|
@ -92,7 +92,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -17,34 +17,32 @@ class Metasploit3 < Msf::Auxiliary
|
|||
include Msf::Auxiliary::Report
|
||||
include Msf::Auxiliary::Scanner
|
||||
|
||||
|
||||
def initialize
|
||||
|
||||
super(
|
||||
'Name' => 'Nginx Source Code Disclosure/Download',
|
||||
'Version' => '$Revision$',
|
||||
'Description' => 'This module exploits a nginx source code disclosure/download vulnerability.',
|
||||
'Description' => %q{
|
||||
This module exploits a source code disclosure/download vulnerability in
|
||||
versions of the nginx web server between 0.7.56 and 0.8.40 (inclusive).
|
||||
}
|
||||
'References' =>
|
||||
[
|
||||
['CVE', '2010-2263'],
|
||||
['OSVDB', '65531'],
|
||||
['BID', '40760'],
|
||||
[ 'CVE', '2010-2263' ],
|
||||
[ 'OSVDB', '65531' ],
|
||||
[ 'BID', '40760' ]
|
||||
],
|
||||
'Author' =>
|
||||
[
|
||||
'Alligator Security Team',
|
||||
'Tiago Ferreira <tiago.ccna[at]gmail.com>',
|
||||
],
|
||||
'License' => MSF_LICENSE
|
||||
)
|
||||
'License' => MSF_LICENSE)
|
||||
|
||||
register_options(
|
||||
[
|
||||
Opt::RPORT(80),
|
||||
OptString.new('URI', [true, 'Specify the path to download the file (ex: admin.php)', '/admin.php']),
|
||||
OptString.new('PATH_SAVE', [true, 'The path to save the downloaded source code', '']),
|
||||
], self.class)
|
||||
|
||||
end
|
||||
|
||||
def target_url
|
||||
|
@ -113,4 +111,3 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -81,7 +81,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -65,7 +65,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
queue = []
|
||||
|
||||
File.open(datastore['VULNCSV']).each do |testf|
|
||||
File.open(datastore['VULNCSV'], 'rb').each do |testf|
|
||||
queue << testf.strip
|
||||
end
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
# Look for a string we can signature on as well
|
||||
if(tcode >= 200 and tcode <= 299)
|
||||
File.open(datastore['HTTP404Sigs']).each do |str|
|
||||
File.open(datastore['HTTP404Sigs'], 'rb').each do |str|
|
||||
if(res.body.index(str))
|
||||
emesg = str
|
||||
break
|
||||
|
|
|
@ -223,4 +223,3 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
##
|
||||
# $Id$
|
||||
##
|
||||
|
||||
##
|
||||
# This file is part of the Metasploit Framework and may be subject to
|
||||
# redistribution and commercial restrictions. Please see the Metasploit
|
||||
|
|
|
@ -47,7 +47,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
def configure_wordlist
|
||||
@comms = []
|
||||
File.open(datastore['COMMUNITIES'], "r") do |fd|
|
||||
File.open(datastore['COMMUNITIES'], "rb") do |fd|
|
||||
buff = fd.read(fd.stat.size)
|
||||
buff.split("\n").each do |line|
|
||||
line.strip!
|
||||
|
|
|
@ -29,7 +29,7 @@ class Object
|
|||
begin
|
||||
file = Zlib::GzipReader.open(filename)
|
||||
rescue Zlib::GzipFile::Error
|
||||
file = File.open(filename, 'r')
|
||||
file = File.open(filename, 'rb')
|
||||
ensure
|
||||
return nil if ! file
|
||||
#obj = Marshal.load file.read
|
||||
|
|
|
@ -52,7 +52,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
)
|
||||
add_socket(udp_sock)
|
||||
|
||||
fd = File.open(datastore['DICTIONARY'], 'r')
|
||||
fd = File.open(datastore['DICTIONARY'], 'rb')
|
||||
fd.read(fd.stat.size).split("\n").each do |filename|
|
||||
filename.strip!
|
||||
pkt = "\x00\x01" + filename + "\x00" + "netascii" + "\x00"
|
||||
|
@ -78,4 +78,3 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
print_status("#{cli.peerhost}: #{domain}\\#{user} #{lm_hash}:#{ntlm_hash} on #{host}")
|
||||
|
||||
if(datastore['LOGFILE'])
|
||||
fd = File.open(datastore['LOGFILE'], "a")
|
||||
fd = File.open(datastore['LOGFILE'], "ab")
|
||||
fd.puts(
|
||||
[
|
||||
Time.now.to_s,
|
||||
|
@ -144,7 +144,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
end
|
||||
|
||||
if(datastore['PWFILE'] and user and lm_hash)
|
||||
fd = File.open(datastore['PWFILE'], "a+")
|
||||
fd = File.open(datastore['PWFILE'], "ab+")
|
||||
fd.puts(
|
||||
[
|
||||
user,
|
||||
|
|
|
@ -226,7 +226,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
|
||||
|
||||
if(datastore['LOGFILE'])
|
||||
fd = File.open(datastore['LOGFILE'], "a")
|
||||
fd = File.open(datastore['LOGFILE'], "ab")
|
||||
fd.puts(
|
||||
[
|
||||
smb[:nbsrc],
|
||||
|
|
|
@ -93,7 +93,7 @@ class Metasploit3 < Msf::Auxiliary
|
|||
else
|
||||
r["txresponse"] = ""
|
||||
begin
|
||||
File.open r["file"], File::RDONLY do |io|
|
||||
File.open(r["file"], "rb") do |io|
|
||||
r["txresponse"] += io.read(4096)
|
||||
end
|
||||
rescue EOFError
|
||||
|
|
|
@ -97,7 +97,7 @@ class Metasploit3 < Msf::Exploit::Remote
|
|||
|
||||
# load the xml data
|
||||
path = File.join(Msf::Config.install_root, "data", "exploits", "google_proxystylesheet.xml")
|
||||
fd = File.open(path, "r")
|
||||
fd = File.open(path, "rb")
|
||||
@xml_data = fd.read(fd.stat.size)
|
||||
fd.close
|
||||
|
||||
|
|
Loading…
Reference in New Issue