def get_liste(Table, plugins, ordered_liste, ordered, exp=True, page=1): button_list = [] try: filtre_d = ordered[:-1] if ordered[-1] == "d" else ordered + "d" for element in (Table.select().where(exp).order_by( ordered_liste[ordered][0]).paginate(int(page), NUMBER_LISTE)): line = element.str_compact() if line: button_list.append( InlineKeyboardButton( line, callback_data="{}_info_{}_{}".format( plugins, element.id, ordered), )) if int(page) != 1: button_list.append( InlineKeyboardButton( "Précédent", callback_data="{}_lister_st_{}_{}".format( plugins, int(page) - 1, ordered), )) if len(button_list) != 1: button_list.append( InlineKeyboardButton( "Suivant", callback_data="{}_lister_st_{}_{}".format( plugins, int(page) + 1, ordered), )) button_list.append( InlineKeyboardButton("Retour", callback_data="{}_home".format(plugins))) return InlineKeyboardMarkup(build_menu(button_list, n_cols=1)) except Exception as e: logging.warning("Aucun élément dans la liste\n" + str(e)) if int(page) != 1: button_list.append( InlineKeyboardButton( "Précédent", callback_data="{}_lister_st_{}_{}".format( plugins, int(page) - 1, ordered), )) button_list.append( InlineKeyboardButton("Retour", callback_data="{}_home".format(plugins))) return InlineKeyboardMarkup(build_menu(button_list, n_cols=1))
def creer_bouton(): """Creer la liste de boutons.""" button_list = [ InlineKeyboardButton("liste", callback_data="log_liste"), InlineKeyboardButton("supprimer", callback_data="log_supprimer"), ] return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def creer_button_ip(): button_list = [] for ip in Ip.select(): button_list.append( InlineKeyboardButton(ip.str_compact(), callback_data="carto_info_{}".format(ip.id))) return InlineKeyboardMarkup(build_menu(button_list, n_cols=1))
def creer_bouton(demande): """Creer la liste de boutons.""" button_list = [] re_ip = re.compile("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+") re_tel = re.compile("[0-9]+") if re_ip.match(demande): button_list.append( InlineKeyboardButton("Whois", callback_data="scan_wi_" + demande)) elif "@" in demande: button_list.append( InlineKeyboardButton("Virustotal", callback_data="scan_vt_" + demande)) elif re_tel.match(demande): button_list.append( InlineKeyboardButton("Telephone", callback_data="scan_tel_" + demande)) else: button_list.append( InlineKeyboardButton("Analyse HTTP", callback_data="scan_ob_" + demande)) button_list.append( InlineKeyboardButton("Virustotal", callback_data="scan_vt_" + demande)) button_list.append( InlineKeyboardButton("Whois", callback_data="scan_wi_" + demande)) return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def creer_bouton(): """Creer la liste de boutons.""" button_list = [ InlineKeyboardButton("afficher", callback_data="logwatch_liste"), InlineKeyboardButton("etat job", callback_data="logwatch_job"), ] return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def creer_bouton(): """Creer la liste de boutons.""" button_list = [ InlineKeyboardButton("Graphique", callback_data="carto_graph"), InlineKeyboardButton("Lister", callback_data="carto_lister"), InlineKeyboardButton("Ping All", callback_data="carto_pingall"), ] return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def creer_bouton(): """Creer la liste de boutons.""" button_list = [ InlineKeyboardButton("Dernières alertes", callback_data="nids_test"), InlineKeyboardButton("Etat job", callback_data="nids_job"), InlineKeyboardButton("Règles Suricata", callback_data="nids_rules"), ] return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def creer_bouton(): """Creer la liste de boutons.""" button_list = [ InlineKeyboardButton("Rechercher une alerte manuellement", callback_data="arpwatch_alert"), InlineKeyboardButton("Etat du job d'alerting", callback_data="arpwatch_job"), ] return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))
def carto_creer_bouton_info(id, filtre): button_list = [] button_list.append( InlineKeyboardButton("Ping", callback_data="carto_ping_{}_{}".format( id, filtre))) button_list.append( InlineKeyboardButton("Scan", callback_data="carto_scan_{}_{}".format( id, filtre))) button_list.append( InlineKeyboardButton("Supprimer", callback_data="carto_scan_{}_{}".format( id, filtre))) button_list.append( InlineKeyboardButton("Modifier", callback_data="carto_modifier_{}_{}".format( id, filtre))) button_list.append( InlineKeyboardButton("Retour", callback_data="carto_lister_{}".format(filtre))) return InlineKeyboardMarkup(build_menu(button_list, n_cols=2))