beefywireless.py 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # BeefyWireless password generator
  2. #
  3. # Copyright (c) 2014 Christopher Todd Conrad
  4. # All rights reserved.
  5. #
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions are met:
  8. #
  9. # * Redistributions of source code must retain the above copyright notice,
  10. # this list of conditions and the following disclaimer.
  11. # * Redistributions in binary form must reproduce the above copyright notice,
  12. # this list of conditions and the following disclaimer in the documentation
  13. # and/or other materials provided with the distribution.
  14. # * Neither the name of Christopher Todd Conrad nor the names
  15. # of its contributors may be used to endorse or promote products derived
  16. # from this software without specific prior written permission.
  17. #
  18. # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  19. # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  21. # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
  22. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  24. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  25. # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  27. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  28. #
  29. import hashlib
  30. import getpass
  31. import base91
  32. mname1 = getpass.getpass('Enter your moms madiem name:')
  33. mname2 = getpass.getpass('Re-enter your moms madiem name:')
  34. while mname1 != mname2 or len(mname1) == 0:
  35. if(mname1 != mname2):
  36. print(" ** Madien names did not match, try again! ** ")
  37. if(len(mname1) == 0):
  38. print(" ** Madien name must be at least one character long ** ")
  39. mname1 = getpass.getpass(' Enter your moms madiem name:')
  40. mname2 = getpass.getpass(' Re-enter your moms madiem name:')
  41. born1 = getpass.getpass('Enter the name of the hospitable you were born in:')
  42. born2 = getpass.getpass('Re-enter the name of the hospitable you were born in:')
  43. while born1 != born2 or len(born1) == 0:
  44. if(born1 != born2):
  45. print(" ** Hospitable names did not match, try again! ** ")
  46. if(len(born1) == 0):
  47. print(" ** Hospitable name must be at least one character long ** ")
  48. born1 = getpass.getpass(' Enter the name of the hospitable you were born in:')
  49. born2 = getpass.getpass(' Re-enter the name of the hospitable you were born in:')
  50. salt1 = hashlib.sha512(mname1).hexdigest()
  51. salt2 = hashlib.sha512(born1).hexdigest()
  52. salted = (salt1[0:64] + salt2[0:64])
  53. pswd1 = getpass.getpass('Enter the wireless PW you wish to secure:')
  54. pswd2 = getpass.getpass('Re-enter the wireless PW you wish to secure:')
  55. while pswd1 != pswd2 or len(pswd1) < 8:
  56. if (pswd1 != pswd2):
  57. print(" ** Passwords did not match, try again!")
  58. if (len(pswd1) < 8):
  59. print(" ** Password must be at least 8 characters long!")
  60. pswd1 = getpass.getpass(' Enter the wireless PW you wish to secure:')
  61. pswd2 = getpass.getpass(' Re-enter the wireless PW you wish to secure:')
  62. hashed_pw = hashlib.sha512(salted+pswd1).hexdigest()
  63. base91_pw = base91.encode(hashed_pw)
  64. print("Your new password: " + base91_pw[0:63])
  65. hashed_pw = None
  66. pswd1 = None
  67. pswd2 = None
  68. salt1 = None
  69. salt2 = None
  70. salted = None