def gpl_arp_spoof(target_IP, gateway_IP, ignore_IP_exists_check=False, print_log=False): global ARP_SPOOF_RUN try: gpl_set_ipv4_forward_state(True) Target_State = gpl_ipv4_icmp_exists_check(target_IP) Gateway_State = gpl_ipv4_icmp_exists_check(gateway_IP) if (Target_State == True and Gateway_State == True) or ignore_IP_exists_check: Target_MAC = gpl_ip_to_mac(target_IP) Gateway_MAC = gpl_ip_to_mac(gateway_IP) while ARP_SPOOF_RUN: if print_log: Handler(Error_Levels.Alert, 'Send ArpSpoof between "' + target_IP + '" (' + Target_MAC + ') and "' + gateway_IP + '" (' + Gateway_MAC + ')') # target -> hacker -> gateway gpl_arp_spoof_fake_once(target_IP, Target_MAC, gateway_IP) # gatewat -> hacker -> target gpl_arp_spoof_fake_once(gateway_IP, Gateway_MAC, target_IP) gpl_sleep(ARP_Spoof_Resend_Sleep, manage_ctrl_C_and_exit=False) ARP_SPOOF_RUN = True else: return None except (KeyboardInterrupt, EOFError): gpl_set_ipv4_forward_state(False) raise KeyboardInterrupt
"OFF or ON ? ", ['OFF', 'ON', 'Automatic (Maybe not work)', 'Show Status']) Address = '/sys/class/leds/' + LEDs[Choose - 1] + '/brightness' if Value == 4: # show status Status = gpl_read_from_file( Address, on_access_failed_text="Failed to read LED status.") if Status != None: if Status == "255\n": Handler(Error_Levels.Alert, 'Is automatic.') elif Status == "1\n": Handler(Error_Levels.Alert, 'Is on.') elif Status == "0\n": Handler(Error_Levels.Alert, 'Is off.') else: Handler( Error_Levels.Failed_Job, "Can't detect. Status Code: " + Status.replace("\n", '')) gpl_sleep() else: # set status Status = Status_Codes[Value] gpl_write_to_file(Address, Status + "\n", on_access_error_text="Failed to set status!") if Status != None: Handler(Error_Levels.Alert, 'LED status changed.') gpl_sleep() except (EOFError, KeyboardInterrupt): Handler(Error_Levels.Failed_Job, "Exit with user request.")
def gpl_ask_save_to_file( just_ask=False, bytes_to_write=b'', string_to_write='', is_string_to_write=True, ask_address_text='Enter address/name of file to load (q to exit): ', ask_address_text_color='white', on_ask_overwrite_text='This is a file, Overwrite [y/n/q] ? ', on_ask_overwrite_text_color='yellow', on_file_not_have_enough_access_text='File not have enough access to write.', on_file_not_have_enough_access_text_color='red', on_file_not_have_enough_access_sleep_by_sec=1, on_file_is_dir_text='This is a directory. Should be file.', on_file_is_dir_text_color='red', on_file_is_dir_sleep_by_sec=1): while True: gpl_clear() address = gpl_input(ask_address_text, ask_address_text_color) if not exists(address): if just_ask: return address elif is_string_to_write: try: file = open(address, 'w') file.write(string_to_write) except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_have_enough_access_sleep_by_sec) else: file.close() return else: try: file = open(address, 'wb') file.write(bytes_to_write) except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_have_enough_access_sleep_by_sec) else: file.close() return elif isdir(address): print(colored(on_file_is_dir_text, on_file_is_dir_text_color)) gpl_sleep(on_file_is_dir_sleep_by_sec) elif isfile(address): gpl_clear() choose = gpl_input(on_ask_overwrite_text, on_ask_overwrite_text_color) if choose.lower() == 'y' or choose.lower() == 'yes': if just_ask: return address elif is_string_to_write: try: file = open(address, 'w') file.write(string_to_write) except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_have_enough_access_sleep_by_sec) else: file.close() return else: try: file = open(address, 'wb') file.write(bytes_to_write) except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_have_enough_access_sleep_by_sec) else: file.close() return
def gpl_ask_load_from_file( just_ask=False, read_lines=False, read_content=False, read_bytes=False, ask_address_text='Enter address/name of file to load (q to exit): ', ask_address_text_color='white', on_file_not_exists_text='File not exists or not a file!', on_file_not_exists_text_color='red', on_file_not_exists_sleep_by_sec=1, on_file_not_have_enough_access_text='File not have enough access to read.', on_file_not_have_enough_access_text_color='red', on_file_not_have_enough_access_sleep_by_sec=1, on_file_is_dir_text="It's a directory. should be a file.", on_file_is_dir_text_color='red', on_file_is_dir_sleep_by_sec=1): while True: gpl_clear() address = gpl_input(ask_address_text, ask_address_text_color) if not exists(address): print( colored(on_file_not_exists_text, on_file_not_exists_text_color)) gpl_sleep(on_file_not_exists_sleep_by_sec) elif isfile(address): if just_ask: return address elif read_content: try: file = open(address, 'r') data = file.read() except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_have_enough_access_sleep_by_sec) else: file.close() return data elif read_lines: try: file = open(address, 'r') data = file.readlines() except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_exists_sleep_by_sec) else: file.close() lst = [] for item in data: if item[-1:] == "\n": lst.append(item[:-1]) else: lst.append(item) return lst elif read_bytes: try: file = open(address, 'rb') data = file.read() except: print( colored(on_file_not_have_enough_access_text, on_file_not_have_enough_access_text_color)) gpl_sleep(on_file_not_exists_sleep_by_sec) else: file.close() return data elif isdir(address): print(colored(on_file_is_dir_text, on_file_is_dir_text_color)) gpl_sleep(on_file_is_dir_sleep_by_sec)
print( colored(" 4. ", 'magenta') + colored( "We're collecting some data from your system\n\t(like: run times count. G3nius-Tools errors etc…) to improve G3nius.\n\tThis is optional,\n\tYou can set to 'False' value in 'lib/config/Main_Configs.py' file.", 'cyan')) choose = gpl_input("Type 'yes' to agree terms & rules: ", clear_and_banner_before=False) if choose.lower() == 'yes': try: open(Location + '/lib/agree', 'w').close() except: Handler(Error_Levels.Critical, "Can't create file! check access of folder.") break else: Handler(Error_Levels.Failed_Job, 'Type "yes" to agree.') gpl_sleep(1) # checking if give parameters if len(argv) > 1: Delete_TMP_Folder = True if '-h' in argv or '--help' in argv: print(colored('HELP PAGE:', 'white')) print(colored('\n Parameters:', 'white')) print( colored('\n -h ', 'green') + colored(',', 'magenta') + colored(' --help', 'green') + colored('\n Get help page.', 'blue')) print( colored('\n -m <Module_Name>', 'green') + colored(',', 'magenta') + colored(' --module <Module_Name> ', 'green') +