Module: Ronin::Support::Network::FTP::Mixin
- Defined in:
- lib/ronin/support/network/ftp/mixin.rb
Overview
Provides helper methods for communicating with FTP servers.
Constant Summary collapse
- DEFAULT_PORT =
Default FTP port
21
- DEFAULT_USER =
Default FTP user
'anonymous'
Instance Method Summary collapse
-
#ftp_connect(host, port: DEFAULT_PORT, user: DEFAULT_USER, password: nil, account: nil, passive: true) {|ftp| ... } ⇒ Net::FTP?
Creates a connection to the FTP server.
Instance Method Details
#ftp_connect(host, port: DEFAULT_PORT, user: DEFAULT_USER, password: nil, account: nil, passive: true) {|ftp| ... } ⇒ Net::FTP?
Creates a connection to the FTP server.
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/ronin/support/network/ftp/mixin.rb', line 83 def ftp_connect(host, port: DEFAULT_PORT, user: DEFAULT_USER, password: nil, account: nil, passive: true) host = DNS::IDN.to_ascii(host) ftp = Net::FTP.new ftp.connect(host,port) ftp.login(user,password,account) ftp.passive = passive if block_given? yield ftp ftp.close else return ftp end end |