示例#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 + ':')