ahlashkari / NTLFlowLyzer

GNU General Public License v3.0
31 stars 9 forks source link

No UDP protocol #22

Closed Yesisyes closed 1 month ago

Yesisyes commented 1 month ago

Hi, hope everyone is well. I ran the NTLFlowLyzer -c command to get a csv file. But I didn't get an analysis of the UDP protocol. Have you changed to only analyze TCP flows? But the output use case you gave has UDP protocol analysis. This makes me confused. I hope you can answer it. Thank you very much. Below is my running log.


(venv) ym@ydeMac-mini NTLFlowLyzer-master % NTLFlowLyzer -c /Users/ym/NTLFlowLyzer-master/NTLFlowLyzer/config.json You initiated NTLFlowLyzer!

Analyzing the /Users/ym/Downloads/test/vpn_2.pcap ... The input PCAP file contains 283565 packets. Parser has started... Analyzing /Users/ym/Downloads/test/vpn_2.pcap

Number and percentage of IP packets: Total IP packets: 283565 Percentage of IP packets: 100.00%

Number and percentage of TCP packets: Total TCP packets: 277858 Percentage of TCP packets: 97.99%

Number and percentage of UDP packets: Total UDP packets: 5707 Percentage of UDP packets: 2.01%

Top 10 Application Layer Protocols: Port 56686 (Unknown): 22294 packets, 7.86% Port 54512 (Unknown): 11157 packets, 3.93% Port 53148 (Unknown): 9376 packets, 3.31% Port 47205 (Unknown): 5655 packets, 1.99% Port 56682 (Unknown): 5501 packets, 1.94% Port 443 (HTTPS): 5305 packets, 1.87% Port 56356 (Unknown): 4469 packets, 1.58% Port 53868 (Unknown): 4043 packets, 1.43% Port 3127 (Unknown): 3617 packets, 1.28% Port 52895 (Unknown): 3520 packets, 1.24%

200000 number of packets has been processed... End of parsing pcap file(s).

283565 packets analyzed and 2525 flows created in total. ################################################## Parser Report: ################################################## Number and percentage of IP packets: Total IP packets: 283565 Percentage of IP packets: 100.00%

Number and percentage of TCP packets: Total TCP packets: 277858 Percentage of TCP packets: 97.99%

Number and percentage of UDP packets: Total UDP packets: 5707 Percentage of UDP packets: 2.01%

##################################################

Preparing the output file... Extracting features of 2525 number of flows... Extracting finished, lets go for final writing... Writing the last 2525 flows with extracted features... Writing finished, lets wrapp up! Results are ready!

Yesisyes commented 1 month ago

And I have one more question. For the same pcap file, there are two results of Src IP,Dst IP analyzed by CICFlowMeter. However, there is only one result for Src IP,Dst IP analyzed by NTLFlowLyzer. Why does this happen? Attached below are screenshots of my tests and test files. image 388e5042-c07c-48e1-81d4-a01edd2446c6 test_result.zip

moein-shafi commented 1 month ago

Hi @Yesisyes, Thank you for reaching out and for your engagement with NTLFlowLyzer.

UDP Protocol Analysis

Regarding the UDP protocol analysis, it is currently not supported in NTLFlowLyzer, although it is on our future roadmap. Initially, we included UDP analysis similar to CICFlowMeter. However, after further investigation, we realized that defining UDP flows in a manner similar to TCP is not ideal since UDP is not connection-based. This led to the decision to pause UDP analysis for now. Rest assured, we are actively working on adding comprehensive UDP support in future versions.

Differences in Flow Output Between NTLFlowLyzer and CICFlowMeter

Concerning the differences in the outputs between NTLFlowLyzer and CICFlowMeter, this discrepancy arises from how each tool handles flow termination. In NTLFlowLyzer, a flow is closed based on the following conditions:

  1. Two FIN Flags: Detection of two FIN flags, one in each direction.
  2. One RST Flag: Detection of an RST flag.
  3. Flow Timeout: Reaching the maximum flow timeout.
  4. Inactivity Timeout: Flow inactivity for a specified period.

In your provided CSV files and as can be seen in the following screenshots, the first flow is closed upon receiving the second FIN flag (one in each direction), and the second flow is closed upon detecting an RST flag.

image

CICFlowMeter also closes flows based on detecting two FIN flags or one RST flag, as indicated in their source file.

image image

