Esempio n. 1
0
    def __init__(self, id, name, originalValue):
        Variable.__init__(self, "Word", id, name)
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.WordVariable.py')
        self.originalValue = originalValue

        # Set the original value (in bitarray)
        self.computeCurrentValue(self.originalValue)
Esempio n. 2
0
 def __init__(self, id, name, init, id_var):
     Variable.__init__(self, id, name, "MD5")
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.HexVariable.py')
     self.init = init
     self.id_var = id_var
     self.binVal = None
     self.strVal = None
Esempio n. 3
0
    def __init__(self, id, name, originalValue, minHex, maxHex):
        Variable.__init__(self, "Hexadecimal", id, name)
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.HexVariable.py')
        self.originalValue = originalValue
        self.minHex = minHex
        self.maxHex = maxHex

        # Set the current value
        self.computeCurrentValue(self.originalValue)
Esempio n. 4
0
 def __init__(self, id, name, defaultVar):
     Variable.__init__(self, id, name, "IP")
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.IPVariable.py')
     if defaultVar == "" or defaultVar == None:
         self.binVal = None
         self.strVal = None
     else:
         self.strVal = defaultVar
         self.binVal = self.string2bin(self.strVal)
Esempio n. 5
0
    def __init__(self, id, name, originalValue, minBits, maxBits):
        Variable.__init__(self, "Binary", id, name)
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.BinaryVariable.py')
        self.originalValue = originalValue
        self.minBits = minBits
        self.maxBits = maxBits

        # Set the current value
        self.computeCurrentValue(self.originalValue)
Esempio n. 6
0
    def __init__(self, id, name, originalValue, startValue, endValue, format):
        Variable.__init__(self, "IPv4Variable", id, name)
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.IP4Variable.py')

        # Save initial informations
        self.format = format
        self.startValue = startValue
        self.endValue = endValue
        self.originalValue = originalValue

        # Set the current value
        self.computeCurrentValue(self.originalValue)
Esempio n. 7
0
    def __init__(self, id, name, value):
        Variable.__init__(self, id, name, "HEX")
        self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.HexVariable.py')
        self.value = value
        self.size = -1
        self.min = -1
        self.max = -1
        self.reset = "normal"
        if self.value != None:
            self.binValue = None
            #TypeConvertor.hex2bin(self.value, 'big')
            self.strValue = value
        else:
            self.binValue = None
            self.strValue = None

        self.log.debug("Bin-value = " + str(self.binValue) + ", str-value = " + str(self.strValue))
Esempio n. 8
0
 def loadFromXML(xmlRoot, namespace, version):
     if version == "0.1":
         varId = xmlRoot.get("id")
         varName = xmlRoot.get("name")
         children = []
         for xmlChildren in xmlRoot.findall("{" + namespace + "}variable"):
             child = Variable.loadFromXML(xmlChildren, namespace, version)
             children.append(child)
         return AggregateVariable(varId, varName, children)
     return None
Esempio n. 9
0
    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))
Esempio n. 10
0
 def __init__(self, idVar, name, vars):
     Variable.__init__(self, AlternateVariable.TYPE, idVar, name)
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.AlternativeVariable.py')
     self.vars = []
     if vars != None:
         self.vars.extend(vars)
Esempio n. 11
0
 def __init__(self, id, name, idVar):
     Variable.__init__(self, id, name, "DynLenString")
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.WordVariable.py')
     self.idVar = idVar
     self.binVal = None
     self.strVal = None
Esempio n. 12
0
 def __init__(self, id, name, variableID):
     Variable.__init__(self, "ReferencedVariable", id, name)
     self.log = logging.getLogger('netzob.Common.MMSTD.Dictionary.Variables.ReferencedVariable.py')
     self.varID = variableID