class Vcsmap::Plugin::FilezillaXml

Public Class Methods

new() click to toggle source
# File lib/vcsmap/plugins/filezilla_xml.rb, line 4
def initialize
  @search_string = 'filename:filezilla.xml+Pass'
  @host_regex = /<Host>(.*)<\/Host>/
  @username_regex = /<User>(.*)<\/User>/
  @password_regex = /<Pass>(.*)<\/Pass>/
  @encoded_password_regex = /<Pass encoding="base64">(.*)<\/Pass>/
  @port_regex = /<Port>(.*)<\/Port>/
end

Public Instance Methods

credentials(file) click to toggle source
# File lib/vcsmap/plugins/filezilla_xml.rb, line 13
def credentials(file)
  @host = capture_match(@host_regex, file)
  @user = capture_match(@username_regex, file)
  @pass = find_password(file)
  @port = capture_match(@port_regex, file)
  ['FTP', @host, @port, @user, @pass]
end
table_header() click to toggle source
# File lib/vcsmap/plugins/filezilla_xml.rb, line 21
def table_header
  %w(Protocol Host Port Username Password)
end

Private Instance Methods

find_password(file) click to toggle source
# File lib/vcsmap/plugins/filezilla_xml.rb, line 27
def find_password(file)
  @pass = capture_match(@password_regex, file)
  @base64_pass = capture_match(@encoded_password_regex, file)

  return @pass unless @pass.empty?
  return Base64.decode64(@base64_pass) unless @base64_pass.empty?
  ''
end