bonsaiviking / p0fclient Goto Github PK
View Code? Open in Web Editor NEWA Python client for p0f
A Python client for p0f
Just wanted to say first that this idea is really great because it allows me to introduce p0f in any python project.
Maybe I was doing something incorrectly..
I launched :
p0f as sudo ./p0f -i br0 -s "/var/run/p0f.sock" -d -u alis -o /var/log/p0f.log
where ls -la "/var/run/p0f.sock" :
srw-rw-rw- 1 root root 0 Nov 20 22:57 /var/run/p0f.sock
Then, installed p0f-client and launched it as :
p0f-client /var/run/p0f.sock 192.168.2.4
/var/run/p0f.sock
Traceback (most recent call last):
File "/usr/local/bin/p0f-client", line 16, in
info = p0f.query(addr)
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 77, in query
a = ipaddr.IPAddress(ip)
File "/usr/local/lib/python2.7/dist-packages/ipaddr.py", line 78, in IPAddress
address)
ValueError: '/var/run/p0f.sock' does not appear to be an IPv4 or IPv6 address
but if i try without specifying "/var/run/p0f.sock" as :
p0f-client 192.168.2.4
/var/run/p0f.sock
Traceback (most recent call last):
File "/usr/local/bin/p0f-client", line 16, in
info = p0f.query(addr)
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 83, in query
return self.parse_response( self.sock.recv(232) )
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 48, in parse_response
raise CommError, "Bad query"
p0fclient.p0fclient.CommError: Bad query
netstat returns :
sudo netstat -lapn | grep p0f
unix 2 [ ACC ] STREAM LISTENING 702256798 5027/p0f /var/run/p0f.sock
As I ran p0f-client 192.168.5.136
I got the following:
Traceback (most recent call last):
File "/usr/local/bin/p0f-client", line 16, in
info = p0f.query(addr)
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 84, in query
return self.parse_response( self.sock.recv(232) )
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 48, in parse_response
raise CommError, "Bad query"
p0fclient.p0fclient.CommError: Bad query
I did not specify the socket because the socket is at the default location.
As I uncommented the try & exception clause I got the following error instead:
Traceback (most recent call last):
File "/usr/local/bin/p0f-client", line 17, in
info = p0f.query(addr)
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 82, in query
return self.parse_response( self.sock.recv(232) )
File "/usr/local/lib/python2.7/dist-packages/p0fclient/p0fclient.py", line 52, in parse_response
info = struct.unpack_from("7L h 2b 32s 32s 32s 32s 32s 32s", blob, 8)
struct.error: unpack_from requires a buffer of at least 252 bytes
I tried to change the buffer size to 252 but that did not work either.
Please help. @bonsaiviking
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.