From bc24abfb6fd523d4e5ecf8529d8ee625eefa8ae5 Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Wed, 26 Jun 2024 13:19:11 +0100 Subject: [PATCH] remove bitwise_xor fixes #158 --- .../cipher/bitwise_xor/bitwise_xor.pp | 0 .../cipher/bitwise_xor/manifests/.no_puppet | 0 .../cipher/bitwise_xor/secgen_local/local.rb | 45 ----------------- .../cipher/bitwise_xor/secgen_metadata.xml | 48 ------------------- 4 files changed, 93 deletions(-) delete mode 100644 modules/encoders/cipher/bitwise_xor/bitwise_xor.pp delete mode 100644 modules/encoders/cipher/bitwise_xor/manifests/.no_puppet delete mode 100644 modules/encoders/cipher/bitwise_xor/secgen_local/local.rb delete mode 100644 modules/encoders/cipher/bitwise_xor/secgen_metadata.xml diff --git a/modules/encoders/cipher/bitwise_xor/bitwise_xor.pp b/modules/encoders/cipher/bitwise_xor/bitwise_xor.pp deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/encoders/cipher/bitwise_xor/manifests/.no_puppet b/modules/encoders/cipher/bitwise_xor/manifests/.no_puppet deleted file mode 100644 index e69de29bb..000000000 diff --git a/modules/encoders/cipher/bitwise_xor/secgen_local/local.rb b/modules/encoders/cipher/bitwise_xor/secgen_local/local.rb deleted file mode 100644 index f9415a8ac..000000000 --- a/modules/encoders/cipher/bitwise_xor/secgen_local/local.rb +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/ruby -# Inputs: An ASCII string to mask -# Outputs: 2 bit stream strings which, when XOR'd together, result in the input string. -# Description: Input string is converted into a bit stream (String A) -# Random equivalent length bit stream is generated (String B) -# Strings A and B are XOR'd together to give us a third (String C) -# Strings B and C are returned. - -require_relative '../../../../../lib/objects/local_string_encoder.rb' -class BitwiseXORChallengeGenerator < StringEncoder - - def initialize - super - self.module_name = 'Bitwise XOR Challenge Generator' - end - - def encode(str) - number_of_bytes = str.length - - # String A: Convert input that we're hiding into binary - binary_string_to_mask = str.unpack('B*')[0] - - # String B: Generate bitstream - generated_bit_stream = [] - number_of_bytes.times do - generated_bit_stream << (1..8).map { [0, 1].sample }.join - end - generated_bit_stream = generated_bit_stream.join - - # bitwise xor - decimal_result = binary_string_to_mask.to_i(2) ^ generated_bit_stream.to_i(2) - - # Turn decimal result back into a string of bits - binary_string_c = decimal_result.to_s(2) - - # prepend leading 0's to the result - result = binary_string_c.to_s.rjust(number_of_bytes * 8, '0') - - # join the binary strings with an underscore - self.outputs << "#{generated_bit_stream}_#{result}" - end - -end - -BitwiseXORChallengeGenerator.new.run \ No newline at end of file diff --git a/modules/encoders/cipher/bitwise_xor/secgen_metadata.xml b/modules/encoders/cipher/bitwise_xor/secgen_metadata.xml deleted file mode 100644 index e2d379836..000000000 --- a/modules/encoders/cipher/bitwise_xor/secgen_metadata.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - Bitwise XOR Challenge encoder - Thomas Shaw - MIT - Binary bitwise XOR operation module. Takes a string input, generates a random bitstream of equal length., - XOR's the 2 strings, outputs the binary streams joined with an underscore. - - - ctf_challenge - ascii_reversible - string_encoder - local_calculation - linux - windows - high - - Perform a bitwise XOR on both strings - https://www.youtube.com/watch?v=YtghBxoBxpA - Example bitwise XOR tool: - http://www.mobilefish.com/services/big_number_bitwise_calculation/big_number_bitwise_calculation.php - Decode the result into it's ASCII representation. - - - strings_to_encode - - - - - - generated_strings - - - - - .* - - - - Encoding and alternative data formats - - - symmetric encryption and authentication - - -