Skip to content

Commit

Permalink
new stuff on Sniffer. Now, a list of each flow is created. I just nee…
Browse files Browse the repository at this point in the history
…d to commit it on the databasa, and it is done :)
  • Loading branch information
anderson authored and anderson committed Jun 28, 2017
1 parent 433ccdc commit 4b871dd
Show file tree
Hide file tree
Showing 7 changed files with 270 additions and 127 deletions.
82 changes: 68 additions & 14 deletions MesserTG/sniffer/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions MesserTG/sniffer/FlowId.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from fnvhash import fnv1a_32
from fnvhash import fnv1a_64
import collections

class OrderedSet(collections.MutableSet):
Expand Down Expand Up @@ -78,7 +79,8 @@ def getNumberOfFlows(self, flow_string):
:param flow_string: concatenation of ether_type|ip_src|ip_dst|ip_proto|src_port|dst_port
:return: current number of flows
'''
flow_hash = fnv1a_32(bytes(flow_string, 'ascii'))
#flow_hash = fnv1a_32(bytes(flow_string, 'ascii'))
flow_hash = fnv1a_64(bytes(flow_string, 'ascii'))
self._set_flow_hashes.add(flow_hash);
return len(self._set_flow_hashes)

Expand All @@ -92,7 +94,8 @@ def getFlowId(self, flow_string):
:param flow_string: concatenation of ether_type|ip_src|ip_dst|ip_proto|src_port|dst_port
:return:
"""
flow_hash = fnv1a_32(bytes(flow_string, 'ascii'))
#flow_hash = fnv1a_32(bytes(flow_string, 'ascii'))
flow_hash = fnv1a_64(bytes(flow_string, 'ascii'))
self._set_flow_hashes.add(flow_hash);
return self._set_flow_hashes.index(flow_hash)

Expand Down
Binary file modified MesserTG/sniffer/__pycache__/FlowId.cpython-35.pyc
Binary file not shown.
Binary file modified MesserTG/sniffer/__pycache__/traffic.cpython-35.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions MesserTG/sniffer/liveCapture_enp3s0.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[INFO] (MainThread) Program execution time: 16.228895 s
[INFO] (MainThread) Program execution time: 18.069224 s
[INFO] (MainThread) Program execution time: 16.261960 s
[INFO] (MainThread) Program execution time: 16.701102 s
[INFO] (MainThread) Program execution time: 16.322237 s
[INFO] (MainThread) Program execution time: 16.798822 s
Loading

0 comments on commit 4b871dd

Please sign in to comment.