0

I'm trying to combine a couple of tables that I've already created into one large table output.

Input:

cnt = Counter()

for ip in srcIP:

    cnt[ip] += 1

table1= PrettyTable(["SRC.IP", "Count"])

for ip, count in cnt.most_common():

    table1.add_row([ip, count])

print(table1)    

cnt3 = Counter()

for ip in dstIP:

    cnt3[ip] += 1

table3 = PrettyTable(["DST.IP", "Count"])

for ip, count in cnt3.most_common():

    table3.add_row([ip, count])

print(table3)

Output: is the the 2 tables separated (IP.src, count) and (IP.dst, count) with the list of corresponding numbers. (https://i.stack.imgur.com/ez6YL.png)

Combined Tables Input:

columns = ["IP.src", "Count"]

Master_table = PrettyTable()

for ip, count in cnt.most_common():

    Master_table.add_column(columns[0], [ip])

    Master_table.add_column(columns[1], [count])

print(Master_table)

The wanted output should be a table with the columns:

[IP.src, Count (ip.src), IP.dst, Count (ip.dst)]

and the corresponding data under each column.

parenthesis do not need to be included in the column headers

Number23
  • 1
  • 1

0 Answers0