However, in the CSV file generated by CICFlowMeter there is no RST flag and there is only one FIN flag! So there might be other underlying issues causing the discrepancies you observed.

image

After analyzing your attached pcap file, it appears there are three packets with FIN flags and one with RST. In the output from CICFlowMeter, only one FIN flag is shown, suggesting there might be issues in its packet or flag reading process. In contrast, NTLFlowLyzer correctly detects all three FIN flags. Here are the relevant screenshots:

image

image

I hope this detailed explanation clarifies the differences and addresses your questions. We appreciate your understanding and support as we continue to improve NTLFlowLyzer. Your feedback is invaluable to us, and we are committed to enhancing the tool based on user experiences and suggestions.

Thank you once again for your engagement.

Yesisyes commented 1 month ago

Hi @Yesisyes, Thank you for reaching out and for your engagement with NTLFlowLyzer.

UDP Protocol Analysis

Regarding the UDP protocol analysis, it is currently not supported in NTLFlowLyzer, although it is on our future roadmap. Initially, we included UDP analysis similar to CICFlowMeter. However, after further investigation, we realized that defining UDP flows in a manner similar to TCP is not ideal since UDP is not connection-based. This led to the decision to pause UDP analysis for now. Rest assured, we are actively working on adding comprehensive UDP support in future versions.

Differences in Flow Output Between NTLFlowLyzer and CICFlowMeter

Concerning the differences in the outputs between NTLFlowLyzer and CICFlowMeter, this discrepancy arises from how each tool handles flow termination. In NTLFlowLyzer, a flow is closed based on the following conditions:

  1. Two FIN Flags: Detection of two FIN flags, one in each direction.
  2. One RST Flag: Detection of an RST flag.
  3. Flow Timeout: Reaching the maximum flow timeout.
  4. Inactivity Timeout: Flow inactivity for a specified period.

In your provided CSV files and as can be seen in the following screenshots, the first flow is closed upon receiving the second FIN flag (one in each direction), and the second flow is closed upon detecting an RST flag.

image

CICFlowMeter also closes flows based on detecting two FIN flags or one RST flag, as indicated in their source file.

image image

However, in the CSV file generated by CICFlowMeter there is no RST flag and there is only one FIN flag! So there might be other underlying issues causing the discrepancies you observed.

image

After analyzing your attached pcap file, it appears there are three packets with FIN flags and one with RST. In the output from CICFlowMeter, only one FIN flag is shown, suggesting there might be issues in its packet or flag reading process. In contrast, NTLFlowLyzer correctly detects all three FIN flags. Here are the relevant screenshots:

image

image

I hope this detailed explanation clarifies the differences and addresses your questions. We appreciate your understanding and support as we continue to improve NTLFlowLyzer. Your feedback is invaluable to us, and we are committed to enhancing the tool based on user experiences and suggestions.

Thank you once again for your engagement.

Hi, @moein-shafi Thank you very much for your clarification. At first I wondered why the CICFlowMeter detected two Src IP's. This is because the test.pcap file was saved by using wireshark to trace the tcp stream. After reading your explanation, I can confirm that the result of "CICFlowMeter" is wrong. Is NTLFlowLyzer more accurate than CICFlowMeter on TCP?

Yesisyes commented 1 month ago

Hi @Yesisyes, Thank you for reaching out and for your engagement with NTLFlowLyzer.

UDP Protocol Analysis

Regarding the UDP protocol analysis, it is currently not supported in NTLFlowLyzer, although it is on our future roadmap. Initially, we included UDP analysis similar to CICFlowMeter. However, after further investigation, we realized that defining UDP flows in a manner similar to TCP is not ideal since UDP is not connection-based. This led to the decision to pause UDP analysis for now. Rest assured, we are actively working on adding comprehensive UDP support in future versions.

Differences in Flow Output Between NTLFlowLyzer and CICFlowMeter

Concerning the differences in the outputs between NTLFlowLyzer and CICFlowMeter, this discrepancy arises from how each tool handles flow termination. In NTLFlowLyzer, a flow is closed based on the following conditions:

  1. Two FIN Flags: Detection of two FIN flags, one in each direction.
  2. One RST Flag: Detection of an RST flag.
  3. Flow Timeout: Reaching the maximum flow timeout.
  4. Inactivity Timeout: Flow inactivity for a specified period.

