modified: modules/generators/config_files/filezilla_config/secgen_local/local.rb

modified:   modules/generators/config_files/filezilla_config/templates/filezilla_config.xml.erb
Updated the config file to the correct file as well as updated the parameters required
This commit is contained in:
Jack Biggs
2023-05-12 13:59:08 +01:00
parent 7b7daf83ce
commit ef16a3f55d
2 changed files with 78 additions and 171 deletions

View File

@@ -3,43 +3,41 @@ require_relative '../../../../../lib/objects/local_string_generator.rb'
require 'erb'
require 'fileutils'
class FilezillaConfigFileGenerator < StringGenerator
attr_accessor :ftp_user
attr_accessor :ftp_pass
attr_accessor :proxy_user
attr_accessor :proxy_pass
attr_accessor :name
attr_accessor :host
attr_accessor :port
attr_accessor :password
LOCAL_DIR = File.expand_path('../../',__FILE__)
TEMPLATE_PATH = "#{LOCAL_DIR}/templates/filezilla_config.md.erb"
TEMPLATE_PATH = "#{LOCAL_DIR}/templates/filezilla_config.xml.erb"
def initialize
super
self.ftp_user = 'admin'
self.ftp_pass = 'admin'
self.proxy_user = ''
self.proxy_pass = ''
self.name = ''
self.host = ''
self.port = ''
self.password = ''
end
def get_options_array
super + [['--ftp_user', GetoptLong::REQUIRED_ARGUMENT],
['--ftp_pass', GetoptLong::REQUIRED_ARGUMENT],
['--proxy_user', GetoptLong::OPTIONAL_ARGUMENT],
['--proxy_pass', GetoptLong::OPTIONAL_ARGUMENT]]
super + [['--host', GetoptLong::REQUIRED_ARGUMENT],
['--port', GetoptLong::OPTIONAL_ARGUMENT],
['--password', GetoptLong::OPTIONAL_ARGUMENT]]
end
def process_options(opt, arg)
super
case opt
when '--ftp_user'
self.ftp_user << arg;
when '--ftp_pass'
self.ftp_pass << arg;
when '--proxy_user'
self.proxy_user << arg;
when '--proxy_pass'
self.proxy_pass << arg;
end
when '--host'
self.host << arg;
when '--port'
self.port << arg;
when '--password'
self.password << arg;
end
end
def generate
self.name = "#{self.host}:#{self.port}"
template_out = ERB.new(File.read(TEMPLATE_PATH), 0, '<>-')
self.outputs << template_out.result(self.get_binding)
end

View File

