|
4 | 4 |
|
5 | 5 |
|
6 | 6 | describe Rex::Post::Meterpreter::PacketParser do
|
7 |
| - subject{ |
| 7 | + subject(:parser){ |
8 | 8 | Rex::Post::Meterpreter::PacketParser.new
|
9 | 9 | }
|
10 | 10 | before(:each) do
|
|
18 | 18 | end
|
19 | 19 | end
|
20 | 20 |
|
21 |
| - it "should respond to cipher" do |
22 |
| - subject.should respond_to :cipher |
23 |
| - end |
24 |
| - |
25 |
| - it "should respond to raw" do |
26 |
| - subject.should respond_to :raw |
27 |
| - end |
28 |
| - |
29 |
| - it "should respond to reset" do |
30 |
| - subject.should respond_to :reset |
31 |
| - end |
32 |
| - |
33 |
| - it "should respond to recv" do |
34 |
| - subject.should respond_to :recv |
35 |
| - end |
36 |
| - |
37 |
| - it "should respond to hdr_length_left" do |
38 |
| - subject.should respond_to :hdr_length_left |
39 |
| - end |
40 |
| - |
41 |
| - it "should respond to payload_length_left" do |
42 |
| - subject.should respond_to :payload_length_left |
43 |
| - end |
44 |
| - |
45 | 21 | it "should initialise with expected defaults" do
|
46 |
| - subject.send(:raw).should == "" |
47 |
| - subject.send(:hdr_length_left).should == 8 |
48 |
| - subject.send(:payload_length_left).should == 0 |
| 22 | + parser.send(:raw).should == "" |
| 23 | + parser.send(:hdr_length_left).should == 8 |
| 24 | + parser.send(:payload_length_left).should == 0 |
49 | 25 | end
|
50 | 26 |
|
51 | 27 | it "should parse valid raw data into a packet object" do
|
52 | 28 | while @raw.length >0
|
53 |
| - parsed_packet = subject.recv(@sock) |
| 29 | + parsed_packet = parser.recv(@sock) |
54 | 30 | end
|
55 |
| - parsed_packet.class.should == Rex::Post::Meterpreter::Packet |
| 31 | + parsed_packet.should be_a Rex::Post::Meterpreter::Packet |
56 | 32 | parsed_packet.type.should == Rex::Post::Meterpreter::PACKET_TYPE_REQUEST
|
57 | 33 | parsed_packet.method?("test_method").should == true
|
58 | 34 | end
|
|
0 commit comments