예제 #1
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.session_id = HaspASN1.get_intval(rb[0x80])
     self.file_id = HaspASN1.get_intval(rb[0x81])
     self.offset = HaspASN1.get_intval(rb[0x82])
     self.amount = HaspASN1.get_intval(rb[0x83])
     self.seedvals = rb[0x84]
예제 #2
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.feature_id = HaspASN1.get_intval(rb[0x80])
     self.vendor_id = HaspASN1.get_intval(rb[0x81])
     self.scope = HaspASN1.get_strval(rb[0x82])
     self.format = HaspASN1.get_strval(rb[0x83])
     self.val_84 = rb[0x84]
     self.api_version_major = struct.unpack(">I", self.val_84[0:4])[0]
     self.api_version_minor = struct.unpack(">I", self.val_84[4:8])[0]
     self.api_build_number = struct.unpack(">I", self.val_84[8:12])[0]
예제 #3
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.session_id,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.is_decrypt,
                 'type': 'intval'
             },
             0x82: {
                 'value': self.crypt_type,
                 'type': 'intval'
             },
             0x83: {
                 'value': self.enc_len,
                 'type': 'intval'
             },
             0x84: {
                 'value': self.data
             },
             0x85: {
                 'value': self.seedvals
             },
             0x86: {
                 'value': self.val_86,
                 'type': 'intval'
             }
         }
     }
     return HaspASN1.encode(rb)
예제 #4
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.feature_id,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.vendor_id,
                 'type': 'intval',
                 'blen': 3
             },
             0x82: {
                 'value': self.scope,
                 'type': 'strval'
             },
             0x83: {
                 'value': self.format,
                 'type': 'strval'
             },
             0x84: {
                 'value': self.val_84
             }
         }
     }
     return HaspASN1.encode(rb)
예제 #5
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.session_id,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.file_id,
                 'type': 'intval',
                 'blen': 3
             },
             0x82: {
                 'value': self.offset,
                 'type': 'intval'
             },
             0x83: {
                 'value': self.amount,
                 'type': 'intval'
             },
             0x84: {
                 'value': self.seedvals
             },
         }
     }
     return HaspASN1.encode(rb)
예제 #6
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.data
             },
         }
     }
     return HaspASN1.encode(rb)
예제 #7
0
 def serialize(self):
     sd = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.client_id,
                 'type': 'intval'
             }
         }
     }
     return HaspASN1.encode(sd)
예제 #8
0
 def serialize(self):
     sd = {
         self.oid: {
             0x80: {
                 'value': self.session_id,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.val_81,
                 'type': 'intval'
             }
         }
     }
     return HaspASN1.encode(sd)
예제 #9
0
 def serialize(self):
     bcid = struct.pack(">I", self.sc_id)
     rb = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': bcid
             }
         }
     }
     return HaspASN1.encode(rb)
예제 #10
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.session_id = HaspASN1.get_intval(rb[0x80])
     self.is_decrypt = HaspASN1.get_intval(rb[0x81])
     self.crypt_type = HaspASN1.get_intval(rb[0x82])
     self.enc_len = HaspASN1.get_intval(rb[0x83])
     self.data = rb[0x84]
     self.seedvals = rb[0x85]
     self.val_86 = HaspASN1.get_intval(rb[0x86])
예제 #11
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.session_id,
                 'type': 'intval'
             },
             0x82: {
                 'value': self.hasp_serial,
                 'type': 'intval'
             },
             0x83: {
                 'value': self.val_83,
                 'type': 'intval'
             },
             0x84: {
                 'value': self.val_84,
                 'type': 'intval'
             },
             0x85: {
                 'value': self.val_85,
                 'type': 'intval'
             },
             0x87: {
                 'value': self.val_87,
                 'type': 'intval'
             },
             0x88: {
                 'value': self.sc_id,
                 'type': 'intval'
             },
             0x89: {
                 'value': self.val_89,
                 'type': 'intval'
             },
             0x8A: {
                 'value': self.val_8a
             },
             0x8B: {
                 'value': self.val_8b,
                 'type': 'intval'
             },
         }
     }
     return HaspASN1.encode(rb)
예제 #12
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.rtc_timestamp,
                 'type': 'intval',
                 'blen': 5
             },
         }
     }
     return HaspASN1.encode(rb)
예제 #13
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.session_id,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.file_id,
                 'type': 'intval',
                 'blen': 3
             }
         }
     }
     return HaspASN1.encode(rb)
예제 #14
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.status,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.num_written,
                 'type': 'intval'
             },
             0x82: {
                 'value': self.seedvals
             },
         }
     }
     return HaspASN1.encode(rb)
예제 #15
0
 def serialize(self):
     sd = {
         self.oid: {
             0x80: {
                 'value': self.val_80,
                 'type': 'intval'
             },
             0x81: {
                 'value': self.api_version_major,
                 'type': 'intval'
             },
             0x82: {
                 'value': self.api_version_minor,
                 'type': 'intval'
             },
             0x84: {
                 'value': HaspUtils.GetTimestamp(),
                 'type': 'intval',
                 'blen': 5
             }
         }
     }
     return HaspASN1.encode(sd)
예제 #16
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.client_id = HaspASN1.get_intval(rb[0x81])
예제 #17
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.file_size = HaspASN1.get_intval(rb[0x81])
예제 #18
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.info = HaspASN1.get_strval(rb[0x81])
예제 #19
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.val_80 = HaspASN1.get_intval(rb[0x80])
     self.api_version_major = HaspASN1.get_intval(rb[0x81])
     self.api_version_minor = HaspASN1.get_intval(rb[0x82])
     self.timestamp = HaspASN1.get_intval(rb[0x84])
예제 #20
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.rtc_timestamp = HaspASN1.get_intval(rb[0x81])
예제 #21
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.session_id = HaspASN1.get_intval(rb[0x80])
     self.val_81 = HaspASN1.get_intval(rb[0x81])
예제 #22
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.sc_id = struct.unpack(">I", rb[0x81])[0]
예제 #23
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.session_id = HaspASN1.get_intval(rb[0x81])
     self.hasp_serial = HaspASN1.get_intval(rb[0x82])
     self.val_83 = HaspASN1.get_intval(rb[0x83])
     self.val_84 = HaspASN1.get_intval(rb[0x84])
     self.val_85 = HaspASN1.get_intval(rb[0x85])
     self.val_87 = HaspASN1.get_intval(rb[0x87])
     self.sc_id = HaspASN1.get_intval(rb[0x88])
     self.val_89 = HaspASN1.get_intval(rb[0x89])
     self.val_8a = rb[0x8A]
     self.val_8b = HaspASN1.get_intval(rb[0x8B])
예제 #24
0
 def parse(self, data):
     is_linux_request = False
     rb = HaspASN1.decode(data)[self.oid]
     self.pid = HaspASN1.get_intval(rb[0x80])
     self.tid = HaspASN1.get_intval(rb[0x81])
     if (self.tid == 0x1234):
         is_linux_request = True
     self.hasp_uid = HaspASN1.get_intval(rb[0x82])
     self.vendor_id = HaspASN1.get_intval(rb[0x83])
     self.username = HaspASN1.get_strval(rb[0x84])
     self.machine_name = HaspASN1.get_strval(rb[0x85])
     self.login_type = HaspASN1.get_strval(rb[0x86])
     self.spec = HaspASN1.get_strval(rb[0x87])
     self.scope = HaspASN1.get_strval(rb[0x88])
     self.api_version_major = HaspASN1.get_intval(rb[0x89])
     self.api_version_minor = HaspASN1.get_intval(rb[0x8A])
     self.timestamp = HaspASN1.get_intval(rb[0x8B])
     self.val_8c = HaspASN1.get_intval(rb[0x8C])
     self.val_8d = HaspASN1.get_intval(rb[0x8D])
     self.val_8e = HaspASN1.get_intval(rb[0x8E])
     self.val_8f = HaspASN1.get_intval(rb[0x8F])
     if (is_linux_request == True):
         self.volume_serial = HaspASN1.get_strval(rb[0x90])
     else:
         self.volume_serial = HaspASN1.get_intval(rb[0x90])
     self.val_91 = HaspASN1.get_intval(rb[0x91])
     self.hasp_handle = HaspASN1.get_intval(rb[0x92])
     self.val_93 = HaspASN1.get_intval(rb[0x93])
