Last active
May 23, 2022 12:44
-
-
Save cagingulsen/eda611c21cf308a4973b911b1e9656d0 to your computer and use it in GitHub Desktop.
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 | |
| import string | |
| # To randomize encoded data to seem like different | |
| NUMBER_OF_OUTPUT_FILES = 100 | |
| LOOP_REAL_DATA = 94 | |
| def work(read_filename, file_index): | |
| try: | |
| line_arr = [] | |
| with open(read_filename) as fpr: | |
| line = fpr.readline() | |
| while line: | |
| line_arr.append(line) | |
| line = fpr.readline() | |
| fpr.close() | |
| with open(f"dns_queries{file_index+1}.txt", "w") as fpw: | |
| for i in range(LOOP_REAL_DATA): | |
| for j in range(len(line_arr)-1): | |
| list_to_print = list(line_arr[j]) | |
| n = random.randint(0,60) | |
| list_to_print[n] = random.choice(string.ascii_letters) | |
| line_to_print = ''.join(list_to_print) | |
| fpw.write(line_to_print) | |
| fpw.close() | |
| except Exception as e: | |
| print(e) | |
| # Run Program | |
| for idx in range(NUMBER_OF_OUTPUT_FILES): | |
| work('queries.txt', idx) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment