Skip to content

Commit 5dcf573

Browse files
David MaloneyDavid Maloney
authored andcommitted
TLV tests down, on to GroupTlv
1 parent 391ff5b commit 5dcf573

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

spec/lib/rex/post/meterpreter/packet_spec.rb

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,37 @@
9090
end
9191
end
9292

93-
end
93+
context "A Method TLV" do
94+
subject{Rex::Post::Meterpreter::Tlv.new(Rex::Post::Meterpreter::TLV_TYPE_METHOD,"test")}
95+
it "should return true when checked for a meta type of String" do
96+
subject.meta_type?(Rex::Post::Meterpreter::TLV_META_TYPE_STRING).should == true
97+
end
98+
99+
it "should show the correct type and meta type in inspect" do
100+
tlv_to_s = "#<Rex::Post::Meterpreter::Tlv type=METHOD meta=STRING value=\"test\">"
101+
subject.inspect.should == tlv_to_s
102+
end
103+
end
104+
105+
context "A String TLV with a number value" do
106+
subject{Rex::Post::Meterpreter::Tlv.new(Rex::Post::Meterpreter::TLV_TYPE_STRING,5)}
107+
it "should return the string version of the number" do
108+
subject.value.should == "5"
109+
end
110+
end
111+
112+
end
113+
114+
describe Rex::Post::Meterpreter::GroupTlv do
115+
subject{Rex::Post::Meterpreter::GroupTlv.new(Rex::Post::Meterpreter::TLV_TYPE_CHANNEL_DATA_GROUP)}
116+
117+
it "should respond to tlvs" do
118+
subject.should respond_to :tlvs
119+
end
120+
121+
it "should return an empty array for tlvs by default" do
122+
subject.tlvs.should == []
123+
end
124+
125+
126+
end

0 commit comments

Comments
 (0)