Don't blow up if the user doesn't set a filename
Can't actually require FILENAME or REMOTE_FILENAME because I don't know if you're going to upload or download. However, there shouldn't be a stacktrace when you just try to go with neither.unstable
parent
2db697cd7a
commit
743a0546f1
|
@ -54,7 +54,7 @@ class Client
|
||||||
self.peer_port = params["PeerPort"] || 69
|
self.peer_port = params["PeerPort"] || 69
|
||||||
self.context = params["Context"] || {}
|
self.context = params["Context"] || {}
|
||||||
self.local_file = params["LocalFile"]
|
self.local_file = params["LocalFile"]
|
||||||
self.remote_file = params["RemoteFile"] || ::File.split(self.local_file).last
|
self.remote_file = params["RemoteFile"] || (::File.split(self.local_file).last if self.local_file)
|
||||||
self.mode = params["Mode"] || "octet"
|
self.mode = params["Mode"] || "octet"
|
||||||
self.action = params["Action"] || (raise ArgumentError, "Need an action.")
|
self.action = params["Action"] || (raise ArgumentError, "Need an action.")
|
||||||
self.block_size = params["BlockSize"] || 512
|
self.block_size = params["BlockSize"] || 512
|
||||||
|
|
|
@ -60,7 +60,8 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
end
|
end
|
||||||
|
|
||||||
def remote_file
|
def remote_file
|
||||||
datastore['REMOTE_FILENAME'] || ::File.split(datastore['FILENAME']).last
|
return datastore['REMOTE_FILENAME'] if datastore['REMOTE_FILENAME']
|
||||||
|
return ::File.split(datastore['FILENAME']).last if datastore['FILENAME']
|
||||||
end
|
end
|
||||||
|
|
||||||
def rport
|
def rport
|
||||||
|
@ -138,8 +139,24 @@ class Metasploit3 < Msf::Auxiliary
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
run_upload() if action.name == 'Upload'
|
case action.name
|
||||||
run_download() if action.name == 'Download'
|
when 'Upload'
|
||||||
|
if file
|
||||||
|
run_upload()
|
||||||
|
else
|
||||||
|
print_error "Need at least a local file name or file data to upload."
|
||||||
|
return
|
||||||
|
end
|
||||||
|
when 'Download'
|
||||||
|
if remote_file
|
||||||
|
run_download()
|
||||||
|
else
|
||||||
|
print_error "Need at least a remote file name to download."
|
||||||
|
return
|
||||||
|
end
|
||||||
|
else
|
||||||
|
print_error "Unknown action: '#{action.name}'"
|
||||||
|
end
|
||||||
while not @tftp_client.complete
|
while not @tftp_client.complete
|
||||||
select(nil,nil,nil,1)
|
select(nil,nil,nil,1)
|
||||||
print_status [rtarget,"TFTP transfer operation complete."].join
|
print_status [rtarget,"TFTP transfer operation complete."].join
|
||||||
|
|
Loading…
Reference in New Issue