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 )
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)
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 )
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
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
def login(self): wbUdp.sendFrame( broadcastAddr, ':LG;'+password+':')
def login(self): wbUdp.sendFrame( ':LG;'+self.password+':')
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)
def reset_webbrick(): wbUdp.sendFrame(targetIP,"LGpassword:RB:" )
def reset_sps(): wbUdp.sendFrame(targetIP,"LGpassword:RS:" )
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)
def login(self): wbUdp.sendFrame(broadcastAddr, ':LG;' + password + ':')