本文整理汇总了Python中netzob.Common.Type.TypeConvertor.TypeConvertor.pythonRawToNetzobRaw方法的典型用法代码示例。如果您正苦于以下问题:Python TypeConvertor.pythonRawToNetzobRaw方法的具体用法?Python TypeConvertor.pythonRawToNetzobRaw怎么用?Python TypeConvertor.pythonRawToNetzobRaw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netzob.Common.Type.TypeConvertor.TypeConvertor
的用法示例。
在下文中一共展示了TypeConvertor.pythonRawToNetzobRaw方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reverse
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import pythonRawToNetzobRaw [as 别名]
def reverse(self, message):
"""reverse:
This compress the provided message in bz2 format"""
result = message
rawData = TypeConvertor.netzobRawToPythonRaw(message)
try:
rawResult = bz2.compress(rawData)
result = TypeConvertor.pythonRawToNetzobRaw(rawResult)
except Exception as e:
logging.info("Impossible to reverse BZ2 function (compress) on provided message (error= {0})".format(str(e)))
result = ""
return result
示例2: apply
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import pythonRawToNetzobRaw [as 别名]
def apply(self, message):
result = message
rawData = TypeConvertor.netzobRawToPythonRaw(message)
compressedstream = StringIO.StringIO(rawData)
try:
gzipper = gzip.GzipFile(fileobj=compressedstream)
data = gzipper.read()
result = TypeConvertor.pythonRawToNetzobRaw(data)
except Exception as e:
logging.info("Impossible to apply GZip function on provided message (error= {0})".format(str(e)))
result = ""
return result
示例3: reverse
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import pythonRawToNetzobRaw [as 别名]
def reverse(self, message):
"""reverse:
Encode in B64 the provided message"""
result = message
try:
rawContent = TypeConvertor.netzobRawToPythonRaw(message)
b64Content = base64.b64encode(rawContent)
result = TypeConvertor.pythonRawToNetzobRaw(b64Content)
except TypeError as error:
logging.warning("Impossible to compute the base64 value of message (error={0})".format(str(error)))
result = ""
return result
示例4: reverse
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import pythonRawToNetzobRaw [as 别名]
def reverse(self, message):
result = message
rawData = TypeConvertor.netzobRawToPythonRaw(message)
compressedstream = StringIO.StringIO()
try:
gzipper = gzip.GzipFile(fileobj=compressedstream, mode='w')
gzipper.write(rawData)
gzipper.close()
result = TypeConvertor.pythonRawToNetzobRaw(compressedstream.getvalue())
except Exception as e:
logging.info("Impossible to apply GZip function on provided message (error= {0})".format(str(e)))
result = ""
return result
示例5: __str__
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import pythonRawToNetzobRaw [as 别名]
def __str__(self):
return str(self.format) + "_" + str(self.length) + "_" + str(self.type) + "_" + TypeConvertor.pythonRawToNetzobRaw(str(self.value))