mirror of
https://github.com/cliffe/SecGen.git
synced 2026-02-21 11:18:06 +00:00
generators/flag/flag_concat: joins strings and wraps in flag{}
This commit is contained in:
0
modules/generators/flag/flag_concat/flag_concat.pp
Normal file
0
modules/generators/flag/flag_concat/flag_concat.pp
Normal file
34
modules/generators/flag/flag_concat/secgen_local/local.rb
Normal file
34
modules/generators/flag/flag_concat/secgen_local/local.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/ruby
|
||||
require_relative '../../../../../lib/objects/local_string_encoder.rb'
|
||||
class ConcatFlagGenerator < StringEncoder
|
||||
attr_accessor :strings_to_join
|
||||
|
||||
def initialize
|
||||
super
|
||||
self.module_name = 'Concat Flag Generator'
|
||||
self.strings_to_join = []
|
||||
end
|
||||
|
||||
def encode_all
|
||||
contents = self.strings_to_join.join(' ')
|
||||
self.outputs << "flag{#{contents}}"
|
||||
end
|
||||
|
||||
def get_options_array
|
||||
super + [['--strings_to_join', GetoptLong::REQUIRED_ARGUMENT]]
|
||||
end
|
||||
|
||||
def process_options(opt, arg)
|
||||
super
|
||||
case opt
|
||||
when '--strings_to_join'
|
||||
self.strings_to_join << arg;
|
||||
end
|
||||
end
|
||||
|
||||
def encoding_print_string
|
||||
'strings_to_join: ' + self.strings_to_join.to_s
|
||||
end
|
||||
end
|
||||
|
||||
ConcatFlagGenerator.new.run
|
||||
26
modules/generators/flag/flag_concat/secgen_metadata.xml
Normal file
26
modules/generators/flag/flag_concat/secgen_metadata.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<generator xmlns="http://www.github/cliffe/SecGen/generator"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.github/cliffe/SecGen/generator">
|
||||
<name>Concatenated Flag Generator</name>
|
||||
<author>Thomas Shaw</author>
|
||||
<module_license>MIT</module_license>
|
||||
<description>Concatenates the contents of strings_to_join, separated with a space, outputs flag{result}.</description>
|
||||
|
||||
<type>flag_generator</type>
|
||||
<type>concat_flag_generator</type>
|
||||
<type>local_calculation</type>
|
||||
<platform>linux</platform>
|
||||
<platform>windows</platform>
|
||||
|
||||
<read_fact>strings_to_join</read_fact>
|
||||
|
||||
<default_input into="strings_to_join">
|
||||
<generator type="random_word_generator"/>
|
||||
<generator type="random_word_generator"/>
|
||||
</default_input>
|
||||
|
||||
<output_type>generated_strings</output_type>
|
||||
|
||||
</generator>
|
||||
Reference in New Issue
Block a user