From 7b7daf83ceee8d64712d583fbe6e1ec07f2900fd Mon Sep 17 00:00:00 2001 From: Jack Biggs Date: Fri, 10 Feb 2023 14:20:25 +0000 Subject: [PATCH] Filezilla Config File Generator --- .../filezilla_config/filezilla_config.pp | 0 .../filezilla_config/secgen_local/local.rb | 56 +++++++ .../filezilla_config/secgen_metadata.xml | 52 ++++++ .../templates/filezilla_config.xml.erb | 149 ++++++++++++++++++ 4 files changed, 257 insertions(+) create mode 100644 modules/generators/config_files/filezilla_config/filezilla_config.pp create mode 100644 modules/generators/config_files/filezilla_config/secgen_local/local.rb create mode 100644 modules/generators/config_files/filezilla_config/secgen_metadata.xml create mode 100644 modules/generators/config_files/filezilla_config/templates/filezilla_config.xml.erb diff --git a/modules/generators/config_files/filezilla_config/filezilla_config.pp b/modules/generators/config_files/filezilla_config/filezilla_config.pp new file mode 100644 index 000000000..e69de29bb diff --git a/modules/generators/config_files/filezilla_config/secgen_local/local.rb b/modules/generators/config_files/filezilla_config/secgen_local/local.rb new file mode 100644 index 000000000..97fd59825 --- /dev/null +++ b/modules/generators/config_files/filezilla_config/secgen_local/local.rb @@ -0,0 +1,56 @@ +#!/usr/bin/ruby +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 + LOCAL_DIR = File.expand_path('../../',__FILE__) + TEMPLATE_PATH = "#{LOCAL_DIR}/templates/filezilla_config.md.erb" + + def initialize + super + self.ftp_user = 'admin' + self.ftp_pass = 'admin' + self.proxy_user = '' + self.proxy_pass = '' + 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]] + 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 + end + def generate + + template_out = ERB.new(File.read(TEMPLATE_PATH), 0, '<>-') + self.outputs << template_out.result(self.get_binding) + end + + # Returns binding for erb files (access to variables in this classes scope) + # @return binding + def get_binding + binding + end +end + + +FilezillaConfigFileGenerator.new.run + diff --git a/modules/generators/config_files/filezilla_config/secgen_metadata.xml b/modules/generators/config_files/filezilla_config/secgen_metadata.xml new file mode 100644 index 000000000..41183325e --- /dev/null +++ b/modules/generators/config_files/filezilla_config/secgen_metadata.xml @@ -0,0 +1,52 @@ + + + + + Filezilla Config File Generator + Jack Biggs + MIT + Creates a Filezilla config file which includes either 1 or 2 sets of plaintext credentials + + string_generator + local_calculation + linux + + ftp_user + ftp_pass + ftp_user + ftp_pass + + + + + + Nothing to see here + + + + + + + + + + + + + + + + Nothing to see here + + + + + + + + + + generated_strings + diff --git a/modules/generators/config_files/filezilla_config/templates/filezilla_config.xml.erb b/modules/generators/config_files/filezilla_config/templates/filezilla_config.xml.erb new file mode 100644 index 000000000..a7f4c5f56 --- /dev/null +++ b/modules/generators/config_files/filezilla_config/templates/filezilla_config.xml.erb @@ -0,0 +1,149 @@ + + +1 +0 +6000 +7000 +0 +0 + +http://ip.filezilla-project.org/ip.php + +1 +0 +20 +0 +0 +1 +2 +5 +0 +1000 +100 +0 +0 +0 +0 +4194304 +262144 +0 +0 + +<%= self.ftp_user %> +<%= self.ftp_pass %> + + +0 +0 + +0 +<%= self.proxy_user %> +<%= self.proxy_pass %> + +10 +0 +1 +1 +15 +600 +2 +0 + +0 +0 + +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 + +1 +1 +1 + +2 + +0 +0 +0 +0 +0 +0 + + +1 +1 +0 +0 +0 +1 +0 + + +1 +1 + +0 + +1 + +default +125 +0 + +1 +0 +1 +0 +0 +0 +0 + + + + +0 + +1 +1 + +1 +_ +0 + +0 +0 +0 +0 +0 +1 + +0 +0 +0 +3.60.2 +1 +180 60 180 80 60 150 +170 80 120 120 +150 75 80 100 80 85 +0 680 262 1190 825 +97 -130 500000000 233 233 500000000 +1111 +111111 +0,1,2,3 +0,1,2,3,4,5 + + + + +21 +-1 +0 +0 + + +/home/jack/ + + + +0 0 +0 0 + +