Commit 6af36fa2 authored by Mateus Goto's avatar Mateus Goto

[Updated] method of connecting

parent 4ddcb4f6
This diff is collapsed.
Main.jpg

154 KB

......@@ -9,7 +9,7 @@ class NHR9400:
def __init__(self, name):
self.__name = name
self.__s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
self.__s.timeout(1)
self.__s.settimeout(1)
self.__out = RefineOutput
......
......@@ -6,18 +6,21 @@ class NHR9410(NHR9400):
def __init__(self):
super().__init__("NHR9410")
def locateIp(self, clients = []):
def locateIp(self,clients = []):
for client in clients:
self.__s.connect((client, 5025))
self.__s.send("SYST:RWL\n") #Command to activate remote control and locking the touchscreen
self.__s.send("*IDN?\n")
recv = self.receiveString()
if str.find("NH Research,9410-") != -1: #if find this subtring
self.__ip = client
clients.remove(client)
break
else:
self.__s.close()
try:
self.__s.connect((client, 5025))
self.__s.send("SYST:RWL\n") #Command to activate remote control and locking the touchscreen
self.__s.send("*IDN?\n")
recv = super().receiveString()
if recv.find("NH Research,9410-") != -1: #if find this subtring
self.__ip = client
clients.remove(client)
break
else:
self.__s.close()
except:
pass
......@@ -8,16 +8,20 @@ class NHR9430(NHR9400):
def locateIp(self,clients = []):
for client in clients:
self.__s.connect((client, 5025))
self.__s.send("SYST:RWL\n") #Command to activate remote control and locking the touchscreen
self.__s.send("*IDN?\n")
recv = super().receiveString()
if recv.find("NH Research,9410-") != -1: #if find this subtring
self.__ip = client
clients.remove(client)
break
else:
self.__s.close()
try:
self.__s.connect((client, 5025))
self.__s.send("SYST:RWL\n") #Command to activate remote control and locking the touchscreen
self.__s.send("*IDN?\n")
recv = super().receiveString()
if recv.find("NH Research,9430-") != -1: #if find this subtring
self.__ip = client
clients.remove(client)
break
else:
self.__s.close()
except:
pass
#Arquivo para teste em geral
import socket
from scapy.all import ARP, Ether, srp, arping
import socket
import time
start = time.time()
......@@ -25,4 +26,10 @@ def getAllIp():
print(client)
getAllIp()
print (time.time() - start)
\ No newline at end of file
s = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.settimeout(1)
try:
s.connect(("192.168.15.10", 5025))
except:
print("conexão falhou")
print (time.time() - start)
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