Last active
November 3, 2022 19:07
-
-
Save reuniware/a992a36a5234a0073af3c9256e9e997d to your computer and use it in GitHub Desktop.
Random string generator and word search
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 os | |
import random | |
import time | |
from datetime import datetime | |
def log_to_results(str_to_log): | |
fr = open("results.txt", "a") | |
fr.write(str_to_log + "\n") | |
fr.close() | |
if os.path.exists("results.txt"): | |
os.remove("results.txt") | |
s = "" | |
z = "" | |
while True: | |
s = "" | |
for j in range(512): | |
z = "" | |
for i in range(8): | |
a = random.randint(0, 1) | |
z = z + str(a) | |
# print(z) | |
x = int(z, 2) | |
# print(x) | |
if 97 <= x <= 122 or 65 <= x <= 90 or 48 <= x <= 57: | |
s = s + chr(x) | |
print(s.replace('\r', '').replace('\n', '')) | |
mots = ["amour", "infini"] | |
for word in mots: | |
if word.lower() in s.lower(): | |
log_to_results(str(datetime.now()) + " " + word) | |
print(datetime.now(), word, "FOUND") | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment