Created
September 3, 2012 16:49
-
-
Save oxitnik/3610733 to your computer and use it in GitHub Desktop.
Script for searching Zyxel NAS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
host = '' | |
port = 50127 | |
data = '\x00\x42\x02\x01\x40\x61\x86\xff\xbb\x97\x00\x14\xa9\xfe\x54\xb5\xff\xff\x00\x00' | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) | |
s.bind((host, port)) | |
s.sendto(data, ('<broadcast>',port)) | |
while 1: | |
try: | |
message, address = s.recvfrom(8192) | |
if address[1] == 5603: | |
print address[0] | |
break | |
except (KeyboardInterrupt, SystemExit): | |
print "Interrupted" | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment