Skip to content

Commit aea76a5

Browse files
committed
Add some docs to FtpServer
1 parent 1f881d7 commit aea76a5

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

lib/msf/core/exploit/ftpserver.rb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ def initialize(info = {})
2626
], Msf::Exploit::Remote::FtpServer)
2727
end
2828

29+
# (see Msf::Exploit#setup)
2930
def setup
3031
super
3132
@state = {}
3233
end
3334

35+
# (see TcpServer#on_client_connect)
3436
def on_client_connect(c)
3537
@state[c] = {
3638
:name => "#{c.peerhost}:#{c.peerport}",
@@ -46,6 +48,25 @@ def on_client_connect(c)
4648
c.put "220 FTP Server Ready\r\n"
4749
end
4850

51+
# Dispatches client requests to command handlers.
52+
#
53+
# Handlers should be named +on_client_command_*+, ending with a
54+
# downcased FTP verb, e.g. +on_client_command_user+. If no handler
55+
# exists for the given command, returns a generic default response.
56+
#
57+
# @example Handle SYST requests
58+
# class Metasploit4 < Msf::Exploit
59+
# include Msf::Exploit::Remote::FtpServer
60+
# ...
61+
# def on_client_command_syst(cmd_conn, arg)
62+
# print_status("Responding to SYST request")
63+
# buf = build_exploit_buffer(cmd_conn)
64+
# cmd_conn.put("215 Unix Type: #{buf}\r\n")
65+
# end
66+
# end
67+
#
68+
# @param (see TcpServer#on_client_data)
69+
# @return (see TcpServer#on_client_data)
4970
def on_client_data(c)
5071
data = c.get_once
5172
return if not data
@@ -184,6 +205,15 @@ def active_data_port_for_client(c,port)
184205
end
185206

186207

208+
# Create a socket for the protocol data, either PASV or PORT,
209+
# depending on the client.
210+
#
211+
# @see http://tools.ietf.org/html/rfc3659 RFC 3659
212+
# @see http://tools.ietf.org/html/rfc959 RFC 959
213+
# @param c [Socket] Control connection socket
214+
#
215+
# @return [Socket] A connected socket for the data connection
216+
# @return [nil] on failure
187217
def establish_data_connection(c)
188218
begin
189219
Timeout.timeout(20) do

0 commit comments

Comments
 (0)