encoders/string/binary: ASCII to Binary encoder

This commit is contained in:
thomashaw
2017-03-16 10:29:07 +00:00
parent 41bbb34649
commit 23fcdb626c
5 changed files with 61 additions and 0 deletions

View File

View File

@@ -0,0 +1,15 @@
#!/usr/bin/ruby
require 'base64'
require_relative '../../../../../lib/objects/local_string_encoder.rb'
class BinaryEncoder < StringEncoder
def initialize
super
self.module_name = 'Binary Encoder'
end
def encode(str)
str.unpack('B*').first
end
end
BinaryEncoder.new.run

View File

@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<encoder xmlns="http://www.github/cliffe/SecGen/encoder"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/encoder">
<name>Binary Encoder</name>
<author>Thomas Shaw</author>
<module_license>MIT</module_license>
<description>Converts a String to Binary.</description>
<type>ascii_reversable</type>
<type>binary_encoder</type>
<type>string_encoder</type>
<platform>linux</platform>
<platform>windows</platform>
<read_fact>strings_to_encode</read_fact>
<output_type>encoded_strings</output_type>
</encoder>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0"?>
<scenario xmlns="http://www.github/cliffe/SecGen/scenario"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.github/cliffe/SecGen/scenario">
<system>
<system_name>example_server</system_name>
<base platform="linux"/>
<!--select a vulnerability that leaks strings-->
<vulnerability read_fact="strings_to_leak">
<!--direct the output from below into strings_to_leak-->
<input into="strings_to_leak">
<encoder type="binary_encoder">
<input into="strings_to_encode">
<generator type="flag_generator"/>
</input>
</encoder>
</input>
</vulnerability>
<network type="private_network" range="dhcp"/>
</system>
</scenario>