예제 #1
0
 def setIp(self, macAddr, ipAddr):
     cmd = ':SA'
     for b in macAddr:
         cmd = cmd + ';' + str(b)
     for b in ipAddr:
         cmd = cmd + ';' + str(b)
     cmd = cmd + ':'
     wbUdp.sendFrame( broadcastAddr, cmd )
예제 #2
0
 def setIp(self, macAddr, ipAddr):
     cmd = ':SA'
     for b in macAddr:
         cmd = cmd + ';' + str(b)
     for b in ipAddr:
         cmd = cmd + ';' + str(b)
     cmd = cmd + ':'
     wbUdp.sendFrame(broadcastAddr, cmd)
예제 #3
0
 def setIp(self):
     cmd = ':SA'
     for b in self.macAddr:
         cmd = cmd + ';' + str(b)
     for b in self.addr:
         cmd = cmd + ';' + str(b)
     cmd = cmd + ':'
     wbUdp.sendFrame( cmd )
예제 #4
0
 def wbNewNode( self, event ):
     mac = event.macAdr()
     macStr = string.join( (hex(mac[0]), hex(mac[1]), hex(mac[2]), hex(mac[3]), hex(mac[4]), hex(mac[5] )), ":" )
     if macStr in self.macList:
         newIp = self.macList[macStr]
     else:
         newIp = copy.deepcopy(baseAddr)
         newIp[3] = newIp[3] + self.wbCount
         self.macList[macStr] = newIp
     
     ipStr = string.join( (str(newIp[0]), str(newIp[1]), str(newIp[2]), str(newIp[3]) ), "." )
     if ( newIp[3] < 255 ):
         logging.info( string.join(('Setting Ip address for', macStr, event.ipAdr(), 'To', ipStr ), " " ) )
         self.login()
         self.setIp( mac, newIp )
         wbUdp.sendFrame( ipStr, ':SN;'+str(newIp[3])+':')
         wbUdp.sendFrame( ipStr, ':NN;WB_'+str(newIp[3])+':')
         self.wbCount = self.wbCount + 1
         self.timeVal = timeout    # reset
예제 #5
0
    def wbNewNode(self, event):
        mac = event.macAdr()
        macStr = string.join((hex(mac[0]), hex(mac[1]), hex(mac[2]), hex(
            mac[3]), hex(mac[4]), hex(mac[5])), ":")
        if macStr in self.macList:
            newIp = self.macList[macStr]
        else:
            newIp = copy.deepcopy(baseAddr)
            newIp[3] = newIp[3] + self.wbCount
            self.macList[macStr] = newIp

        ipStr = string.join(
            (str(newIp[0]), str(newIp[1]), str(newIp[2]), str(newIp[3])), ".")
        if (newIp[3] < 255):
            logging.info(
                string.join(('Setting Ip address for', macStr, event.ipAdr(),
                             'To', ipStr), " "))
            self.login()
            self.setIp(mac, newIp)
            wbUdp.sendFrame(ipStr, ':SN;' + str(newIp[3]) + ':')
            wbUdp.sendFrame(ipStr, ':NN;WB_' + str(newIp[3]) + ':')
            self.wbCount = self.wbCount + 1
            self.timeVal = timeout  # reset
예제 #6
0
 def login(self):
     wbUdp.sendFrame( broadcastAddr, ':LG;'+password+':')
예제 #7
0
 def login(self):
     wbUdp.sendFrame( ':LG;'+self.password+':')
예제 #8
0
import sys
sys.path.append('../API')

#
# WBExercise
#
#  Andy Harris
#
#  Beat the living daylights out of a WebBrick till it gives up
#

import wbUdp, time

targetIP = '10.100.100.100'

while 1:
    for i in range(8):
        wbUdp.sendFrame(targetIP, "DO" + str(i) + ";T:")
        time.sleep(0.03)
#    for i in range(8):
#        wbUdp.sendFrame(targetIP,"DO" + str(i) + ";T:" )
#        time.sleep(0.05)
예제 #9
0
def reset_webbrick():
    wbUdp.sendFrame(targetIP,"LGpassword:RB:" )
예제 #10
0
def reset_sps():
    wbUdp.sendFrame(targetIP,"LGpassword:RS:" )
예제 #11
0
import sys
sys.path.append('../API')

#
# WBExercise
#
#  Andy Harris
# 
#  Beat the living daylights out of a WebBrick till it gives up
#


import wbUdp, time

targetIP = '10.100.100.100'

while 1:
    for i in range(8):
        wbUdp.sendFrame(targetIP,"DO" + str(i) + ";T:" )
        time.sleep(0.03)
#    for i in range(8):
#        wbUdp.sendFrame(targetIP,"DO" + str(i) + ";T:" )
#        time.sleep(0.05)

예제 #12
0
 def login(self):
     wbUdp.sendFrame(broadcastAddr, ':LG;' + password + ':')