本文整理汇总了Python中netzob.Common.Type.TypeConvertor.TypeConvertor.int2string方法的典型用法代码示例。如果您正苦于以下问题:Python TypeConvertor.int2string方法的具体用法?Python TypeConvertor.int2string怎么用?Python TypeConvertor.int2string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netzob.Common.Type.TypeConvertor.TypeConvertor
的用法示例。
在下文中一共展示了TypeConvertor.int2string方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generateValue
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import int2string [as 别名]
def generateValue(self, negative, dictionary):
self.log.debug("Generate value of hex")
if self.min != -1 and self.max != -1:
# generate a value in int
r = random.randint(self.min, self.max)
self.log.debug("Generating hex of value : " + str(r))
self.binValue = TypeConvertor.int2bin(r, self.size)
self.strValue = TypeConvertor.int2string(r)
示例2: __init__
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import int2string [as 别名]
def __init__(self, id, name, size, value):
Variable.__init__(self, id, name, "INT")
self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.HexVariable.py')
self.value = value
self.size = size
self.min = -1
self.max = -1
self.reset = "normal"
if self.value != None:
self.binValue = TypeConvertor.int2bin(self.value, self.size)
self.strValue = TypeConvertor.int2string(self.value)
else:
self.binValue = None
self.strValue = None
self.binValueBeforeLearning = None
self.strValueBeforeLearning = None
self.log.debug("Bin-value = " + str(self.binValue) + ", str-value = " + str(self.strValue))