netplier-tool / NetPlier

NetPlier: Probabilistic Network Protocol Reverse Engineering from Message Traces
GNU General Public License v3.0
58 stars 21 forks source link

Running inference on a protocol without a type produces an error. #4

Closed jaredchandler closed 3 years ago

jaredchandler commented 3 years ago

When run without a type, NetPlier produces an error:

python NetPlier/netplier/main.py -i NetPlier/data/ntp_100.pcap -o NetPlier/tmp/ntp2 -mt


Eliminating: m5: 100% 90/90 [00:00<00:00, 1058.70it/s]
Eliminating: m5: 100% 94/94 [00:00<00:00, 1046.49it/s]
ERROR:root:The protocol_type is not unknown
Traceback (most recent call last):
  File "NetPlier/netplier/main.py", line 58, in <module>
    clustering_result_request_true = clustering.cluster_by_kw_true(messages_request)
  File "/content/NetPlier/netplier/clustering.py", line 70, in cluster_by_kw_true
    kw = self.get_true_keyword(message)
  File "/content/NetPlier/netplier/clustering.py", line 99, in get_true_keyword
    if type(kw).__name__ == "bytes":
UnboundLocalError: local variable 'kw' referenced before assignment```
yapengye commented 3 years ago

Fixed. Add some checking for protocol_type when computing the ground truth and evaluating the clustering results.

The argument -t/--type is required to compute the ground truth. You could also comment the codes for evaluation in main.py if they are not needed.

jaredchandler commented 3 years ago

Awesome! Thank you!