Commit fa51a0e2 authored by Mateus Goto's avatar Mateus Goto

[Fixed] minors issues

parent a36406ed
from Utility.IPFinder import IPFinder
import sys
sys.path.insert(0, "..")
from NHR9400series.NHR9410 import NHR9410
from NHR9400series.NHR9430 import NHR9430
from Utility.IPFinder import IPFinder
class controlInterface:
def __init__(self):
self.__listIp = IPFinder.getList()
self.__listIp = []
self.__listUsedIp = []
self.__nhr9410 = []
self.__nhr9430 = []
#refresh the list of ip
def refresh(self):
self.__listIp = IPFinder.getList()
ipfinder = IPFinder()
self.__listIp = ipfinder.getList()
for ip in self.__listUsedIp:
self.__listIp.remove(ip)
#create a NHR9410 object
def newNhr9410(self):
new = NHR9410
new = NHR9410()
new.__init__()
new.locateIp(self.__listIp)
print(self.getListIp())
usedIp = new.getIp()
self.__listIp.remove(usedIp)
self.__listUsedIp.append(usedIp)
......@@ -27,7 +34,7 @@ class controlInterface:
#create a NHR9430 object
def newNhr9430(self):
new = NHR9430
new = NHR9430()
new.__init__()
new.locateIp(self.__listIp)
usedIp = new.getIp()
......@@ -41,3 +48,5 @@ class controlInterface:
def getNhr9430(self):
return self.__nhr9430
def getListIp(self):
return self.__listIp
import socket
from threading import local
from scapy.all import ARP, Ether, srp
......@@ -25,6 +24,8 @@ class IPFinder:
clients = []
for sent, received in result:
clients.append({"ip": received.psrc})
print(clients)
self.__clients = clients
def deteleIp(self, ip):
......
from Control_Interface.controlInterface import controlInterface
from Utility.IPFinder import IPFinder
interface = controlInterface
interface = controlInterface()
ips = []
ips = IPFinder().getList()
print(ips)
interface.newNhr9410()
interface.newNhr9430()
#interface.newNhr9430()
nhr10 = []
print(nhr10)
nhr30 = []
nhr10 = interface.getNhr9410()
nhr30 = interface.getNhr9430()
......
(packet, timeout=3,retry = 1, verbose = 0)[0]
\ No newline at end of file
......@@ -10,7 +10,7 @@ def getAllIp():
s.connect(("10.255.255.255",1))
local_ip = s.getsockname()[0]
print(local_ip)
local_ip = local_ip[:-3] + "1/24"
local_ip = local_ip[:-2] + "1/24"
print(local_ip)
print(type(local_ip))
arp = ARP(pdst=local_ip)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment