Add -f to generate. Add SMBUser/SMBPass options to psexec (regular vs advanced)

git-svn-id: file:///home/svn/framework3/trunk@5354 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2008-01-25 23:24:06 +00:00
parent 16b457067a
commit d931374844
2 changed files with 22 additions and 3 deletions

View File

@ -20,6 +20,7 @@ class Payload
"-h" => [ false, "Help banner." ],
"-o" => [ true, "A comma separated list of options in VAR=VAL format." ],
"-s" => [ true, "NOP sled length." ],
"-f" => [ true, "The output file name (otherwise stdout)" ],
"-t" => [ true, "The output type: ruby, perl, c, or raw." ])
#
@ -49,6 +50,7 @@ class Payload
option_str = nil
badchars = nil
type = "ruby"
ofile = nil
@@generate_opts.parse(args) { |opt, idx, val|
case opt
@ -62,6 +64,8 @@ class Payload
sled_size = val.to_i
when '-t'
type = val
when '-f'
ofile = val
when '-h'
print(
"Usage: generate [options]\n\n" +
@ -84,8 +88,15 @@ class Payload
return false
end
if(not ofile)
# Display generated payload
print(buf)
else
print_status("Writing #{buf.length} bytes to #{ofile}...")
fd = File.open(ofile, "wb")
fd.write(buf)
fd.close
end
return true

View File

@ -71,6 +71,14 @@ class Exploits::Windows::Smb::Psexec < Msf::Exploit::Remote
[ 'Automatic', { } ],
],
'DefaultTarget' => 0 ))
# These should be regular options for this exploit
register_options(
[
OptString.new('SMBUser', [ true, 'The username to authenticate as', nil]),
OptString.new('SMBPass', [ true, 'The password for the specified username', nil])
], self.class)
end
def exploit