Skip to content

Instantly share code, notes, and snippets.

@shoukreytom
Last active April 21, 2021 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shoukreytom/f072a95e0dd9c4dbab8d2c13f8435128 to your computer and use it in GitHub Desktop.
Save shoukreytom/f072a95e0dd9c4dbab8d2c13f8435128 to your computer and use it in GitHub Desktop.
6 length otps file generator
import random
def generate_otp():
# return ''.join([str(random.randint(0, 9)) for x in range(6)]) # shorthand
num_co = ''
for x in range(6):
num_co += str(random.randint(0, 9))
return num_co
def main():
otps = list()
otps_file = open('otps_file.txt', 'a+')
i = 0;
while True:
otp = generate_otp()
if i >= (9**6):
break;
if otp not in otps:
print(f'adding {otp} to the file...')
otps.append(otp)
otps_file.write(f'{otp}\n')
i += 1
print(otps)
print(len(otps))
print('000000' in otps)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment