-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcycle.py
43 lines (31 loc) · 880 Bytes
/
cycle.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from time import sleep
import sys
from cyberoam import *
# Check login status after this interval.
STATUS_INTERVAL = 60 * 2
def load_pool(poolfile):
# Load username/password combinations from file.
pooltxt = open(poolfile).read()
lines = pooltxt.split('\n')
pool = map(lambda x: x.split(' '), lines)
return pool
def cycle(pool):
# Cycle through a set of username/password combinations,
# while checking the live login status periodically.
success = False
for cred in pool:
if sendLoginRequest(cred[0], cred[1]):
print 'Logged in with %s' % cred[0]
success = True
while True:
sleep(STATUS_INTERVAL)
print 'Checking status of %s' % cred[0]
if not checkLiveStatus(cred[0]):
success = False
break
if not success:
print 'Damn! All combinations failed.'
else:
cycle()
if __name__ == '__main__':
cycle(load_pool(sys.argv[1]))