class BotnetV2::BotnetV2
Public Class Methods
create_certificate(private_path = 'private.pem', cert_path = 'cert.pem', country = 'DE', organization = 'none', organization_unit = 'none', common_name = 'botnet_v2')
click to toggle source
# File lib/BotnetV2.rb, line 26 def self.create_certificate(private_path = 'private.pem', cert_path = 'cert.pem', country = 'DE', organization = 'none', organization_unit = 'none', common_name = 'botnet_v2') key = OpenSSL::PKey::RSA.new(1024) public_key = key.public_key subject = '/C='+country+'/O='+organization+'/OU='+organization_unit+'/CN='+common_name cert = OpenSSL::X509::Certificate.new cert.subject = cert.issuer = OpenSSL::X509::Name.parse(subject) cert.not_before = Time.now cert.not_after = Time.now + 365 * 24 * 60 * 60 cert.public_key = public_key cert.serial = 0x0 cert.version = 2 ef = OpenSSL::X509::ExtensionFactory.new ef.subject_certificate = cert ef.issuer_certificate = cert cert.extensions = [ ef.create_extension('basicConstraints','CA:TRUE', true), ef.create_extension('subjectKeyIdentifier', 'hash') ] cert.add_extension ef.create_extension('authorityKeyIdentifier', 'keyid:always,issuer:always') cert.sign key, OpenSSL::Digest::SHA1.new open (private_path), 'w' do |io| io.write key end open (cert_path), 'w' do |io| io.write cert.to_pem end end
create_client(password, client_id, host, port = 8008, ssl = true)
click to toggle source
# File lib/BotnetV2.rb, line 18 def self.create_client(password, client_id, host, port = 8008, ssl = true) Client.new password, client_id, host, port, ssl end
create_master(password, ssl_port = 8008, no_ssl_port = 8009, ssl = true, hybrid_mode = false)
click to toggle source
# File lib/BotnetV2.rb, line 14 def self.create_master(password, ssl_port = 8008, no_ssl_port = 8009, ssl = true, hybrid_mode = false) Master.new password, ssl_port, no_ssl_port, ssl, hybrid_mode end
create_worker(password, host, port = 8008, ssl = true)
click to toggle source
# File lib/BotnetV2.rb, line 22 def self.create_worker(password, host, port = 8008, ssl = true) Worker.new password, host, port, ssl end