From b17d8aede811775c43e1991566fb2016e594a700 Mon Sep 17 00:00:00 2001 From: Merval Date: Fri, 24 Mar 2023 16:28:27 -0700 Subject: [PATCH 1/3] Updated xfinity-keyspace.py to have a class Instead of having two separate scripts to do the work of creating passwords, it is one single script with a class that can handle the forward and backward passwords. --- wordlists/5list.txt | 2 +- wordlists/6list.txt | 2 +- wordlists/numbers.txt | 2 +- xfinity-keyspace.py | 118 +++++++++++++++++++++++++++++++----------- 4 files changed, 90 insertions(+), 34 deletions(-) diff --git a/wordlists/5list.txt b/wordlists/5list.txt index 3b83575..3d5536e 100644 --- a/wordlists/5list.txt +++ b/wordlists/5list.txt @@ -683,4 +683,4 @@ yield young devil yours -youth +youth \ No newline at end of file diff --git a/wordlists/6list.txt b/wordlists/6list.txt index d0b424b..de12e73 100644 --- a/wordlists/6list.txt +++ b/wordlists/6list.txt @@ -682,4 +682,4 @@ reveal device review devote -reward +reward \ No newline at end of file diff --git a/wordlists/numbers.txt b/wordlists/numbers.txt index 77dbaaa..0a6ca22 100644 --- a/wordlists/numbers.txt +++ b/wordlists/numbers.txt @@ -9997,4 +9997,4 @@ 9996 9997 9998 -9999 +9999 \ No newline at end of file diff --git a/xfinity-keyspace.py b/xfinity-keyspace.py index a55ec7f..4070f8c 100644 --- a/xfinity-keyspace.py +++ b/xfinity-keyspace.py @@ -1,35 +1,91 @@ #!/usr/bin/python # example xfinity wifi password: fever7538harbor import os +import sys +import logging -print("Creating temp list... Stand by.") -templist = open("temp.txt", "w") - -with open("wordlists/5list.txt") as fivelist: - with open("wordlists/numbers.txt") as numblist: - flist = fivelist.readlines() - nlist = numblist.readlines() - for fword in flist: - for numb in nlist: - comb = fword.strip() + numb.strip() + "\n" - templist.write(comb) -fivelist.close() -numblist.close() -templist.close() -print("\tdone") - -print("Creating final keyspace... Grab a beer.") -keyspace = open("keyspace.txt", "w") -with open("temp.txt") as templist: - with open("wordlists/6list.txt") as sixlist: - tlist = templist.readlines() - slist = sixlist.readlines() - for tword in tlist: - for sword in slist: - comb = tword.strip() + sword.strip() + "\n" - keyspace.write(comb) -templist.close() -sixlist.close() -keyspace.close() -os.remove("temp.txt") -print("\tdone") +log = logging.getLogger() +log.setLevel(logging.INFO) + +stream_handler = logging.StreamHandler(sys.stdout) +stream_handler.setLevel(logging.INFO) +formatter = logging.Formatter('%(asctime)s - %(threadName)s - %(levelname)s | %(message)s') +stream_handler.setFormatter(formatter) +log.addHandler(stream_handler) + + +FIVE_LIST = "wordlists/5list.txt" +FIVE_LIST_BIG = "wordlists/5list-big.txt" +SIX_LIST = "wordlists/6list.txt" +SIX_LIST_BIG = "wordlists/6list-big.txt" +NUM_LIST = "wordlists/numbers.txt" +TEMP_LIST = "temp.txt" +FORWARD = "/Volumes/Data/xfinity_forward.txt" +BACKWARD = "/Volumes/Data/xfinity_backward.txt" + + +def open_word_list(file_name): + with open(file_name) as f_in: + return [item.strip() for item in f_in.readlines()] + + +def write_list(file_name, list_data): + with open(file_name, 'a') as f_out: + f_out.write('\n'.join(list_data)) + + +def write_to_list_file(file_name, line_data): + with open(file_name, "a") as f_out: + f_out.write(line_data + "\n") + + +class XfinityWiFiPassword: + def __init__(self): + log.info("Xfinity WiFi Password Generator Started") + try: + os.remove(FORWARD) + except FileNotFoundError: + pass + try: + os.remove(BACKWARD) + except FileNotFoundError: + pass + self.five_list = open_word_list(FIVE_LIST) + # self.five_list_big = open_word_list(FIVE_LIST_BIG) + self.six_list = open_word_list(SIX_LIST) + # self.six_list_big = open_word_list(SIX_LIST_BIG) + self.numbers = open_word_list(NUM_LIST) + self.forward_list = [] + self.backward_list = [] + + def add_forward(self, password): + if sys.getsizeof(self.forward_list) >= 5000000: + write_list(FORWARD, self.forward_list) + self.forward_list.clear() + self.forward_list.append(password) + + def add_backward(self, password): + if sys.getsizeof(self.backward_list) >= 5000000: + write_list(FORWARD, self.backward_list) + self.backward_list.clear() + self.backward_list.append(password) + + def forward(self): + log.info("Creating forward passwords list") + for word1 in self.five_list: + for number in self.numbers: + for word2 in self.six_list: + self.add_forward(word1 + number + word2) + + def backward(self): + log.info("Creating backward passwords list") + for word1 in self.six_list: + for number in self.numbers: + for word2 in self.five_list: + self.add_backward(word1 + number + word2) + + +if __name__ == "__main__": + pass_gen = XfinityWiFiPassword() + pass_gen.forward() + pass_gen.backward() \ No newline at end of file From 7ee3d4756e2e1339b796065dafe297dbddd401bf Mon Sep 17 00:00:00 2001 From: Merval Date: Fri, 24 Mar 2023 16:45:10 -0700 Subject: [PATCH 2/3] Updated README and cleaned up xfinity-keyspace.py Also removed the reverse script. --- README.md | 5 ++-- xfinity-keyspace - Reverse.py | 35 ---------------------------- xfinity-keyspace.py | 43 +++++++++++++++++------------------ 3 files changed, 23 insertions(+), 60 deletions(-) delete mode 100644 xfinity-keyspace - Reverse.py diff --git a/README.md b/README.md index f116977..bde73e5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ex: fever4759harbor xfinity-keyspace.py - quick code to generate a wordlist for xfinity wifi passwords -wordlists - contains common 6 letter and 5 letter words as well as all 4 character numbers +wordlists - contains common 6-letter and 5-letter words as well as all 4 character numbers sources and tools - contains original wordlists, source file on where to find words, as well as scripts to manipulate them. For the 5list.txt and 6list.txt wordlists, I downloaded the top 4000 english words and pulled out all the 5 and 6 character words into lists. @@ -14,11 +14,10 @@ sources and tools - contains original wordlists, source file on where to find wo 1. Download the .zip 2. Install python 3. Run xfinity-keyspace.py -4. Run xfinity-keypace reverse.py (to start with 6 letter words) 4. Sit back and wait! # sizes -keyspace.txt will come out to 75.2 GB or 150.4 GB (if you run both) in size. 12.2 GB as compressed tar.gz file. +xfinity_forward.txt / xfinity_backward.txt will come out to 75.2 GB or 150.4 GB (if you run both) in size. 12.2 GB as compressed tar.gz file. (If you choose to use the big lists, just rename the files in the Python scripts, please note the files will be huge) diff --git a/xfinity-keyspace - Reverse.py b/xfinity-keyspace - Reverse.py deleted file mode 100644 index 93b2475..0000000 --- a/xfinity-keyspace - Reverse.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/python -# example xfinity wifi password: harbor7538fever -import os - -print("Creating temp list... Stand by.") -templist = open("temp.txt", "w") - -with open("wordlists/6list.txt") as sixlist: - with open("wordlists/numbers.txt") as numblist: - slist = sixlist.readlines() - nlist = numblist.readlines() - for fword in slist: - for numb in nlist: - comb = fword.strip() + numb.strip() + "\n" - templist.write(comb) -sixlist.close() -numblist.close() -templist.close() -print("\tdone") - -print("Creating final keyspace... Grab a beer!") -keyspace = open("keyspace6letter.txt", "w") -with open("temp.txt") as templist: - with open("wordlists/5list.txt") as fivelist: - tlist = templist.readlines() - flist = fivelist.readlines() - for tword in tlist: - for sword in flist: - comb = tword.strip() + sword.strip() + "\n" - keyspace.write(comb) -templist.close() -fivelist.close() -keyspace.close() -os.remove("temp.txt") -print("\tdone") diff --git a/xfinity-keyspace.py b/xfinity-keyspace.py index 4070f8c..8b11fe5 100644 --- a/xfinity-keyspace.py +++ b/xfinity-keyspace.py @@ -20,8 +20,8 @@ SIX_LIST_BIG = "wordlists/6list-big.txt" NUM_LIST = "wordlists/numbers.txt" TEMP_LIST = "temp.txt" -FORWARD = "/Volumes/Data/xfinity_forward.txt" -BACKWARD = "/Volumes/Data/xfinity_backward.txt" +FORWARD = "xfinity_forward.txt" +BACKWARD = "xfinity_backward.txt" def open_word_list(file_name): @@ -34,38 +34,36 @@ def write_list(file_name, list_data): f_out.write('\n'.join(list_data)) -def write_to_list_file(file_name, line_data): - with open(file_name, "a") as f_out: - f_out.write(line_data + "\n") - - class XfinityWiFiPassword: - def __init__(self): + def __init__(self, big_list=False): log.info("Xfinity WiFi Password Generator Started") - try: + self.batch_size_threshold = 5000000 # ~5MB + # Remove pre-existing files as to not create duplicates + # TODO: Implement a way to pick-up where left off. + if os.path.exists(FORWARD): os.remove(FORWARD) - except FileNotFoundError: - pass - try: + if os.path.exists(BACKWARD): os.remove(BACKWARD) - except FileNotFoundError: - pass - self.five_list = open_word_list(FIVE_LIST) - # self.five_list_big = open_word_list(FIVE_LIST_BIG) - self.six_list = open_word_list(SIX_LIST) - # self.six_list_big = open_word_list(SIX_LIST_BIG) + + if big_list: + self.five_list = open_word_list(FIVE_LIST_BIG) + self.six_list_big = open_word_list(SIX_LIST_BIG) + else: + self.five_list = open_word_list(FIVE_LIST) + self.six_list = open_word_list(SIX_LIST) + self.numbers = open_word_list(NUM_LIST) self.forward_list = [] self.backward_list = [] def add_forward(self, password): - if sys.getsizeof(self.forward_list) >= 5000000: + if sys.getsizeof(self.forward_list) >= self.batch_size_threshold: write_list(FORWARD, self.forward_list) self.forward_list.clear() self.forward_list.append(password) def add_backward(self, password): - if sys.getsizeof(self.backward_list) >= 5000000: + if sys.getsizeof(self.backward_list) >= self.batch_size_threshold: write_list(FORWARD, self.backward_list) self.backward_list.clear() self.backward_list.append(password) @@ -86,6 +84,7 @@ def backward(self): if __name__ == "__main__": - pass_gen = XfinityWiFiPassword() + # If you want the big list to process, change big_list to True + pass_gen = XfinityWiFiPassword(big_list=False) pass_gen.forward() - pass_gen.backward() \ No newline at end of file + pass_gen.backward() From da8af7c2fe1e6e9a62de8dd90295b11b24cc7450 Mon Sep 17 00:00:00 2001 From: Merval Date: Fri, 24 Mar 2023 16:48:20 -0700 Subject: [PATCH 3/3] Removed TEMP from xfinity-keyspace.py No longer needed TEMP path. --- xfinity-keyspace.py | 1 - 1 file changed, 1 deletion(-) diff --git a/xfinity-keyspace.py b/xfinity-keyspace.py index 8b11fe5..17756c5 100644 --- a/xfinity-keyspace.py +++ b/xfinity-keyspace.py @@ -19,7 +19,6 @@ SIX_LIST = "wordlists/6list.txt" SIX_LIST_BIG = "wordlists/6list-big.txt" NUM_LIST = "wordlists/numbers.txt" -TEMP_LIST = "temp.txt" FORWARD = "xfinity_forward.txt" BACKWARD = "xfinity_backward.txt"