示例#1
0
 def parse(s):
     type = QueryType(s.read("uint:3"))
     assert (type == QueryType.ARITH_COMP_WITH_VALUE
             )  # TODO implement other types
     mask_present = s.read("bool")
     assert (mask_present is False)  # TODO implement this
     params = ArithQueryParams.parse(s)
     compare_length = Length.parse(s)
     compare_value = map(ord, s.read("bytes:" + str(compare_length.value)))
     file_a_offset = Offset.parse(s)
     return QueryOperand(type=type,
                         mask_present=mask_present,
                         params=params,
                         compare_length=compare_length,
                         compare_value=compare_value,
                         file_a_offset=file_a_offset)
示例#2
0
 def test_parse_three_bytes(self):
   offset_bytes = [0x20, 0x40, 0x41]
   offset = Offset.parse(ConstBitStream(bytes=offset_bytes))
   self.assertEqual(offset.offset.value, 65)
示例#3
0
 def test_parse(self):
   offset_bytes = [0x20, 0x01]
   offset = Offset.parse(ConstBitStream(bytes=offset_bytes))
   self.assertEqual(offset.id, 32)
   self.assertEqual(offset.offset.value, 1)
示例#4
0
 def parse_offset(self, s):
     return Offset.parse(s)
示例#5
0
文件: offset.py 项目: Conaras/pyd7a
 def test_parse_three_bytes(self):
   offset_bytes = [0x01, 0x80, 0xfe, 0x60]
   offset = Offset.parse(ConstBitStream(bytes=offset_bytes))
   self.assertEqual(offset.id, 1)
   self.assertEqual(offset.offset.value, 65120)