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 HG8245 su command challenge-password generator by adiaz_32'
  37. print 'Challenge: '
  38. challenge = 'APBTY5GI'
  39. #if len(challenge)==8:
  40. suPassword(challenge)
  41. #else:
  42. # print 'ERROR: Challenge must have 8 chars'# your code goes here
Success #stdin #stdout 0.03s 64528KB
stdin
Standard input is empty
stdout
Huawei HG8245 su command challenge-password generator by adiaz_32
Challenge: 
premd5:  �(�*,j�$
md5:  d2405b79c52de8a231d3cfa0915c3dac
PASSWORD!:  >a"@2NUi