Пример #1
0
def _parseMixedIPFromIndex(rawIndexValue):
    rawIndexValue = rawIndexValue.split('.') #split it to array
    rawIndexValue = ".".join(rawIndexValue[2:]) #the first two elements are irrelevant, ignore them
    rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue()
    ipAddr = None
    try:
        ipAddr = InetAddress.getByAddress(rawIndexValue).getHostAddress()
    except:
        pass
    return ipAddr
Пример #2
0
def parseIPFromIpNetToPhysicalTableIndex(rawIndexValue):
    realValue = None
    try:
        rawIndexValue = rawIndexValue.split('.') #split it to array
        rawIndexValue = ".".join(rawIndexValue[3:]) #the first three elements are irrelevant, ignore them
        rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue()
        inetAddress = InetAddress.getByAddress(rawIndexValue)
        realValue = inetAddress.getHostAddress()
    except:
        pass
    return realValue
Пример #3
0
def parseIPv6FromIPv6NetToMediaTableIndex(rawIndexValue):
    realValue = None
    try:
        rawIndexValue = rawIndexValue.split('.') #split it to array
        rawIndexValue = ".".join(rawIndexValue[2:]) #the first two elements are irrelevant, ignore them
        rawIndexValue = OctetString.fromString(rawIndexValue, '.', 10).getValue()
        ipv6Address = InetAddress.getByAddress(rawIndexValue)
        realValue = ipv6Address.getHostAddress()
    except:
        pass
    return realValue
Пример #4
0
 def handle(self, exchange):
     if not exchange.getRemoteAddress().getAddress() == InetAddress.getByAddress([127, 0, 0, 1]):
         exchange.sendResponseHeaders(403, 0)
         exchange.close()
         return
     try:
         i = exchange.getRequestBody()
         ibuff = ""
         while True:
             temp = i.read()
             if temp == -1:
                 break
             ibuff += chr(temp)
         ibuff = _codecs.utf_8_decode(ibuff)[0]
         self.handleImpl(exchange, ibuff)
     except:
         exchange.sendResponseHeaders(500, 0)
     exchange.close()
Пример #5
0
 def handle(self, exchange):
     if not exchange.getRemoteAddress().getAddress(
     ) == InetAddress.getByAddress([127, 0, 0, 1]):
         exchange.sendResponseHeaders(403, 0)
         exchange.close()
         return
     try:
         i = exchange.getRequestBody()
         ibuff = ""
         while True:
             temp = i.read()
             if temp == -1:
                 break
             ibuff += chr(temp)
         ibuff = _codecs.utf_8_decode(ibuff)[0]
         self.handleImpl(exchange, ibuff)
     except:
         exchange.sendResponseHeaders(500, 0)
     exchange.close()