Skip to content

Instantly share code, notes, and snippets.

@reuniware
Last active November 3, 2022 19:07
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 reuniware/a992a36a5234a0073af3c9256e9e997d to your computer and use it in GitHub Desktop.
Save reuniware/a992a36a5234a0073af3c9256e9e997d to your computer and use it in GitHub Desktop.
Random string generator and word search
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