lib/threat_agent/tasks/pwnxy.rb in threat_agent-1.0.0.beta.3 vs lib/threat_agent/tasks/pwnxy.rb in threat_agent-1.0.0.beta.4
- old
+ new
@@ -10,11 +10,11 @@
module Tasks
# A namespace for Pwnxy Thor tasks
#
# @author Erran Carey <me@errancarey.com>
class Pwnxy < Thor
- class_option :format, aliases: %w[-f], default: :readable, desc: 'The format to display data in'
+ class_option :format, aliases: %w[-f], default: 'json', desc: 'The format to display data in'
desc 'pwnxy info', 'List information on Pwnxy instances'
def info
info = $threat_agent_client.request(:pwnxy_info)
if options[:format].eql? 'json'
$stdout.puts info
@@ -75,10 +75,11 @@
end
end
no_commands do
def decrypt(logs)
- private_key = OpenSSL::PKey::RSA.new(ThreatAgent::Config[:private_key])
+ keypair = Cryptic::Keypair.new(ThreatAgent::Config[:private_key])
+ private_key = keypair.private_key
logs.map do |log|
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc')
cipher.decrypt
cipher.key = private_key.private_decrypt(Base64.decode64(log['encrypted_key']))