nDPI icon indicating copy to clipboard operation
nDPI copied to clipboard

trace flow to the end

Open NatashaR4in opened this issue 9 years ago • 22 comments

hi all , i want to trace a tcp flow that labeled with specific signature to the end .how can i do that ? thanks in advance

NatashaR4in avatar Oct 03 '17 17:10 NatashaR4in

I think this question is too generic and maybe is different from the behaviour of nDPI. How you use nDPI ? How you sign a flow ? the end of a single flow or the flows or single protocol ?

kYroL01 avatar Oct 03 '17 19:10 kYroL01

End of TCP flow is marked by the fin or rst flags in the tcp header.

TaranehKhalili avatar Oct 04 '17 06:10 TaranehKhalili

when i am searching , i see that whatsapp server on port 443 send a static packet to client directly afler client send a chat to server (like an ACK say that server received what client send ) , so i want to count those packet just in this flow , so i added an array in ndpi_flow_struct and a flag ,and in ssl.c i set the flag to 1 when flow accepted as whatsapp flow . i tried to change the max extra packet ,but while debugging the flow does not return to ssl.c file after few packets . where should i set that flow need to check all of its packets ?how can i do that ? thanks for your time.

NatashaR4in avatar Oct 04 '17 06:10 NatashaR4in

@taranehk I know that the end of the flow is a packet like that in general, but I want to understand in this scenario... @NatashaR4in later I'm watching better andtry to help u, thanks.

kYroL01 avatar Oct 04 '17 06:10 kYroL01

@NatashaR4in do u have your modified code so I can take a look and try ? I think the problem is that when a flow is marked for a proto (i.e. Whatsapp), the following pkts in that flow are considered WA. I think there is a function do this work, to avoid to enter in the dissector every time the lib process another pkt of the same flow. Can u tell me that is that packet or if u have a pcap represent this scenario ?

kYroL01 avatar Oct 05 '17 00:10 kYroL01

ok, first of all , i found that whatsapp has a new signature , start with first packet of 1 byte contains 'E' ,and the second packet in flow will contain a WA at payload [8]and [9] , later in flow a packet with size payload_packet_len==67 and start with 0x00 0x00 0x40 appears after sending a chat message , i added those to function ndpi_search_ssl_tcp . w_chat1.zip.

ssl.zip

NatashaR4in avatar Oct 05 '17 07:10 NatashaR4in

Thanks!

kYroL01 avatar Oct 05 '17 08:10 kYroL01

I think that this is a great idea to track a specific flow to the end or to the specific number of packets , packet by packet so we can labeling multi sub-services in the same flow if exists like whatsapp and messenger like[Whatsapp.chat.send_photo] or by using a custom array like @NatashaR4in doing this is very helpful @kYroL01 for deep network monitor

androuxx avatar Oct 05 '17 11:10 androuxx

@kYroL01 I thought the matter is tracing a flow. I add some codes to ndpi_process_packet function of in ndpi-netfilter to trace the flow to the end. I can share it if u want.

TaranehKhalili avatar Oct 07 '17 12:10 TaranehKhalili

@taranehk , yes please share it ,i may try to adapt the same modification to my nDPI , and if there is an updated version of netfilter and you could share ,that 's will be great. thanks.

NatashaR4in avatar Oct 09 '17 11:10 NatashaR4in

@NatashaR4in I'll send a pull request for betolj/ndpi-netfilter as soon as possible. https://github.com/betolj/ndpi-netfilter

TaranehKhalili avatar Oct 10 '17 06:10 TaranehKhalili

@NatashaR4in @taranehk If you want to contribute for this task, please, send a pull request and we can integrate inside (after checking it's correctness).

kYroL01 avatar Oct 10 '17 07:10 kYroL01

@taranehk ,we are waiting for your pull, and by the way is there a netfilter project run with the latest nDpi ? https://github.com/betolj/ndpi-netfilter seem outdated

NatashaR4in avatar Oct 10 '17 21:10 NatashaR4in

I am trying to solve a bug and then I send the pull request. I am trying to solve this bug asap.

TaranehKhalili avatar Oct 11 '17 08:10 TaranehKhalili

@kYroL01 I made my changes on ndpi-netfilter and it doesn't let me to send a pull request. what should I do now?

TaranehKhalili avatar Oct 11 '17 10:10 TaranehKhalili

Of course, because you have to do that changes to a fork of nDPI, not ndpi-netfilter. Fork nDPI, make your changes and send a pull request.

kYroL01 avatar Oct 11 '17 10:10 kYroL01

I'm sorry about my delay. I send the pull request on ndpi-netfilter. this is my commit. my fork name is taranehk. https://github.com/betolj/ndpi-netfilter/pull/60/commits/436f68ec1dffd3873919b6dfc11151082c0f9492

TaranehKhalili avatar Oct 16 '17 07:10 TaranehKhalili

@taranehk The link is dead. But if you want to contribute, why don't you send a pull request to this repository ? We have many differences from ndpi-netfilter repo, and it's easier if you send a pull request here. Please, respect this policy. Thank you

kYroL01 avatar Oct 16 '17 07:10 kYroL01

ok. I'm trying...:) here is the commit: (open a new tab and paste the address bellow!!) https://github.com/ntop/nDPI/pull/475/commits/d02a6daece4562eea01ae22f4e80165f24542e39

TaranehKhalili avatar Oct 16 '17 07:10 TaranehKhalili

what i need to setup ndpi-netfilter in inline-mode for control my network traffic? i setup ndpi-netfilter on ubuntu 16.04.1 with two network interface, so how i can pass my network traffic to ndpi-netfilter machine ? what iptabes need to setup for that ?

androuxx avatar Oct 18 '17 16:10 androuxx