# frozen_string_literal: true require 'json' module PWN module Reports # This plugin generates the War Dialing results produced by pwn_phone. module Phone # Supported Method Parameters:: # PWN::Reports::Phone.generate( # dir_path: dir_path, # results_hash: results_hash # ) public_class_method def self.generate(opts = {}) dir_path = opts[:dir_path].to_s if File.directory?(opts[:dir_path].to_s) raise "PWN Error: Invalid Directory #{dir_path}" if dir_path.nil? results_hash = opts[:results_hash] report_name = results_hash[:report_name] File.write( "#{dir_path}/#{report_name}.json", JSON.pretty_generate(results_hash) ) html_report = %q{

~ pwn phone





Toggle Column(s):  Call Started |  Source # |  Source # Rules |  Target # |  Seconds Recorded |  Call Stopped Reason Screenlog |  Recording |  Speech to Text |  Spectrogram |  Waveform


# Call Started Source # Source # Rules Target # Seconds Recorded Call Stopped Reason Stopped Screenlog Recording Speech to Text Spectrogram Waveform
} File.open("#{dir_path}/#{report_name}.html", 'w') do |f| f.print(html_report) end rescue StandardError => e raise e end # Author(s):: 0day Inc. public_class_method def self.authors "AUTHOR(S): 0day Inc. " end # Display Usage for this Module public_class_method def self.help puts "USAGE: #{self}.generate( dir_path: dir_path, results_hash: results_hash ) #{self}.authors " end end end end