jim fisher on 7 Jul 2010 17:44:50 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Simple Python Help WAS:Filtering Packets in Monitor Mode


It works, I just used a small test file so the ncurses went too fast -
poc was just print - this works with ncurses too!

#!/usr/bin/env python

from time import sleep
import curses
# create curses screen using whole display
stdscr = curses.initscr()
# I realize this is an infinite loop
# parse the CSV file
for line in open('foo-01.csv'):
    # look for the line with the right MAC
    index=line.find(':5a:84')
    while index != -1:
        start = index + 1
        index = line.find(':5a:84', start)

      # send the line to the screen
#        print line
        stdscr.addstr(0, 0, line)
	sleep(2)
      # redraw the screen
        stdscr.refresh()


sleep added so I could see results.


On 7/7/10, Jon Nelson <dotcop@gmail.com> wrote:
> On Wed, Jul 7, 2010 at 7:26 PM, jim fisher <jedijf@myfisher.org> wrote:
>
>> This works, without the ncurses stuff:
>
>
>> #!/usr/bin/env python
>>
>> import curses
>> # create curses screen using whole display
>> #stdscr = curses.initscr()
>> # I realize this is an infinite loop
>> # parse the CSV file
>> for line in open('foo-01.csv'):
>>    # look for the line with the right MAC
>>     index=line.find(':5a:84')
>>    while index != -1:
>>        start = index + 1
>>        index = line.find(':5a:84', start)
>>
>>      # send the line to the screen
>>         print line
>> #        stdscr.addstr(0, 0, line)
>>       # redraw the screen
>> #        stdscr.refresh()
>> # I realize I am not properly cleaning up, but will get to that later
>> jimf@dell6000:~$
>>
>>
> Jim,
>
> I didn't realize that I cut out some important stuff when I changed the
> subject line.
>
> I am trying to filter the output of airodump-ng so that I can focus on one
> MAC.  It was suggested that I might have to resort to writing a script and
> using a FIFO.  The constant output file for airodump-ng, foo-01.csv, acts
> like one.  So what I was trying to accomplish with the script was just read
> in the file, print the pertinent line, and loop.  That's the reason for the
> ncurses stuff, otherwise the lines are printed one after the other.
>
> I hope that makes sense.
>
> Jon
>


-- 
jim fisher
Jedijf

irc freenode  #ubuntu-us-pa
www.myfisher.org

"Do, or do not. There is no 'try.'"
  --  Jedi Master Yoda
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug