|
Revision 53, 0.8 kB
(checked in by gak, 21 months ago)
|
|
|
-
Property svn:executable set to
*
-
Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 | #!/usr/bin/env python |
|---|
| 2 | |
|---|
| 3 | import cPickle as pickle |
|---|
| 4 | import sys |
|---|
| 5 | import time |
|---|
| 6 | |
|---|
| 7 | import betterprint as pprint |
|---|
| 8 | |
|---|
| 9 | from ap import AccessPoint |
|---|
| 10 | |
|---|
| 11 | class DumpPickler(object): |
|---|
| 12 | |
|---|
| 13 | def __init__(self): |
|---|
| 14 | self.dump_file = sys.argv[1] |
|---|
| 15 | self.dest_file = 'all.dump' |
|---|
| 16 | |
|---|
| 17 | def read_dump(self): |
|---|
| 18 | if not self.dump_file: |
|---|
| 19 | return |
|---|
| 20 | d = open(self.dump_file).read() |
|---|
| 21 | f = open(self.dest_file, 'a') |
|---|
| 22 | lines = d.split('\n') |
|---|
| 23 | |
|---|
| 24 | t = time.time() |
|---|
| 25 | |
|---|
| 26 | for line in lines: |
|---|
| 27 | |
|---|
| 28 | bits = line.split(',') |
|---|
| 29 | |
|---|
| 30 | if len(bits) != 15: |
|---|
| 31 | continue |
|---|
| 32 | if bits[0] == 'BSSID': |
|---|
| 33 | continue |
|---|
| 34 | |
|---|
| 35 | f.write('%f,%s\n' % (t, line)) |
|---|
| 36 | |
|---|
| 37 | def loop(self): |
|---|
| 38 | while 1: |
|---|
| 39 | self.read_dump() |
|---|
| 40 | time.sleep(1) |
|---|
| 41 | |
|---|
| 42 | DumpPickler().loop() |
|---|