hkm / whoishere.py

WIFI Client Detection - Identify people by assigning a name to a device performing a wireless probe request.
227 stars 52 forks source link

Memory issue #2

Closed strasharo closed 7 years ago

strasharo commented 7 years ago

Hello. I'm running the script on a Raspberry Zero running Raspbian 8.0 and Python 2.7.9 The wireless adapter that I'm using is Alfa AWUS036NHA. The script runs fine for a while, except that the memory usage grows up steadily over time and eventually I run out of memory at some point:

pi@zero1:~ $ date;ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | grep python | egrep -vi 'sudo|grep'
Fri 24 Mar 16:55:50 EET 2017
   752.726562 Mb python whoishere.py
pi@zero1:~ $ date;ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | grep python | egrep -vi 'sudo|grep'
Fri 24 Mar 16:56:19 EET 2017
   767.839844 Mb python whoishere.py
pi@zero1:~ $ date;ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | grep python | egrep -vi 'sudo|grep'
Fri 24 Mar 16:56:25 EET 2017
   770.789062 Mb python whoishere.py
pi@zero1:~ $ date;ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | grep python | egrep -vi 'sudo|grep'
Fri 24 Mar 16:56:34 EET 2017
   775.222656 Mb python whoishere.py
pi@zero1:~ $ date;ps -eo size,pid,user,command | awk '{ hr=$1/1024 ; printf("%13.6f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' | sort | grep python | egrep -vi 'sudo|grep'
Fri 24 Mar 17:00:36 EET 2017
   801.414062 Mb python whoishere.py
pi@zero1:~ $

Is it a memory leak or something this behavior is expected?

hkm commented 7 years ago

The issue has been fixed. The problem was that scapy was storing packets. Fixed with sniff(..., store=0)

strasharo commented 7 years ago

Thanks a lot.