1

I want to print out a table that shows all the wireless networks around (sniffing beacon frames). But I want the content of the table to be changeable. For instants:

  • change amount of received frames
  • remove the access point if it's no longer in range

I tested some modules, such as terminaltables etc., but I can just print out the table and leave it as it is, without changing anything.

from scapy.all import *

def pckt_hndlr(pckt):
    if pckt.haslayer(Dot11):
        if pckt.type == 0 and pckt.subtype == 8:

             # PRINT THE INFORMATION OF THE PACKETS IN A TABLE

sniff(iface='wlan0', prn=pckt_hndlr, store=0)

If I add the table to pckt_hndlr it's going to be printed out each time I receive a packet.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
chrizator
  • 71
  • 1
  • 9
  • 1
    what you need is to redraw the table every time. there are several examples you can find online. Something like this might inspire you: http://stackoverflow.com/questions/2122385/dynamic-terminal-printing-with-python – Wissam Youssef Mar 28 '17 at 19:11
  • Thank you! But I think the table would flash and blink when redrawing it. I'm just wondering how airodump-ng is able to do it so smoothly, it's exactly what I want. Is it because Python doesn't support that? – chrizator Mar 28 '17 at 19:26
  • 1
    you mean flash and blink because of delays between flushing and redraw? how long does it take to draw your entire table once? – Wissam Youssef Mar 28 '17 at 19:47
  • It doesn't take long, but it's quite noticeable.. – chrizator Mar 28 '17 at 19:59
  • 1
    then curses/ncurses it is, draw the table then individually fill it. it is considerably more complex. but it also mentioned in the same link. – Wissam Youssef Mar 28 '17 at 20:10
  • Yes, I saw this. I'm going to try this out! Thank you for helping me. – chrizator Mar 28 '17 at 20:53
  • no problem :) :) – Wissam Youssef Mar 28 '17 at 21:38

0 Answers0