Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/spec/lib/rex/proto/kerberos/model/ticket_spec.rb
Views: 11791
# -*- coding:binary -*-1require 'spec_helper'234RSpec.describe Rex::Proto::Kerberos::Model::Ticket do56subject(:ticket) do7described_class.new8end910=begin11#<OpenSSL::ASN1::ASN1Data:0x007f93b206ed7812@infinite_length=false,13@tag=1,14@tag_class=:APPLICATION,15@value=16[#<OpenSSL::ASN1::Sequence:0x007f93b206eda017@infinite_length=false,18@tag=16,19@tag_class=:UNIVERSAL,20@tagging=nil,21@value=22[#<OpenSSL::ASN1::ASN1Data:0x007f93b2094ca823@infinite_length=false,24@tag=0,25@tag_class=:CONTEXT_SPECIFIC,26@value=27[#<OpenSSL::ASN1::Integer:0x007f93b2094cd028@infinite_length=false,29@tag=2,30@tag_class=:UNIVERSAL,31@tagging=nil,32@value=#<OpenSSL::BN:0x007f93b2094e10>>]>,33#<OpenSSL::ASN1::ASN1Data:0x007f93b2094b9034@infinite_length=false,35@tag=1,36@tag_class=:CONTEXT_SPECIFIC,37@value=38[#<OpenSSL::ASN1::GeneralString:0x007f93b2094bb839@infinite_length=false,40@tag=27,41@tag_class=:UNIVERSAL,42@tagging=nil,43@value="DEMO.LOCAL">]>,44#<OpenSSL::ASN1::ASN1Data:0x007f93b209407845@infinite_length=false,46@tag=2,47@tag_class=:CONTEXT_SPECIFIC,48@value=49[#<OpenSSL::ASN1::Sequence:0x007f93b209423050@infinite_length=false,51@tag=16,52@tag_class=:UNIVERSAL,53@tagging=nil,54@value=55[#<OpenSSL::ASN1::ASN1Data:0x007f93b209487056@infinite_length=false,57@tag=0,58@tag_class=:CONTEXT_SPECIFIC,59@value=60[#<OpenSSL::ASN1::Integer:0x007f93b20948c061@infinite_length=false,62@tag=2,63@tag_class=:UNIVERSAL,64@tagging=nil,65@value=#<OpenSSL::BN:0x007f93b2094988>>]>,66#<OpenSSL::ASN1::ASN1Data:0x007f93b209428067@infinite_length=false,68@tag=1,69@tag_class=:CONTEXT_SPECIFIC,70@value=71[#<OpenSSL::ASN1::Sequence:0x007f93b20943e872@infinite_length=false,73@tag=16,74@tag_class=:UNIVERSAL,75@tagging=nil,76@value=77[#<OpenSSL::ASN1::GeneralString:0x007f93b20944d878@infinite_length=false,79@tag=27,80@tag_class=:UNIVERSAL,81@tagging=nil,82@value="krbtgt">,83#<OpenSSL::ASN1::GeneralString:0x007f93b209441084@infinite_length=false,85@tag=27,86@tag_class=:UNIVERSAL,87@tagging=nil,88@value="DEMO.LOCAL">]>]>]>]>,89#<OpenSSL::ASN1::ASN1Data:0x007f93b206f72890@infinite_length=false,91@tag=3,92@tag_class=:CONTEXT_SPECIFIC,93@value=94[#<OpenSSL::ASN1::Sequence:0x007f93b206f8e095@infinite_length=false,96@tag=16,97@tag_class=:UNIVERSAL,98@tagging=nil,99@value=100[#<OpenSSL::ASN1::ASN1Data:0x007f93b206fbd8101@infinite_length=false,102@tag=0,103@tag_class=:CONTEXT_SPECIFIC,104@value=105[#<OpenSSL::ASN1::Integer:0x007f93b206fc28106@infinite_length=false,107@tag=2,108@tag_class=:UNIVERSAL,109@tagging=nil,110@value=#<OpenSSL::BN:0x007f93b206fc50>>]>,111#<OpenSSL::ASN1::ASN1Data:0x007f93b206fae8112@infinite_length=false,113@tag=1,114@tag_class=:CONTEXT_SPECIFIC,115@value=116[#<OpenSSL::ASN1::Integer:0x007f93b206fb60117@infinite_length=false,118@tag=2,119@tag_class=:UNIVERSAL,120@tagging=nil,121@value=#<OpenSSL::BN:0x007f93b206fb88>>]>,122#<OpenSSL::ASN1::ASN1Data:0x007f93b206f9f8123@infinite_length=false,124@tag=2,125@tag_class=:CONTEXT_SPECIFIC,126@value=127[#<OpenSSL::ASN1::OctetString:0x007f93b206fa20128@infinite_length=false,129@tag=4,130@tag_class=:UNIVERSAL,131@tagging=nil,132@value=133"U\xE7E\xC3o\xA2(G\xAB\x9C\x86\x13\xEB\x1D\xA8\x98\xECg\x1C\x1F\x15Fk\xE0J\xF2M=\xF7\xE41zO\x15/`\xDD\x98\xA8\xE1\x97ko\xC1$Fl\xA9\x1E\xE26'\xE3\xFA\x99\f\x9Bw\f\xE2X\x02h\xC4T*,]lK\xC8\xBC\x04\x8F\nD'x\xDCK>\x01\xBE\xAC\xF7\x8EzP\xC6>w\xD9e$\xD5\x1A\x18\xA1\x84q\x85\x98/T\x8BV\xE3\xFB,\xE20\x84\x06UU\xEA1\x8B\x84\x00\xE3\x1A\xC3\xA8\xC2\xAC\xC0x?Ght\xCCb\xA6\xCF\xF4k\xAE\xAF'\xDE\x1AM\xB7\xA8\x9Fvzy*B\x12{\xD2\xBE\xC9\x98|D8@\xBDI\xCD>\xDCe\xC7\x8BD\xF5\xA5\xD4f\x0E\xFDX\x9D19'\xD7\xFC\x81\a\xA3*\x1C<">]>]>]>]>]>134=end135let(:as_ticket) do136"\x61\x82\x01\x0c" +137"\x30\x82\x01\x08\xa0\x03\x02\x01\x05\xa1\x0c\x1b\x0a\x44\x45\x4d" +138"\x4f\x2e\x4c\x4f\x43\x41\x4c\xa2\x1f\x30\x1d\xa0\x03\x02\x01\x01" +139"\xa1\x16\x30\x14\x1b\x06\x6b\x72\x62\x74\x67\x74\x1b\x0a\x44\x45" +140"\x4d\x4f\x2e\x4c\x4f\x43\x41\x4c\xa3\x81\xd1\x30\x81\xce\xa0\x03" +141"\x02\x01\x17\xa1\x03\x02\x01\x02\xa2\x81\xc1\x04\x81\xbe\x55\xe7" +142"\x45\xc3\x6f\xa2\x28\x47\xab\x9c\x86\x13\xeb\x1d\xa8\x98\xec\x67" +143"\x1c\x1f\x15\x46\x6b\xe0\x4a\xf2\x4d\x3d\xf7\xe4\x31\x7a\x4f\x15" +144"\x2f\x60\xdd\x98\xa8\xe1\x97\x6b\x6f\xc1\x24\x46\x6c\xa9\x1e\xe2" +145"\x36\x27\xe3\xfa\x99\x0c\x9b\x77\x0c\xe2\x58\x02\x68\xc4\x54\x2a" +146"\x2c\x5d\x6c\x4b\xc8\xbc\x04\x8f\x0a\x44\x27\x78\xdc\x4b\x3e\x01" +147"\xbe\xac\xf7\x8e\x7a\x50\xc6\x3e\x77\xd9\x65\x24\xd5\x1a\x18\xa1" +148"\x84\x71\x85\x98\x2f\x54\x8b\x56\xe3\xfb\x2c\xe2\x30\x84\x06\x55" +149"\x55\xea\x31\x8b\x84\x00\xe3\x1a\xc3\xa8\xc2\xac\xc0\x78\x3f\x47" +150"\x68\x74\xcc\x62\xa6\xcf\xf4\x6b\xae\xaf\x27\xde\x1a\x4d\xb7\xa8" +151"\x9f\x76\x7a\x79\x2a\x42\x12\x7b\xd2\xbe\xc9\x98\x7c\x44\x38\x40" +152"\xbd\x49\xcd\x3e\xdc\x65\xc7\x8b\x44\xf5\xa5\xd4\x66\x0e\xfd\x58" +153"\x9d\x31\x39\x27\xd7\xfc\x81\x07\xa3\x2a\x1c\x3c"154end155156describe "#decode" do157context "when decoding AS Response ticket" do158it "returns the Rex::Proto::Kerberos::Model::Ticket decoded" do159expect(ticket.decode(as_ticket)).to eq(ticket)160end161162it "decodes tkt_vno correctly" do163ticket.decode(as_ticket)164expect(ticket.tkt_vno).to eq(5)165end166167it "decodes realm correctly" do168ticket.decode(as_ticket)169expect(ticket.realm).to eq('DEMO.LOCAL')170end171172it "decodes sname correctly" do173ticket.decode(as_ticket)174expect(ticket.sname.name_string).to eq(['krbtgt', 'DEMO.LOCAL'])175end176177it "retrieves the encrypted part" do178ticket.decode(as_ticket)179expect(ticket.enc_part.cipher.length).to eq(190)180end181end182end183184describe "#encode" do185context "when encoding TGS Request ticket" do186it "re-encodes the AS-RESP ticket correctly" do187ticket.decode(as_ticket)188expect(ticket.encode).to eq(as_ticket)189end190end191end192193end194195196