server破解.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import os
  2. import time
  3. import subprocess
  4. nu = 0
  5. nu2 = 0
  6. start = time.clock()
  7. f = open('./password.txt','r')
  8. # passwd1 = passwd[0:200000]
  9. #for i in passwd:
  10. #f.write(i + '\n')
  11. while nu2<100:
  12. nu2 += 1
  13. passwd = f.readline()
  14. for s in passwd:
  15. while nu<100:
  16. nu += 1
  17. x = subprocess.getstatusoutput('/root/cstor_server/challenge/q2/server' + ' ' + s)
  18. if "WRONG PASSWORD!" in x[1]:
  19. pass
  20. else:
  21. print(x,s)
  22. #print(x[0])
  23. # f1=file('XXX.txt','r')
  24. # for line in f1.readlines()[N:]:
  25. #if 'CORRECT PASSWORD' in x:
  26. # print(x)
  27. """
  28. outputss = os.popen(['/root/dd' + ' ' + s "&& grep WRONG PASSWORD"])
  29. x = outputss.read()
  30. if x == "WRONG PASSWORD!":
  31. pass
  32. x.close()
  33. """
  34. #os.system('/root/dd' + ' ' + s)
  35. #subprocess.Popen('/root/dd' + ' ' + s, shell=True, cwd="/home")
  36. #print(passwd)
  37. # for four in numb:
  38. # print(first+second+thrid+four)
  39. f.close()
  40. elapsed = (time.clock() - start)
  41. print("Time used:",elapsed)
  42. import os
  43. import time
  44. import subprocess
  45. nu = 0
  46. nu2 = 0
  47. start = time.clock()
  48. f = open('./passwd.txt','r')
  49. #f = file('passwd.txt','r')
  50. while True:
  51. for s in f.readlines()[100:110]:
  52. # print(s)
  53. x = subprocess.getstatusoutput('/root/cstor_server/challenge/q2/server' + ' ' + s)
  54. if "WRONG PASSWORD!" in x:
  55. pass
  56. else:
  57. print(x,s)
  58. f.close()
  59. elapsed = (time.clock() - start)
  60. print("Time used:",elapsed)