fork download
  1. import hashlib
  2.  
  3. def suPassword(chall):
  4. #El challenge esta compuesto de 0123456789ABCDEFGHIJKLMNOPQRSTUYWXYZ
  5. premd5 = bytearray(8)
  6. for i in range(8):
  7. if ord(chall[i]) <= 0x47:
  8. premd5[i]=ord(chall[i])<<1
  9. else:
  10. premd5[i]=ord(chall[i])>>1
  11. print 'premd5: ',premd5
  12.  
  13. md5hash = hashlib.md5()
  14. md5hash.update(premd5)
  15. print 'md5: ',md5hash.hexdigest()
  16. prepass = bytearray(md5hash.digest())
  17.  
  18. challpass = bytearray(8)
  19. for i in range(8):
  20. temp2=(prepass[i]>>1)*0xB60B60B7
  21. temp2=temp2>>(5+32)
  22. temp1=temp2<<3
  23. temp1=temp1-(temp2<<1)
  24. temp3=(temp1<<4)
  25. temp3=temp3-temp1
  26. temp0=prepass[i]-temp3+0x21
  27. temp0=temp0&0xFF
  28. if temp0 == 0x3F:
  29. challpass[i]=0x3E
  30. else:
  31. challpass[i]=temp0
  32. print 'PASSWORD!: ',challpass
  33.  
  34.  
  35. if __name__=='__main__':
  36. print 'Huawei MA5600T su command challenge-password generator by adiaz_32'
  37. print 'Challenge: '
  38. challenge = 'Z0USUGC5'
  39.  
  40.  
  41. #if len(challenge)==8:
  42. suPassword(challenge)
  43. #else:
  44. # print 'ERROR: Challenge must have 8 chars'
Success #stdin #stdout 0.02s 9392KB
stdin
Standard input is empty
stdout
Huawei MA5600T su command challenge-password generator by adiaz_32
Challenge: 
premd5:  -`*)*��j
md5:  ffa7d6451fe0621dd518521022740c48
PASSWORD!:  lnCf@M)>