I am writing code that sends out an ICMP request to all hosts on a network and then print out in to a table if they are up or down.
The problem im having is with tabulate and not being able to merge the top row cells so i can centre the network address.
this is what i have so far. I have also tried using tabulate merge module but im not able to get it to work correctly.
import sys from scapy.all import * from tabulate import tabulate import tabulate_cell_merger.tabulate_cell_merger def merge(clients, status): merged_list = tuple(zip(clients, status)) return merged_list print("") print(f"\n\nWelcome to the NetworkScanner!\nType NWS.py -h for usage\n\n") if sys.argv == str("-h"): print("type in the IP Address you want to check or use CIDR to search a range\n") print("Usage>>: <IP_ADDRESS/CIDR> <-v = verbose off, --v == verbose on> \n\n") sys.exit(0) ip = Net(sys.argv) ip_list =  clients =  status =  verb = False if sys.argv == str("-v"): verb = False elif sys.argv == str("--v"): verb = True for add in ip: ip_list.append(add) for ips in ip_list: pac = Ether(dst = "ff:ff:ff:ff:ff:ff")/IP(dst=ips)/ICMP() ans = srp1(pac,timeout=0.5, verbose = verb) if ans is None: clients.append(ips) status.append("down") else: clients.append(ips) status.append("up") data = merge(clients, status) header = [sys.argv] print(tabulate(data, headers = header, tablefmt = 'fancy_grid'))
Thanks in advance for any help. This is for a cyber security assessment so just require advice. No completed code