def do_command(params): if (params.command == 'q'): return False elif (params.command == 'l'): results = api.search_records(params, '') display.formatted_records(results) elif (params.command[:2] == 'g '): r = api.get_record(params, params.command[2:]) if r: r.display() elif (params.command[:2] == 'r '): api.rotate_password(params, params.command[2:]) elif (params.command == 'c'): print(chr(27) + "[2J") elif (params.command[:2] == 's '): results = api.search_records(params, params.command[2:]) display.formatted_records(results) elif (params.command[:2] == 'b '): results = api.search_records(params, params.command[2:]) for r in results: api.rotate_password(params, r.record_uid) elif (params.command == 'd'): api.sync_down(params) elif (params.command == 'a'): api.add_record(params) elif (params.command == 'h'): display.formatted_history(stack) elif (params.command == 'debug'): if params.debug: params.debug = False print('Debug OFF') else: params.debug = True print('Debug ON') elif params.command == '': pass else: print('\n\nCommands:\n') print(' d ... download & decrypt data') print(' l ... list folders and titles') print(' s <regex> ... search with regular expression') print(' g <uid> ... get record details for uid') print(' r <uid> ... rotate password for uid') print(' b <regex> ... rotate password for matches of regular expression') print(' a ... add a new record interactively') print(' c ... clear the screen') print(' h ... show command history') print(' q ... quit') print('') if params.command: if params.command != 'h': stack.append(params.command) stack.reverse() return True
if dns_validate_failed: safety_weight -= 55 print 'Checking public IP address to see if listed under a known U.S. wireless carrier' reverse_ip_lookup_req = api.reverse_ip(public_ip) reverse_ip_lookup = reverse_ip_lookup_req.json() if reverse_ip_lookup['isWirelessProvider']: safety_weight -= 30 print RED + 'Current IP address owner is ' + reverse_ip_lookup['org'] + ' and they ARE a US cellphone wireless provider.' + ENDC print RED + 'This connection could potentially be routed through a 3g/4g SIM card.' + ENDC else: print YELLOW + 'Current IP address owner is ' + reverse_ip_lookup['org'] + ' and they are not a US cellphone wireless provider.' + ENDC # Check the default gateway IP address if router_ip == '172.16.42.1': safety_weight -= 10 print YELLOW + 'Router IP address is a known default IP address of a Wi-Fi Pineapple.' + ENDC print 'We are ' + str(safety_weight) + '% sure you are safe.' if safety_weight < 55: print 'We recommend not staying on this network or connecting to a VPN.' else: print 'Adding record into database.' add_record_req = api.add_record( network_info['ssid'], network_info['bssid'], network_info['client_mac'], network_info['security_type'], public_ip, hops) if add_record_req.status_code is 200: print add_record_req.json()['message'] print 'Complete.' else: print RED + add_record_req.json()['message'] + ENDC
def do_command(params): if (params.command == 'q'): return False elif (params.command == 'l'): results = api.search_records(params, '') display.formatted_records(results) elif (params.command[:2] == 'g '): r = api.get_record(params, params.command[2:]) if r: r.display() elif (params.command[:2] == 'r '): api.rotate_password(params, params.command[2:]) elif (params.command == 'c'): print(chr(27) + "[2J") elif (params.command[:2] == 's '): results = api.search_records(params, params.command[2:]) display.formatted_records(results) elif (params.command[:2] == 'b '): results = api.search_records(params, params.command[2:]) for r in results: api.rotate_password(params, r.record_uid) elif (params.command == 'd'): api.sync_down(params) elif (params.command == 'a'): api.add_record(params) elif (params.command == 'h'): display.formatted_history(stack) elif (params.command == 'debug'): if params.debug: params.debug = False print('Debug OFF') else: params.debug = True print('Debug ON') elif params.command == '': pass else: print('\n\nCommands:\n') print(' d ... download & decrypt data') print(' l ... list folders and titles') print(' s <regex> ... search with regular expression') print(' g <uid> ... get record details for uid') print(' r <uid> ... rotate password for uid') print( ' b <regex> ... rotate password for matches of regular expression' ) print(' a ... add a new record interactively') print(' c ... clear the screen') print(' h ... show command history') print(' q ... quit') print('') if params.command: if params.command != 'h': stack.append(params.command) stack.reverse() return True