@@ -1,149 +1,58 @@
<FileZilla3 version="3.60.2" platform="*nix">
<Settings>
<Setting name="Use Pasv mode">1</Setting>
<Setting name="Limit local ports">0</Setting>
<Setting name="Limit ports low">6000</Setting>
<Setting name="Limit ports high">7000</Setting>
<Setting name="Limit ports offset">0</Setting>
<Setting name="External IP mode">0</Setting>
<Setting name="External IP"/>
<Setting name="External address resolver">http://ip.filezilla-project.org/ip.php</Setting>
<Setting name="Last resolved IP"/>
<Setting name="No external ip on local conn">1</Setting>
<Setting name="Pasv reply fallback mode">0</Setting>
<Setting name="Timeout">20</Setting>
<Setting name="Logging Debug Level">0</Setting>
<Setting name="Logging Raw Listing">0</Setting>
<Setting name="Allow transfermode fallback">1</Setting>
<Setting name="Reconnect count">2</Setting>
<Setting name="Reconnect delay">5</Setting>
<Setting name="Enable speed limits">0</Setting>
<Setting name="Speedlimit inbound">1000</Setting>
<Setting name="Speedlimit outbound">100</Setting>
<Setting name="Speedlimit burst tolerance">0</Setting>
<Setting name="Preallocate space">0</Setting>
<Setting name="View hidden files">0</Setting>
<Setting name="Preserve timestamps">0</Setting>
<Setting name="Socket recv buffer size (v2)">4194304</Setting>
<Setting name="Socket send buffer size (v2)">262144</Setting>
<Setting name="FTP Keep-alive commands">0</Setting>
<Setting name="FTP Proxy type">0</Setting>
<Setting name="FTP Proxy host"/>
<Setting name="FTP Proxy user"><%= self.ftp_user %></Setting>
<Setting name="FTP Proxy password"><%= self.ftp_pass %></Setting>
<Setting name="FTP Proxy login sequence"/>
<Setting name="SFTP keyfiles" platform="unix"/>
<Setting name="SFTP compression">0</Setting>
<Setting name="Proxy type">0</Setting>
<Setting name="Proxy host"/>
<Setting name="Proxy port">0</Setting>
<Setting name="Proxy user"><%= self.proxy_user %></Setting>
<Setting name="Proxy password"><%= self.proxy_pass %></Setting>
<Setting name="Logging file" platform="unix"/>
<Setting name="Logging filesize limit">10</Setting>
<Setting name="Size format">0</Setting>
<Setting name="Size thousands separator">1</Setting>
<Setting name="Size decimal places">1</Setting>
<Setting name="TCP Keepalive Interval">15</Setting>
<Setting name="Cache TTL">600</Setting>
<Setting name="Minimum TLS Version">2</Setting>
<Setting name="Kiosk mode">0</Setting>
<Setting name="Master password encryptor"/>
<Setting name="Trust system trust store">0</Setting>
<Setting name="Ascii Binary mode">0</Setting>
<Setting name="Auto Ascii files">
ac|am|asp|bat|c|cfm|cgi|conf|cpp|css|dhtml|diff|diz|h|hpp|htm|html|in|inc|java|js|jsp|lua|m4|mak|md5|nfo|nsh|nsi|pas|patch|pem|php|phtml|pl|po|pot|py|qmail|sh|sha1|sha256|sha512|shtml|sql|svg|tcl|tpl|txt|vbs|xhtml|xml|xrc
</Setting>
<Setting name="Auto Ascii no extension">1</Setting>
<Setting name="Auto Ascii dotfiles">1</Setting>
<Setting name="Comparison threshold">1</Setting>
<Setting name="Cache directory" platform="unix"/>
<Setting name="Number of Transfers">2</Setting>
<Setting name="Language Code"/>
<Setting name="Concurrent download limit">0</Setting>
<Setting name="Concurrent upload limit">0</Setting>
<Setting name="Show debug menu">0</Setting>
<Setting name="File exists action download">0</Setting>
<Setting name="File exists action upload">0</Setting>
<Setting name="Allow ascii resume">0</Setting>
<Setting name="Greeting resources"/>
<Setting name="Onetime Dialogs"/>
<Setting name="Show Tree Local">1</Setting>
<Setting name="Show Tree Remote">1</Setting>
<Setting name="File Pane Layout">0</Setting>
<Setting name="File Pane Swap">0</Setting>
<Setting name="Filelist directory sort">0</Setting>
<Setting name="Filelist name sort">1</Setting>
<Setting name="Queue successful autoclear">0</Setting>
<Setting name="Time Format"/>
<Setting name="Date Format"/>
<Setting name="Show message log">1</Setting>
<Setting name="Show queue">1</Setting>
<Setting name="Default editor" platform="unix"/>
<Setting name="Always use default editor">0</Setting>
<Setting name="File associations (v2)" platform="unix"/>
<Setting name="Comparison mode">1</Setting>
<Setting name="Site Manager position"/>
<Setting name="Icon theme">default</Setting>
<Setting name="Icon scale">125</Setting>
<Setting name="Timestamp in message log">0</Setting>
<Setting name="Sitemanager last selected"/>
<Setting name="Filelist status bar">1</Setting>
<Setting name="Filter toggle state">0</Setting>
<Setting name="Show quickconnect bar">1</Setting>
<Setting name="Messagelog position">0</Setting>
<Setting name="File doubleclick action">0</Setting>
<Setting name="Dir doubleclick action">0</Setting>
<Setting name="Minimize to tray">0</Setting>
<Setting name="Search column widths"/>
<Setting name="Search column shown"/>
<Setting name="Search column order"/>
<Setting name="Search window size"/>
<Setting name="Comparison hide identical">0</Setting>
<Setting name="Search sort order"/>
<Setting name="Edit track local">1</Setting>
<Setting name="Prevent idle sleep">1</Setting>
<Setting name="Filteredit window size"/>
<Setting name="Enable invalid char filter">1</Setting>
<Setting name="Invalid char replace">_</Setting>
<Setting name="Already connected choice">0</Setting>
<Setting name="Edit status dialog size"/>
<Setting name="Display current speed">0</Setting>
<Setting name="Toolbar hidden">0</Setting>
<Setting name="Strip VMS revisions">0</Setting>
<Setting name="Startup action">0</Setting>
<Setting name="Persistent Choices">0</Setting>
<Setting name="Queue completion action">1</Setting>
<Setting name="Queue completion command"/>
<Setting name="Drag and Drop disabled">0</Setting>
<Setting name="Disable update footer">0</Setting>
<Setting name="Highest shown overlay id">0</Setting>
<Setting name="Greeting version">3.60.2</Setting>
<Setting name="Prompt password save">1</Setting>
<Setting name="Queue column widths">180 60 180 80 60 150</Setting>
<Setting name="Local filelist colwidths">170 80 120 120</Setting>
<Setting name="Remote filelist colwidths">150 75 80 100 80 85</Setting>
<Setting name="Window position and size">0 680 262 1190 825 </Setting>
<Setting name="Splitter positions (v2)">97 -130 500000000 233 233 500000000</Setting>
<Setting name="Local filelist shown columns">1111</Setting>
<Setting name="Remote filelist shown columns">111111</Setting>
<Setting name="Local filelist column order">0,1,2,3</Setting>
<Setting name="Remote filelist column order">0,1,2,3,4,5</Setting>
<Setting name="Tab data" sensitive="1">
<Tabs>
<Tab selected="1">
<Host/>
<Port>21</Port>
<Protocol>-1</Protocol>
<Logontype>0</Logontype>
<BypassProxy>0</BypassProxy>
<Site/>
<RemotePath/>
<LocalPath>/home/jack/</LocalPath>
</Tab>
</Tabs>
</Setting>
<Setting name="Local filelist sortorder">0 0</Setting>
<Setting name="Remote filelist sortorder">0 0</Setting>
</Settings>
</FileZilla3>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<filezilla xmlns:fz="https://filezilla-project.org" xmlns="https://filezilla-project.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" fz:product_flavour="standard" fz:product_version="1.7.0">
<!--Information about the FileZilla FTP servers to connect to.-->
<server>
<name><%= self.name %></name>
<host><%= self.host %></host>
<port><%= self.port %></port>
<password><%= self.password %></password>
<fingerprint>39:82:b8:b9:de:11:50:7c:bf:ba:cd:88:90:9d:a0:56:f1:19:cf:11:23:61:aa:aa:6c:cf:a3:4f:7f:32:9b:9a</fingerprint>
</server>
<autoconnect_to_server></autoconnect_to_server>
<last_connected_server><%= self.name %></last_connected_server>
<!--Logging options-->
<logger>
<!--The name of the log file. If empty, the log goes to stderr.-->
<name></name>
<!--The maximum number of files to be used for the log rotation. Default is 0, meaning no rotation happens.-->
<max_amount_of_rotated_files>0</max_amount_of_rotated_files>
<!--The maximum size each log file can reach before being closed and a new one being opened. Only meaningful if max_amount_of_rotated_files > 0.-->
<max_file_size>9223372036854775807</max_file_size>
<!--Which types of logs must be enabled. Defaults to error|status|reply|command . See <libfilezilla/logger.hpp> for the values of the various types.-->
<enabled_types>4294967311</enabled_types>
<!--Criteria used to rotate files. Currently: size-based (0) or daily rotation (1).-->
<rotation_type>0</rotation_type>
<!--Include headers for each line of logging (date&time and possibly others). Set it to false if you have your own way of tagging log lines. Default is true.-->
<include_headers>true</include_headers>
<!--Append the date of the log file to its name when rotating, before any suffix the name might have.-->
<date_in_name>false</date_in_name>
</logger>
<!--The GUI's locale. By default, the one defined by the appropriate environment variables is used.-->
<locale></locale>
<!--True if the UI window has to be started in minimized mode, false otherwise.-->
<start_minimized>false</start_minimized>
<!--Tray icon mode: one of 0 (disabled), 1 (enabled), 2 (enabled, minimize to tray).-->
<tray_icon_mode>1</tray_icon_mode>
<!--True if the mount table editor has to warn about being cautious when setting up native paths.-->
<!--Working directory-->
<!--Directory where updates will be downloaded-->
<!--True if the updates must be automatically downloaded where <updates_dir> states. If <updates_dir> is empty, no download will happen.-->
<!--Position and sizes of the app windows. The geometry spec is as follows: [display_id:][width{xX}height][{+-}xoff{+-}yoff]. Display_id and xy offsets only apply to top windows.-->
<geometry name="MainFrame" maximized="false">960x540+3040+450</geometry>
<!--Properties of the columns of the named grid or listctl.-->
<columns name="SessionList">
<!--Minimum widths of the columns, separated by spaces or commas.-->
<min_widths></min_widths>
<!--Actual widths of the columns, separated by spaces or commas.-->
<widths></widths>
</columns>
<columns name="ServerLogger::List">
<!--Minimum widths of the columns, separated by spaces or commas.-->
<min_widths></min_widths>
<!--Actual widths of the columns, separated by spaces or commas.-->
<widths></widths>
</columns>
<!--Position of the sash in the named splitted window.-->
<sash name="ServerAdministrator">-2147483648</sash>
</filezilla>