Add support for PAC-SERVER-CHECKSUM

bug/bundler_fix
jvazquez-r7 2014-12-15 17:16:43 -06:00
parent 482c883d36
commit 64a0162e3f
3 changed files with 55 additions and 0 deletions

View File

@ -12,3 +12,4 @@ end
require 'rex/proto/kerberos/pac/element'
require 'rex/proto/kerberos/pac/priv_svr_checksum'
require 'rex/proto/kerberos/pac/server_checksum'

View File

@ -0,0 +1,28 @@
# -*- coding: binary -*-
module Rex
module Proto
module Kerberos
module Pac
class ServerChecksum < Element
# @!attribute version
# @return [Fixnum] The checksum type
attr_accessor :checksum
# Encodes the Rex::Proto::Kerberos::Pac::ServerChecksum
#
# @return [String]
def encode
encoded = ''
encoded << [checksum].pack('V')
encoded << "\x00" * 16
encoded
end
end
end
end
end
end

View File

@ -0,0 +1,26 @@
# -*- coding:binary -*-
require 'spec_helper'
require 'rex/proto/kerberos'
describe Rex::Proto::Kerberos::Pac::ServerChecksum do
subject(:server_checksum) do
described_class.new
end
let(:rsa_md5) { 7 }
let(:rsa_md5_sample) do
"\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
end
describe "#encode" do
context "when RSA-MD5 checksum" do
it "encodes the ServerChecksums correctly" do
server_checksum.checksum = rsa_md5
expect(server_checksum.encode).to eq(rsa_md5_sample)
end
end
end
end