| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- import os
- import subprocess
- # import time
- # start = time.clock()
- numb = ['0','1','2','3','4','5','6','7','8','9',
- 'a','b','c','d','e','f','g','h',
- 'i','j','k','l','m','n','o','p',
- 'q','r','s','t','u','v','w','x','y','z']
- shuzi = ['0','1','2','3','4','5','6','7','8','9']
- # passwd = []
- f = open('./password.txt','w')
- for fi in numb:
- #passwd.append(fi)
- for s in numb:
- #passwd.append(fi+s)
- for t in numb:
- #passwd.append(fi+s+t)
- for four in shuzi:
- f.write(fi+s+t+four+ '\n')
-
- # passwd.append(fi+s+t+four)
- # f = open('./password.txt','w')
- # # passwd1 = passwd[0:200000]
- # for i in passwd:
- # f.write(i + '\n')
- f.close()
- f = open('./password.txt','w')
- passwd = f.readlines
- nu = 0
- for s in passwd:
- while nu<100:
- nu += 1
- print(s)
- #x = subprocess.getstatusoutput('/root/dd' + ' ' + s)
- #if "WRONG PASSWORD!" in x[1]:
- # print(x[0])
-
- #if 'CORRECT PASSWORD' in x:
- # print(x)
- """
- outputss = os.popen(['/root/dd' + ' ' + s "&& grep WRONG PASSWORD"])
- x = outputss.read()
- if x == "WRONG PASSWORD!":
- pass
- x.close()
- """
- #os.system('/root/dd' + ' ' + s)
- #subprocess.Popen('/root/dd' + ' ' + s, shell=True, cwd="/home")
- #print(passwd)
- # for four in numb:
- # print(first+second+thrid+four)
-
- # elapsed = (time.clock() - start)
- # print("Time used:",elapsed)
- import os
- import time
- import subprocess
- # import _thread
- import threading
- def runa(one,two):
- f = open('./passwd.txt','r')
- for s in f.readlines()[one:two]:
- x = subprocess.getstatusoutput('/root/cstor_server/challenge/q2/server -g 8 -u 87 -p' + ' ' + s)
- if "WRONG PASSWORD!" in x:
- pass
- elif "Get User ID!" in x:
- pass
- else:
- print(x,s)
- f.close()
- if __name__ == '__main__':
- threading.Thread(target=runa,args=(1,10000)).start()
- threading.Thread(target=runa,args=(10000,20000)).start()
- threading.Thread(target=runa,args=(20000,30000)).start()
- threading.Thread(target=runa,args=(30000,40000)).start()
- threading.Thread(target=runa,args=(40000,50000)).start()
- import os
- import threading
- numb = ['0','1','2','3','4','5','6','7','8','9',
- 'a','b','c','d','e','f','g','h',
- 'i','j','k','l','m','n','o','p',
- 'q','r','s','t','u','v','w','x','y','z']
- shuzi = ['0','1','2','3','4','5','6','7','8','9']
- # passwd = []
- #for fi in numb:
- #passwd.append(fi)
- # for s in numb:
- #passwd.append(fi+s)
- # for t in numb:
- #passwd.append(fi+s+t)
- # for four in shuzi:
- # if os.popen('./server -u 1 -g 1 -p '+fi+s+t+four).readline()!='WRONG PASSWORD!\n':
- # print(fi+s+t+four)
- def calc_pass(first='0',laster=0):
- print('thread start :'+first)
- for s in numb:
- #passwd.append(fi+s)
- for t in numb:
- #passwd.append(fi+s+t)
- for four in shuzi:
- if os.popen('./server -u 11 -g 10 -p '+first+s+t+four).readline()!='WRONG PASSWORD!\n':
- print(first+s+t+four)
- break
- if __name__ == '__main__':
- map(lambda first:threading.Thread(target=calc_pass, args=(first,"0")).start(),numb)
|