In your provided CSV files and as can be seen in the following screenshots, the first flow is closed upon receiving the second FIN flag (one in each direction), and the second flow is closed upon detecting an RST flag.

image

CICFlowMeter also closes flows based on detecting two FIN flags or one RST flag, as indicated in their source file.

image image

However, in the CSV file generated by CICFlowMeter there is no RST flag and there is only one FIN flag! So there might be other underlying issues causing the discrepancies you observed.

image

After analyzing your attached pcap file, it appears there are three packets with FIN flags and one with RST. In the output from CICFlowMeter, only one FIN flag is shown, suggesting there might be issues in its packet or flag reading process. In contrast, NTLFlowLyzer correctly detects all three FIN flags. Here are the relevant screenshots:

image

image

I hope this detailed explanation clarifies the differences and addresses your questions. We appreciate your understanding and support as we continue to improve NTLFlowLyzer. Your feedback is invaluable to us, and we are committed to enhancing the tool based on user experiences and suggestions.

Thank you once again for your engagement.

Hi, @moein-shafi Thank you very much for your clarification. At first I wondered why the CICFlowMeter detected two Src IP's. This is because the test.pcap file was saved by using wireshark to trace the tcp stream. After reading your explanation, I can confirm that the result of "CICFlowMeter" is wrong. Is NTLFlowLyzer more accurate than CICFlowMeter on TCP?

Yesisyes commented 1 month ago

I know NTLFlowLyzer from this Issues. https://github.com/ahlashkari/CICFlowMeter/issues/118 Because of this error: TypeError: conversion from numpy.int64 to Decimal is not supported. That could just be a problem with type conversion inside the CICFlowMeter source code. CICFlowMeter doesn't seem to have fixed this bug yet. I had to use a visualize.bat program that someone else had created from the CICFlowMeter code.This program generated the CICFlowMeter_test.csv file I shared. But that program often crashes or makes errors.

moein-shafi commented 1 month ago

Hi @Yesisyes ,

Thank you for your kind feedback

In developing NTLFlowLyzer, We have strived to not only reproduce the core functionalities of CICFlowMeter but also to refine and advance its existing limitations. This has involved reviewing CICFlowMeter’s open issues on GitHub and other sources, and incorporating those insights into our tool. We have also worked to extend its feature set and functionalities based on these observations.

While we strive to offer a more accurate and robust TCP flow analysis, we recognize that the effectiveness of any tool can vary depending on specific use cases and configurations. We are dedicated to continually enhancing NTLFlowLyzer to ensure it meets high standards of accuracy and reliability.

Below is a list of the most significant improvements made over CICFlowMeter. We will update the README to include these enhancements for greater clarity and reference.


CICFlowMeter Shortcomings/Issues

CICFlowMeter is a previous tool that was developed in 2017 using the Java programming language. While the tool effectively extracted features from network traffic, our work seeks to improve upon it by addressing issues identified in its implementation and theoretical foundations. The primary motivation for developing our tool, NTLFlowLyzer, is to provide a more efficient and accurate means of extracting valuable features from network traffic, overcoming the limitations of CICFlowMeter.

In this part, we will discuss the issues with CICFlowMeter in detail and describe the improvements we made in our implementation. The following is a list of issues we identified with CICFlowMeter and how we addressed them in NTLFlowLyzer:

In addressing these issues, we added new features to NTLFlowLyzer and corrected the calculation of some of the previous features. A comparison of these features is presented in Table features.

NTLFlowLyzer leverages the Python programming language instead of Java, providing several advantages in this domain. Python's simpler and more concise syntax facilitates both writing and reading code, while its rich set of libraries and frameworks allows for the implementation of advanced features with ease. Moreover, Python is easier to use and learn than Java, which


We hope that NTLFlowLyzer meets your needs effectively, but we are always open to feedback and suggestions to make it better. If you have any more questions or need further assistance, please feel free to reach out. Your input is highly valued, and we appreciate your support.

Yesisyes commented 1 month ago

Thank you very much for your earnest reply. @moein-shafi Now I know more about NTLFlowLyzer and CICFlowMeter.And because you're so serious about doing these things, I'm sure they'll get better. Have a nice weekend.

moein-shafi commented 1 month ago

Thank you for your kind words and understanding @Yesisyes. I’m glad I could provide the information you needed. We are committed to continually improving NTLFlowLyzer, and your feedback is invaluable to that process.

Wishing you a wonderful weekend as well!