当前位置: 首页>>代码示例>>Python>>正文


Python TLV_utils.decode方法代码示例

本文整理汇总了Python中TLV_utils.decode方法的典型用法代码示例。如果您正苦于以下问题:Python TLV_utils.decode方法的具体用法?Python TLV_utils.decode怎么用?Python TLV_utils.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TLV_utils的用法示例。


在下文中一共展示了TLV_utils.decode方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cmd_open

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def cmd_open(self, file):
     "Open a file"
     fid = binascii.a2b_hex("".join(file.split()))
     
     result = self.open_file(fid)
     if len(result.data) > 0:
         print utils.hexdump(result.data)
         print TLV_utils.decode(result.data,tags=self.TLV_OBJECTS)
开发者ID:12019,项目名称:cyberflex-shell,代码行数:10,代码来源:iso_7816_4_card.py

示例2: cmd_selectapplication

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def cmd_selectapplication(self, application):
     """Select an application on the card. 
     application can be given either as hexadecimal aid or by symbolic name (if known)."""
     
     aid = self.resolve_symbolic_aid(application)
     
     result = self.select_application(aid)
     if len(result.data) > 0:
         print utils.hexdump(result.data)
         print TLV_utils.decode(result.data,tags=self.TLV_OBJECTS)
开发者ID:12019,项目名称:cyberflex-shell,代码行数:12,代码来源:iso_7816_4_card.py

示例3: cmd_selectfile

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def cmd_selectfile(self, p1, p2, fid):
     """Select a file on the card."""
     
     p1 = binascii.a2b_hex("".join(p1.split()))
     p2 = binascii.a2b_hex("".join(p2.split()))
     fid = binascii.a2b_hex("".join(fid.split()))
     
     result = self.select_file(p1, p2, fid)
     if len(result.data) > 0:
         print utils.hexdump(result.data)
         print TLV_utils.decode(result.data,tags=self.TLV_OBJECTS)
开发者ID:12019,项目名称:cyberflex-shell,代码行数:13,代码来源:iso_7816_4_card.py

示例4: dump

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
def dump(data):
    print "Dump following (%i bytes)" % (len(data))
    print utils.hexdump(data)
    try:
        print "Trying TLV parse:"
        print TLV_utils.decode(data, tags=card.TLV_OBJECTS, context = card.DEFAULT_CONTEXT)
        print "TLV parsed successfully"
    except (SystemExit, KeyboardInterrupt):
        raise
    except:
        print "TLV error"
        pass
开发者ID:12019,项目名称:cyberflex-shell,代码行数:14,代码来源:brutefid.py

示例5: cmd_cd

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def cmd_cd(self, dir = None):
     "Change into a DF, or into the MF if no dir is given"
     
     if dir is None:
         result = self.change_dir()
     else:
         fid = binascii.a2b_hex("".join(dir.split()))
         result = self.change_dir(fid)
     
     if len(result.data) > 0:
         print utils.hexdump(result.data)
         print TLV_utils.decode(result.data,tags=self.TLV_OBJECTS)
开发者ID:12019,项目名称:cyberflex-shell,代码行数:14,代码来源:iso_7816_4_card.py

示例6: cmd_parsetlv

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def cmd_parsetlv(self, start = None, end = None):
     "Decode the TLV data in the last response, start and end are optional"
     lastlen = len(self.last_result.data)
     if start is not None:
         start = (lastlen + (int(start,0) % lastlen) ) % lastlen
     else:
         start = 0
     if end is not None:
         end = (lastlen + (int(end,0) % lastlen) ) % lastlen
     else:
         end = lastlen
     print TLV_utils.decode(self.last_result.data[start:end], tags=self.TLV_OBJECTS, context = self.DEFAULT_CONTEXT)
开发者ID:jdkbx,项目名称:cyberflex-shell,代码行数:14,代码来源:generic_card.py

示例7: _dump_internal

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def _dump_internal(self, data, indent, do_tlv=True):
     c = utils.hexdump(data)
     r = map(lambda a: self.get_indent(indent)+a, c.splitlines(False))
     if do_tlv:
         try:
             if self._card_object is not None:
                 c = TLV_utils.decode(data, tags=self._card_object.TLV_OBJECTS, context = self._card_object.DEFAULT_CONTEXT)
             else:
                 c = TLV_utils.decode(data)
             r.append( self.get_indent(indent) + "Trying TLV parse:" )
             r.extend( map(lambda a: self.get_indent(indent)+a, c.splitlines(False)) )
         except (SystemExit, KeyboardInterrupt):
             raise
         except:
             pass
     return r
开发者ID:12019,项目名称:cyberflex-shell,代码行数:18,代码来源:iso_7816_4_card.py

示例8: _format_management_information

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
 def _format_management_information(self, indent):
     result = []
     if self._management_information is None: return result
     
     try:
         if self._card_object is not None:
             c = TLV_utils.decode(self._management_information, tags=self._card_object.TLV_OBJECTS, context = self._card_object.DEFAULT_CONTEXT)
         else:
             c = TLV_utils.decode(self._management_information)
         result.append(self.get_indent(indent+1) + "Management information:")
         result.extend( map(lambda a: self.get_indent(indent+2)+a, c.splitlines(False)) )
     except (SystemExit, KeyboardInterrupt):
         raise
     except:
         result.append(self.get_indent(indent+1) + "Raw dump of unparseable management information following:")
         result.extend(self._dump_internal(self._management_information, indent=indent+2, do_tlv=False))
     
     return result
开发者ID:12019,项目名称:cyberflex-shell,代码行数:20,代码来源:iso_7816_4_card.py

示例9: sorted

# 需要导入模块: import TLV_utils [as 别名]
# 或者: from TLV_utils import decode [as 别名]
        traceback.print_exc()


    print >>sys.stderr
    
    print "="*80
    print "Results:"
    for fid, result in sorted(results_dir.items()):
        if results_file.has_key(fid):
            continue
        
        print "-"*80
        print "Dir\t%04X" % fid
        if len(result.data) > 0:
	    print utils.hexdump(result.data)
	    try: print TLV_utils.decode(result.data,tags=card.TLV_OBJECTS)
	    except: print "Exception during TLV parse"
    
    for fid, result in sorted(results_file.items()):
        print "-"*80
        print "File\t%04X" % fid
        if len(result.data) > 0:
            print utils.hexdump(result.data)
            try: print TLV_utils.decode(result.data,tags=card.TLV_OBJECTS)
	    except: print "Exception during TLV parse"
        
        if contents_file.has_key( fid ):
            contents_result = contents_file[fid]
            if contents_result[0] == '\x69\x81':
                print "Record-oriented file"
            elif contents_result[0] == '\x69\x82':
开发者ID:12019,项目名称:cyberflex-shell,代码行数:33,代码来源:brutefid.py


注:本文中的TLV_utils.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。