slytechs-repos / jnetpcap-legacy

jNetPcap v1 (Maintenance Only)
https://www.jnetpcap.org
GNU Lesser General Public License v2.1
4 stars 0 forks source link

Version 1.4.r1425 to v2 #3

Closed Elnino17 closed 1 year ago

Elnino17 commented 1 year ago

There is a huge difference between the two libraries. How can I change my code from version 1.4.r1425 to version 2? Additionally, version 1.4.r1425 is full of bugs. I have had to restart my code about 5 times or more to start capturing packets. What is the solution for these big issues? By the way, thank you for all that you do

slytechs-repos commented 1 year ago

Hi, what's missing from v2 are the protocols that were builtin into v1. I'm getting ready to release the "core" protocol module which will give you the same protocol capabilities as v1. The protocols have been split out into their own modules and grouped by protocol packs. The "core" pack contains all the basic protocols like Ethernet, Ip4, Tcp etc... Their usage remains the same as in v1. These new protocol modules have a lot more capacibilities that in v1 btw. Including IPF reassembly and TCP streams and more.

Here is a list of currently defined protocol packs using: Pack.listAllDeclaredPacks().forEach(System.out::println)

Note: Defined in core-protocol-pack soon to be released java module

Pack [name="core"           ( 0/0x000), loaded=71 definitions]
Pack [name="options"        ( 1/0x040), loaded=46 definitions]
Pack [name="media"          ( 2/0x080), <pack not loaded>]
Pack [name="web"            ( 3/0x0C0), <pack not loaded>]
Pack [name="telco"          ( 4/0x100), <pack not loaded>]
Pack [name="lte"            ( 5/0x140), <pack not loaded>]
Pack [name="database"       ( 6/0x180), <pack not loaded>]
Pack [name="microsoft"      ( 7/0x1C0), <pack not loaded>]
Pack [name="authentication" ( 8/0x200), <pack not loaded>]

So stuff like this still works in v2:

void nextPacket(String message, Packet packet) {

    if (packet.hasHeader(ip4))
        System.out.println(ip4);

    if (packet.hasHeader(tcp))
        System.out.println(tcp);

    if (packet.hasHeader(http))
        System.out.println(http);

    if (packet.hasHeader(http))
        System.out.println(http);

    if (packet.hasHeader(html))
        System.out.println(html.text());

    System.out.println(packetFormatter.formatPacket(packet));
}

Also as I noted in one of the recent discussions, I'm moving some of the functionality that was split out into the org.jnetpcap.util package, back into the Pcap class which will make the API more consistent with V1. That's what preview releases are fore to see what make sense on a large scale. (Thanks for all the feedback BTW everyone.)

Expect the core-protocol-pack module to drop within next 2 weeks. Also an update jnetpcap 2.0.0-alpha2 as well with the API changes that resemble v1 APIs more closely. Then there are new jNetPcap updates related to Foreign Function JEP 424 changes for JDK 20.

Elnino17 commented 1 year ago

Thx for ur massage But i'm allerdy build en app with the jentpcap 1.4 as u know this versions have very big issues like i tell u the big issues of Start capture after many run java code what's i can do know. Give me a soultion for this if u have. Thx again.

slytechs-repos commented 1 year ago

Please open up a ticket, one for each issue you are having on the jNetPcap v1 on github. Its a clone of the SourceForge.net repo and any bug tracking and fixing will be done on Github.