예제 #25
0
 def serialize(self):
     is_linux_request = False
     if (self.tid == 0x1234):
         is_linux_request = True
     rb = {
         self.oid: {
             0x80: {
                 'value': self.pid,
                 'type': 'intval',
                 'blen': 2
             },
             0x81: {
                 'value': self.tid,
                 'type': 'intval',
                 'blen': 2
             },
             0x82: {
                 'value': self.hasp_uid,
                 'type': 'intval',
                 'blen': 2
             },  # This is 0 in linux
             0x83: {
                 'value': self.vendor_id,
                 'type': 'intval',
                 'blen': 3
             },
             0x84: {
                 'value': self.username,
                 'type': 'strval'
             },
             0x85: {
                 'value': self.machine_name,
                 'type': 'strval'
             },
             0x86: {
                 'value': self.login_type,
                 'type': 'strval'
             },
             0x87: {
                 'value': self.spec,
                 'type': 'strval'
             },
             0x88: {
                 'value': self.scope,
                 'type': 'strval'
             },
             0x89: {
                 'value': self.api_version_major,
                 'type': 'intval'
             },
             0x8A: {
                 'value': self.api_version_minor,
                 'type': 'intval'
             },
             0x8B: {
                 'value': HaspUtils.GetTimestamp(),
                 'type': 'intval',
                 'blen': 5
             },
             0x8C: {
                 'value': self.val_8c,
                 'type': 'intval'
             },
             0x8D: {
                 'value': self.val_8d,
                 'type': 'intval'
             },
             0x8E: {
                 'value': self.val_8e,
                 'type': 'intval'
             },
             0x8F: {
                 'value': self.val_8f,
                 'type': 'intval'
             },
             0x90: {
                 'value': self.volume_serial,
                 'type': 'intval',
                 'blen': 4
             },
             0x91: {
                 'value': self.val_91,
                 'type': 'intval'
             },
             0x92: {
                 'value': self.hasp_handle,
                 'type': 'intval',
                 'blen': 5
             },
             0x93: {
                 'value': self.val_93,
                 'type': 'intval'
             },
         }
     }
     if (is_linux_request == True):
         rb[self.oid][0x90] = {
             'value': self.volume_serial,
             'type': 'strval'
         }
     return HaspASN1.encode(rb)
예제 #26
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.pid = HaspASN1.get_intval(rb[0x80])
     self.tid = HaspASN1.get_intval(rb[0x81])
     self.hasp_uid = HaspASN1.get_intval(rb[0x82])
     self.vendor_id = HaspASN1.get_intval(rb[0x83])
     self.feature_id = HaspASN1.get_intval(rb[0x84])
     self.username = HaspASN1.get_strval(rb[0x85])
     self.machine_name = HaspASN1.get_strval(rb[0x86])
     self.login_type = HaspASN1.get_strval(rb[0x87])
     self.api_version_major = HaspASN1.get_intval(rb[0x88])
     self.api_version_minor = HaspASN1.get_intval(rb[0x89])
     self.timestamp = HaspASN1.get_intval(rb[0x8A])
     self.val_8b = HaspASN1.get_intval(rb[0x8B])
     self.val_8c = HaspASN1.get_intval(rb[0x8C])
     self.val_8d = HaspASN1.get_intval(rb[0x8D])
     self.val_8e = HaspASN1.get_intval(rb[0x8E])
     self.volume_serial = HaspASN1.get_intval(rb[0x8F])
     self.val_90 = HaspASN1.get_intval(rb[0x90])
     self.hasp_handle = HaspASN1.get_intval(rb[0x91])
예제 #27
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.num_written = HaspASN1.get_intval(rb[0x81])
     self.seedvals = rb[0x82]
예제 #28
0
 def parse(self, data):
     rb = HaspASN1.decode(data)[self.oid]
     self.status = HaspASN1.get_intval(rb[0x80])
     self.data = rb[0x81]
     self.val_82 = HaspASN1.get_intval(rb[0x82])
예제 #29
0
 def serialize(self):
     rb = {
         self.oid: {
             0x80: {
                 'value': self.pid,
                 'type': 'intval',
                 'blen': 2
             },
             0x81: {
                 'value': self.tid,
                 'type': 'intval',
                 'blen': 2
             },
             0x82: {
                 'value': self.hasp_uid,
                 'type': 'intval',
                 'blen': 2
             },
             0x83: {
                 'value': self.vendor_id,
                 'type': 'intval',
                 'blen': 3
             },
             0x84: {
                 'value': self.feature_id,
                 'type': 'intval'
             },
             0x85: {
                 'value': self.username,
                 'type': 'strval'
             },
             0x86: {
                 'value': self.machine_name,
                 'type': 'strval'
             },
             0x87: {
                 'value': self.login_type,
                 'type': 'strval'
             },
             0x88: {
                 'value': self.api_version_major,
                 'type': 'intval'
             },
             0x89: {
                 'value': self.api_version_minor,
                 'type': 'intval'
             },
             0x8A: {
                 'value': HaspUtils.GetTimestamp(),
                 'type': 'intval',
                 'blen': 5
             },
             0x8B: {
                 'value': self.val_8b,
                 'type': 'intval'
             },
             0x8C: {
                 'value': self.val_8c,
                 'type': 'intval'
             },
             0x8D: {
                 'value': self.val_8d,
                 'type': 'intval'
             },
             0x8E: {
                 'value': self.val_8e,
                 'type': 'intval'
             },
             0x8F: {
                 'value': self.volume_serial,
                 'type': 'intval',
                 'blen': 4
             },
             0x90: {
                 'value': self.val_90,
                 'type': 'intval'
             },
             0x91: {
                 'value': self.hasp_handle,
                 'type': 'intval',
                 'blen': 5
             }
         }
     }
     return HaspASN1.encode(rb)