Ejemplo n.º 1
0
def openPort(port):

    eport = port
    iport = port
    router = None
    lanip = None
    disable = False
    protocol = "TCP"
    time = 0
    description = "Prueba 1 de UPnP con Python"
    verbose = True
    result = portforwardlib.forwardPort(eport, iport, router, lanip, disable,
                                        protocol, time, description, verbose)
    sleep(2)
    result = portforwardlib.forwardPort(eport, iport, router, lanip, disable,
                                        protocol, time, description, verbose)

    return result
Ejemplo n.º 2
0
 def redirectport(ip):
     result = None
     while result == None:
         #try:
         result = portforwardlib.forwardPort(
             9090, 9090, None, ip, False, protocol, 0,
             'SpatiumBlockNetwor({})'.format(protocol), True)
         #except:
         # pass
         time.sleep(0.3)
Ejemplo n.º 3
0
def close_port(ip):
    result = None
    while result == None:
        try:
            result = portforwardlib.forwardPort(
                9090, 9090, None, ip, False, protocol, 1,
                'SpatiumBlockNetwor({})'.format(protocol), False)
            print(result)
        except Exception as e:
            print(e)
            pass
        time.sleep(0.3)
Ejemplo n.º 4
0
 def DisablePortForward(self):
     pf.forwardPort(10000, 10000, self.router_ip, self.serverhost, True,
                    self.protocol, 0, 'cabbage routing', True)