本文整理汇总了Python中netzob.Common.Type.TypeConvertor.TypeConvertor.stringB2bin方法的典型用法代码示例。如果您正苦于以下问题:Python TypeConvertor.stringB2bin方法的具体用法?Python TypeConvertor.stringB2bin怎么用?Python TypeConvertor.stringB2bin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类netzob.Common.Type.TypeConvertor.TypeConvertor
的用法示例。
在下文中一共展示了TypeConvertor.stringB2bin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: read
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import stringB2bin [as 别名]
def read(self, timeout):
self.log.debug("Reading from the socket some data (timeout = " + str(timeout))
result = bitarray(endian='big')
chars = []
try:
if timeout > 0:
ready = select.select([self.socket], [], [], timeout)
if ready[0]:
chars = self.socket.recv(4096)
else:
ready = select.select([self.socket], [], [])
self.log.debug("ready = " + str(ready[0]))
if ready[0]:
chars = self.socket.recv(4096)
except:
self.log.debug("Impossible to read from the network socket")
return None
if (len(chars) == 0):
return result
result = TypeConvertor.stringB2bin(chars)
self.log.debug("Received : {0}".format(TypeConvertor.bin2strhex(result)))
return result
示例2: str2bin
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import stringB2bin [as 别名]
def str2bin(self, stri):
return TypeConvertor.stringB2bin(stri)
示例3: guessValue
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import stringB2bin [as 别名]
def guessValue(self):
"""guessValue:
Try to guess the pointed variable's value and give it to the current value.
"""
# The 'TEMP' value is explicit enough.
self.currentValue = TypeConvertor.stringB2bin("TEMP")
示例4: configureMemory
# 需要导入模块: from netzob.Common.Type.TypeConvertor import TypeConvertor [as 别名]
# 或者: from netzob.Common.Type.TypeConvertor.TypeConvertor import stringB2bin [as 别名]
def configureMemory(self):
"""Presets the meta-variables of the channel with specified values"""
self.varL4Protocol = DataVariable(AbstractChannel.varID_L4_PROTOCOL, AbstractChannel.varID_L4_PROTOCOL, True, True, WordType(True, 0, 5), TypeConvertor.stringB2bin(self.originalProtocol))
self.varBindIP = DataVariable(AbstractChannel.varID_BIND_IP, AbstractChannel.varID_BIND_IP, True, True, IPv4WordType(True, 7, 15), TypeConvertor.stringB2bin(self.originalBindIp))
self.varBindPort = DataVariable(AbstractChannel.varID_BIND_PORT, AbstractChannel.varID_BIND_PORT, True, True, DecimalWordType(True, 0, 5), TypeConvertor.stringB2bin(str(self.originalBindPort)))
self.varTargetIP = DataVariable(AbstractChannel.varID_TARGET_IP, AbstractChannel.varID_TARGET_IP, True, True, IPv4WordType(True), TypeConvertor.stringB2bin(self.originalTargetIp))
self.varTargetPort = DataVariable(AbstractChannel.varID_TARGET_PORT, AbstractChannel.varID_TARGET_PORT, True, True, DecimalWordType(True, 0, 5), TypeConvertor.stringB2bin(str(self.originalTargetPort)))
self.memory.forget(self.varL4Protocol)
self.memory.memorize(self.varL4Protocol)
self.memory.forget(self.varBindIP)
self.memory.memorize(self.varBindIP)
self.memory.forget(self.varBindPort)
self.memory.memorize(self.varBindPort)
self.memory.forget(self.varTargetIP)
self.memory.memorize(self.varTargetIP)
self.memory.forget(self.varTargetPort)
self.memory.memorize(self.varTargetPort)