Created
January 29, 2016 12:18
-
-
Save HJulio/ddbf4bd4b42db39cf5ba to your computer and use it in GitHub Desktop.
knock knock
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 os | |
import sys | |
import io | |
import socket | |
import time | |
import struct | |
TIMEOUT = 10 | |
PORT = "5900" | |
filename = time.strftime("%d-%m-%Y-%H:%M:%S") | |
def test(ip, f): | |
try: | |
s = socket.create_connection((ip, PORT), TIMEOUT) | |
version = s.recv(1024) | |
s.send(version) | |
auth = s.recv(1024) | |
for i in range(0, len(auth)): | |
if struct.unpack('B', auth[i])[0] == 1: | |
print "NO AUTH" | |
f.write(ip+'\n') | |
except: | |
pass | |
def main(): | |
f = open(filename + ".txt", "a") | |
with open(sys.argv[1]) as rf: | |
for line in rf: | |
test(line.strip(), f) | |
f.close() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment