Last active
April 21, 2021 00:38
-
-
Save shoukreytom/f072a95e0dd9c4dbab8d2c13f8435128 to your computer and use it in GitHub Desktop.
6 length otps file generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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