リブログ記事How to import location and computer to veyon
The problem with Veyon is registering student devices.Using an add-in allows you to scan the network and register devices automatically, but this comes at a cost.Since the add-in runs on the teacher, I wondered if I could do something similar.I looked into the Veyon source code.It appears that the Veyon service uses port 11100.It appears that port 11100 is open on the student's computer, so I created a Python app and registered the device information .Now the teacher can run the app on their own.Now you can manage your computers in an instant. Uses super-fast python threads. Automatically obtains subnets. Adds real-time "Locations and Computers". Easy to use. Run with administrator privileges vayon.bat ...vayon.bat Execute adminscan.py ...adminscan.py Execute scan4.py with administrator privilegesscan4.py Automatically obtains subnets, performs high-speed all IP scans in threads, and registers in real timevayon.bat @echo offpython adminscan.pyadminscan.pyfrom ctypes import windll#Execute scan4.py with administrator privilegesdef runas(): windll.shell32.ShellExecuteW( None, "runas", "python", "scan4.py", None, 0 )if __name__ == "__main__": runas()scan4.pyimport subprocessimport socketimport ipaddressimport sysimport threadingfrom ctypes import windll#Automatically obtains subnets, performs high-speed all IP scans in threads, and registers in real timedef myip(): host = socket.gethostname() ip = socket.gethostbyname(host) return ipdef getsubnet(): host = socket.gethostname() ip = socket.gethostbyname(host) w=ip.split(".") return(w[0]+"."+w[1]+"."+w[2]+".")def init(location): subprocess.run([ "C:\\Program Files\\Veyon\\veyon-cli", "networkobjects", "clear" ], check=True) subprocess.run([ "C:\\Program Files\\Veyon\\veyon-cli", "networkobjects", "add", "location", location, ], check=True)def register_with_veyon(hostname, ip,site): try: subprocess.run([ "C:\\Program Files\\Veyon\\veyon-cli", "networkobjects", "add", "computer", hostname, ip, "", site ], check=True) print(f"✅ ok: {hostname} {ip} {site}") except subprocess.CalledProcessError: print(f"❌ error: {hostname} ({ip})")def Run(port, host): con = socket.socket(socket.AF_INET, socket.SOCK_STREAM) return_code = con.connect_ex((host, port)) con.close() if return_code == 0: hostname=socket.gethostbyaddr(host)[0] if hostname: register_with_veyon(hostname,host,site) else: print(f"⚠️error toget hostbname {host}")threads = [];site="mysite"start=2end=250port = 11100 #veyon portsubnet=getsubnet() #socket.setdefaulttimeout(10)init(site)me=myip()count=0for ip in range(start, end): host=subnet+str(ip) if host!=me: thread = threading.Thread(target=Run, args=(port,host)) thread.start() threads.append(thread) count = count + 1 veyon configurator setting