Add some docs to FtpServer
parent
1f881d7c21
commit
aea76a56de
|
@ -26,11 +26,13 @@ module Exploit::Remote::FtpServer
|
|||
], Msf::Exploit::Remote::FtpServer)
|
||||
end
|
||||
|
||||
# (see Msf::Exploit#setup)
|
||||
def setup
|
||||
super
|
||||
@state = {}
|
||||
end
|
||||
|
||||
# (see TcpServer#on_client_connect)
|
||||
def on_client_connect(c)
|
||||
@state[c] = {
|
||||
:name => "#{c.peerhost}:#{c.peerport}",
|
||||
|
@ -46,6 +48,25 @@ module Exploit::Remote::FtpServer
|
|||
c.put "220 FTP Server Ready\r\n"
|
||||
end
|
||||
|
||||
# Dispatches client requests to command handlers.
|
||||
#
|
||||
# Handlers should be named +on_client_command_*+, ending with a
|
||||
# downcased FTP verb, e.g. +on_client_command_user+. If no handler
|
||||
# exists for the given command, returns a generic default response.
|
||||
#
|
||||
# @example Handle SYST requests
|
||||
# class Metasploit4 < Msf::Exploit
|
||||
# include Msf::Exploit::Remote::FtpServer
|
||||
# ...
|
||||
# def on_client_command_syst(cmd_conn, arg)
|
||||
# print_status("Responding to SYST request")
|
||||
# buf = build_exploit_buffer(cmd_conn)
|
||||
# cmd_conn.put("215 Unix Type: #{buf}\r\n")
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# @param (see TcpServer#on_client_data)
|
||||
# @return (see TcpServer#on_client_data)
|
||||
def on_client_data(c)
|
||||
data = c.get_once
|
||||
return if not data
|
||||
|
@ -184,6 +205,15 @@ module Exploit::Remote::FtpServer
|
|||
end
|
||||
|
||||
|
||||
# Create a socket for the protocol data, either PASV or PORT,
|
||||
# depending on the client.
|
||||
#
|
||||
# @see http://tools.ietf.org/html/rfc3659 RFC 3659
|
||||
# @see http://tools.ietf.org/html/rfc959 RFC 959
|
||||
# @param c [Socket] Control connection socket
|
||||
#
|
||||
# @return [Socket] A connected socket for the data connection
|
||||
# @return [nil] on failure
|
||||
def establish_data_connection(c)
|
||||
begin
|
||||
Timeout.timeout(20) do
|
||||
|
|
Loading…
Reference in New Issue