From 5e7341783aa2f75e8915a5352f96177033ef67a9 Mon Sep 17 00:00:00 2001 From: Jack Biggs Date: Thu, 11 May 2023 22:35:42 +0100 Subject: [PATCH] new file: modules/generators/messages/randsom_note/ransom_note.pp new file: modules/generators/messages/randsom_note/secgen_local/local.rb new file: modules/generators/messages/randsom_note/secgen_metadata.xml new file: modules/generators/messages/randsom_note/templates/ransom_note.md.erb Initial Push for Ransom Note --- .../messages/randsom_note/ransom_note.pp | 0 .../randsom_note/secgen_local/local.rb | 45 +++++++++++++++++++ .../messages/randsom_note/secgen_metadata.xml | 19 ++++++++ .../randsom_note/templates/ransom_note.md.erb | 13 ++++++ 4 files changed, 77 insertions(+) create mode 100644 modules/generators/messages/randsom_note/ransom_note.pp create mode 100644 modules/generators/messages/randsom_note/secgen_local/local.rb create mode 100644 modules/generators/messages/randsom_note/secgen_metadata.xml create mode 100644 modules/generators/messages/randsom_note/templates/ransom_note.md.erb diff --git a/modules/generators/messages/randsom_note/ransom_note.pp b/modules/generators/messages/randsom_note/ransom_note.pp new file mode 100644 index 000000000..e69de29bb diff --git a/modules/generators/messages/randsom_note/secgen_local/local.rb b/modules/generators/messages/randsom_note/secgen_local/local.rb new file mode 100644 index 000000000..99d7dfdcb --- /dev/null +++ b/modules/generators/messages/randsom_note/secgen_local/local.rb @@ -0,0 +1,45 @@ +#!/usr/bin/ruby +require_relative '../../../../../lib/objects/local_string_generator.rb' +require 'erb' +require 'fileutils' +class RansomNoteGenerator < StringGenerator + attr_accessor :name + LOCAL_DIR = File.expand_path('../../',__FILE__) + TEMPLATE_PATH = "#{LOCAL_DIR}/templates/ransom_note.md.erb" + + def initialize + super + self.name = '' + end + + def get_options_array + super + [['--name', GetoptLong::OPTIONAL_ARGUMENT]] + end + + def process_options(opt, arg) + super + case opt + when '--name' + self.name << arg; + end + end + +def generate + + #template_out = ERB.new(File.read(TEMPLATE_PATH), 0, '<>-') + #self.outputs << template.out_result(self.get_binding) + 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 + +RansomNoteGenerator.new.run + diff --git a/modules/generators/messages/randsom_note/secgen_metadata.xml b/modules/generators/messages/randsom_note/secgen_metadata.xml new file mode 100644 index 000000000..5dea2bd72 --- /dev/null +++ b/modules/generators/messages/randsom_note/secgen_metadata.xml @@ -0,0 +1,19 @@ + + + + + Ransom Note Generator + Jack Biggs + MIT + Creates a file in which a ransom note resides. + + string_generator + local_calculation + linux + + name + + generated_strings + diff --git a/modules/generators/messages/randsom_note/templates/ransom_note.md.erb b/modules/generators/messages/randsom_note/templates/ransom_note.md.erb new file mode 100644 index 000000000..5ec1abe08 --- /dev/null +++ b/modules/generators/messages/randsom_note/templates/ransom_note.md.erb @@ -0,0 +1,13 @@ +#Ransom: + +Dear Sir/Madam: + +As you no doubt know by this time, your child, <%= self.name %> has been kidnapped. Allow us to assure you that he is at present well and safe. You need fear no physical harm for him, provided you listen up carefully to the following instructions and to such others as you will receive by future communications. Should you, however, disobey any of our instructions, even slightly, his death will be the penalty. + +###1. For obvious reasons make absolutely no attempt to communicate with either police authorities or any private agency. Should you already have communicated with the police, allow them to continue their investigations, but do not mention this letter. + +###2. Secure before noon today £10,000. This money must be composed entirely of old bills of the following denominations: £2000 in £20 bills, £8000 in £50 bills. The money must be old. Any attempt to include new or marked bills will render the entire venture futile. + +###3. The money should be placed in a large cigar box, or if this is impossible, in a heavy cardboard box, securely closed and wrapped in white paper. The wrapping paper should be sealed at all openings with sealing wax. + +###4. Have the money with you, prepared as directed above, and remain at home after one o'clock. See that the telephone is not in use."