NetPro: Packet Analysis and Visualization tool

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
Post Reply
RogerSmith
Posts: 69
Joined: Fri Oct 01, 2010 11:57 am

Re: NetPro: Packet Analysis and Visualization tool

Post by RogerSmith »

SaveGame wrote:
RogerSmith wrote:Sorry to Hijack your thread, but it seems like you know what you are doing -

I am looking to fix swoop cannon skills 5110 and 5111. I can do the geometry calcs server side, but I have a problem with direction the animation (never goes to target, always to one place in the map, always same direction).

I am curious - have you ever came across any special packet in regards to these animations? I suspect their physics is done client side, then information regarding flight path and collision are sent to server and maybe other clients in proximity. I assume this because cloak simulation is done client side, you can supposedly tamper with this?
Nah, it's the default MSU that deals with it. Thanks for pointing this out, this means that 'skill usage type' must have been introduced in C2 (I have first observed it on C4 due to reasons related to my testing methodology).

Here's an example (in front of Gludio castle, Gracia Final server)

Code: Select all

48 79 C5 10 48 79 C5 10 48 F6 13 00 00 01 00 00 00 D5 4E 00 00 04 29 00 00 CC B8 FF FF 5A C2 01 00 28 F5 FF FF 00 00 01 00 E7 B5 FF FF D0 BC 01 00 28 F5 FF FF CC B8 FF FF 5A C2 01 00 28 F5 FF FF
Gracia Final wrote:Received on: 20:28:35.458
Caster OID: Swoop Cannon [NPC] (1209058681)
Main target OID: Swoop Cannon [NPC] (1209058681)
Skill: Cannon Fodder (5110)
Level: 1
Cast time: 20 seconds, 181 milliseconds (20181)
Reuse delay: 10 seconds, 500 milliseconds (10500)
Caster X: -18228
Caster Y: 115290
Caster Z: -2776
i_fatal_blow: No (0)
~~~~ Empty loop ~~~~
Usage type: Target point (1)
Ground target X: -18969
Ground target Y: 113872
Ground target Z: -2776
Main target X: -18228
Main target Y: 115290
Main target Z: -2776
Note: caster/target OID is always the Swoop Cannon, regardless of what you have targeted (most likely because it shoots the way it is facing; though it first rotates to face the player).
This is extremely useful, except I am clueless on how to implement it.

I do have some questions:
What is MSU?
What is OID?

And

Why are the last pairs of XYZ different? I assume main target is the calculated point of destination, and the Ground is geodata? So, even though there is further path to travel it gets caught on geodata where the loop is terminated.
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

MSU is SM MagicSkillUse (in old times, it was sometimes referred as MagicSkillUser).
OID - world object ID.

MSU structure depends on client's version. Any client C2 or above supports the feature you are looking for. Just look for "writeH" related to blows.

Aside from that, l2jserver HF partially supports what you need:
https://github.com/L2J/L2J_Server/blob/ ... llUse.java

Code: Select all

		writeC(0x48);
		writeD(_activeChar.getObjectId());
		writeD(_target.getObjectId());
		writeD(_skillId);
		writeD(_skillLevel);
		writeD(_hitTime);
		writeD(_reuseDelay);
		writeLoc(_activeChar);
		writeH(_unknown.size()); // TODO: Implement me!
		for (int unknown : _unknown)
		{
			writeH(unknown);
		}
		writeH(_groundLocations.size());
		for (IPositionable target : _groundLocations)
		{
			writeLoc(target);
		}
		writeLoc(_target);

Code: Select all

writeH(_unknown.size()); // TODO: Implement me!
Is related to blows.

Code: Select all

writeH(_groundLocations.size());
is incorrect because with skill usage type = 2 client expects NO EXTRA LOCATIONS (it will read exactly one location and assume it is the location of '_target'). An example skill that uses this type (=2) is 18472, all levels.

All you have to do is call the constructor with both caster and target being the Swoop Cannon, and supply exactly one IPositionable for groundLocations.
Last edited by SaveGame on Tue Oct 27, 2015 10:45 pm, edited 2 times in total.
Image
RogerSmith
Posts: 69
Joined: Fri Oct 01, 2010 11:57 am

Re: NetPro: Packet Analysis and Visualization tool

Post by RogerSmith »

Thank you very much
RogerSmith
Posts: 69
Joined: Fri Oct 01, 2010 11:57 am

Re: NetPro: Packet Analysis and Visualization tool

Post by RogerSmith »

SaveGame wrote:snip
Hello SaveGame
I attempted to apply your information as best as I could, please see this topic viewtopic.php?f=81&t=31723 when and if you have time.

Regards
Feldunost
Posts: 1
Joined: Mon Sep 17, 2012 4:56 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by Feldunost »

Hello,

I'm currently in need of an packet logger to understand parts of what is said between client / server but for another game. We have currently the function for encryption / decryption, but we would be gaining more time to apply this function on an existing packet logger app.

May i ask some help on this matter ?
Knowing that it's not Aion or Lineage, there may be still some use ?
If you have a recommendation, feel free to advise me.

Thanks.
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

Feldunost wrote:Hello,

I'm currently in need of an packet logger to understand parts of what is said between client / server but for another game. We have currently the function for encryption / decryption, but we would be gaining more time to apply this function on an existing packet logger app.

May i ask some help on this matter ?
Knowing that it's not Aion or Lineage, there may be still some use ?
If you have a recommendation, feel free to advise me.

Thanks.
NetPro has the fixed maximum size binary packet proprietary protocol at its core. As long as something comparable is used, an adaptation is possible (a binary protocol without max packet size would be harder and would slow down performance somewhat, but still possible).
However, if the game/app (as seems to be the norm nowadays) overlays its custom protocol on top of some complex text protocol, which additionally may choose to do an arbitrary amount of connections to an arbitrary amount of addresses before the real "connection" is made, e.g. HTTP/s, then no, it isn't really possible without fundamental changes, and it might be faster to write a plugin for Wireshark.
Image
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: NetPro: Packet Analysis and Visualization tool

Post by Zealar »

How to use NetPro with follow needs all on same pc?

Running server login + game.
2 clients.
1- Point to local server
2- Point to remote server

Both sniffed with NetPro?

For now i reach to the point running login + game. First client login to remote and sniff. Second client see server list but when try to connect is DC.
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

Zealar wrote:How to use NetPro with follow needs all on same pc?

Running server login + game.
2 clients.
1- Point to local server
2- Point to remote server

Both sniffed with NetPro?

For now i reach to the point running login + game. First client login to remote and sniff. Second client see server list but when try to connect is DC.
These things directly depend on your LAN configuration AND the advertised IP(s) in ServerList.

For example, if you connect to NetPro on 127.0.0.1, but the (overridden) ServerList advertises 192.168.1.1, NetPro will receive a connection from the same subnet (192.168.0.0/16) and NOT from 127.0.0.1, but it only knows which Game Server was chosen for the client on 127.0.0.1!

Consider this example part of serviceconfig.xml:

Code: Select all

<gameWorldSockets>
	<gameWorldSocket clientAddressPrefix="127.0.0.0/8" ip="127.0.0.1" port="7776" />
	<gameWorldSocket clientAddressPrefix="192.168.0.0/16" ip="192.168.1.2" port="7776" />
	<gameWorldSocket ip="8.8.3.3" port="7776" />
</gameWorldSockets>
It instructs that NP, when overriding ServerList, would:
  • Advertise 127.0.0.1:7776 to anyone connecting from local host
  • Advertise 192.168.1.2:7776 to anyone connecting from LAN (obviously, you would use a different prefix if you have a larger LAN)
  • Advertise 8.8.3.3:7776 to anyone connecting from anywhere else
BEWARE: if your gateway (@ 192.168.1.1, for the sake of this example) is the device that owns 8.8.3.3, and you attempt to connect to NP on 8.8.3.3, while being inside the LAN, NP will receive a connection from 192.168.1.1 AND NOT 8.8.3.3! That means that NP will mark the selected game server for 192.168.1.1, but when your computer connects to advertised 192.168.1.2:7776, NP will see your LAN IP (e.g. 192.168.1.100), and not the gateway IP (= no selected GS = dc).

About the multiple login server support, here's what I use on my dev machine:

Code: Select all

<authorizationSockets>
	<authorizationSocket>
		<listen ip="0.0.0.0" port="2195" />
		<service host="127.0.0.1" port="21060" />
	</authorizationSocket>
	<authorizationSocket>
		<listen ip="0.0.0.0" port="2196" />
		<service host="127.0.0.1" port="21061" />
	</authorizationSocket>
	<authorizationSocket>
		<listen ip="0.0.0.0" port="2197" />
		<service host="127.0.0.1" port="2107" />
	</authorizationSocket>
	<authorizationSocket>
		<listen ip="0.0.0.0" port="2198" />
		<service host="192.168.1.3" port="2106" />
		</authorizationSocket>
	<authorizationSocket>
		<listen ip="0.0.0.0" port="2199" />
		<service host="64.25.35.104" port="2106" />
	</authorizationSocket>
</authorizationSockets>
Port 2195 for prelude-style clients, 2196 for C3 557/560, 2197 for all other clients (local all-client LS+GS emulator; note that C4/C5 differences are handled by l2emu internal NP scripts, for now).
Port 2198 for l2off servers running on a VM with bridged networking.
And port 2199 for NA.

I find it convenient to just have hosts pointing l2authd.lineage2.com to 127.0.0.1 and using Single Port Multiplexing Proxy Server (with predefined bat files) to handle where (that is, to either LAN IP or IIP and which port) the connection will be redirected, e.g.

Code: Select all

@echo off
@title LAN:2199
@start /min spmps_x64.exe -li 127.0.0.1 -lp 2106 -ti 192.168.1.2 -tp 2199
Of course, there are other ways to set things up. The important part is, that for now, multiple remote login server support is enabled by determining on which port a client connects to NP.
Image
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: NetPro: Packet Analysis and Visualization tool

Post by Zealar »

Your explain is to complex cannot understand it.

What i want is to sniff from my local and rpg club to compare here is info what i got so far.

My lan ip : 192.168.168.10
RPG : 95.211.210.103
NetPro configs
ipalias.xml

Code: Select all

	<address ip="0.0.0.0" alias="*THIS*" />
	<address ip="127.0.0.1" alias="localhost" />
	<address ip="192.168.168.10" alias="Private Server" />
	<address ip="95.211.210.103" alias="RPG Club" />
serviceconfig.xml

Code: Select all

		<gameWorldSockets> <!-- injected into ServerList -->
		<gameWorldSocket clientAddressPrefix="0.0.0.0/0" ip="127.0.0.1" port="7777" />
	</gameWorldSockets>

	<authorizationSockets>
		<authorizationSocket> <!-- Local -->
			<listen ip="192.168.168.10" port="2106" />
			<service host="192.168.168.10" port="2108" />
		</authorizationSocket>
		<authorizationSocket>
			<listen ip="127.0.0.1" port="2106" />
			<service host="auth.rpg-club.eu" port="2106" />
		</authorizationSocket>
	</authorizationSockets>
Server configs
LoginServer.properties

Code: Select all

LoginserverHostname = *
LoginserverPort = 2108
LoginHostname = 192.168.168.10
LoginPort = 9014
Server.properties

Code: Select all

LoginHost = 192.168.168.10
LoginPort = 9014
GameserverHostname = 192.168.168.10
GameserverPort = 7777
ipconfig.xml

Code: Select all

<gameserver address="192.168.168.10" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../data/xsd/ipconfig.xsd">
	<define subnet="192.168.0.0/16" address="192.168.168.10" />
</gameserver>
So i start clients
l2.exe IP=localhost
l2.exe IP=192.168.168.10

localhost one connect to RPG and all is fine
but with other one the moment when try to connect GameServer fail what is normal coz in serviceconfig.xml

Code: Select all

<gameWorldSocket clientAddressPrefix="0.0.0.0/0" ip="127.0.0.1" port="7777" />
Is port to 127.0.0.1 but i need 192.168.168.1 that error show in log
[2015-11-22 13:52:55.029 +0200] WARNING proxy.network.game.server.L2GameServerConnections.connect(): Can't find target game server for 127.0.0.1
So if i made change

Code: Select all

<gameWorldSocket clientAddressPrefix="0.0.0.0/0" ip="127.0.0.1" port="7777" />
to

Code: Select all

<gameWorldSocket clientAddressPrefix="127.0.0.1/24" ip="127.0.0.1" port="7777" />
<gameWorldSocket clientAddressPrefix="192.168.168.10/24" ip="192.168.168.10" port="7777" />
Then NetPro or server will not start coz that socked on that port is already used
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

Zealar wrote:Your explain is to complex cannot understand it.
That's the annoying part with networking in this case.
Zealar wrote:Then NetPro or server will not start coz that socked on that port is already used
l2.exe IP=192.168.168.10
Client -> 192.168.168.10:2106 [NetPro] -> 192.168.168.10:2108 [LS]
Client -> ServerList addr:port (192.168.168.10:7776) [NetPro] -> 192.168.168.10:7777 [GS]

l2.exe IP=localhost
Client -> 127.0.0.1:2106 [NetPro] -> auth.rpg-club.eu:2108 [LS]
Client -> ServerList addr:port (127.0.0.1:7776) [NetPro] -> REAL selected server IP:port [GS]

serviceconfig.xml

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<sockets xmlns="http://www.l2emu-unique.net" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.l2emu-unique.net schemata/svcfg.xsd">

	<gameWorldSockets>
		<gameWorldSocket clientAddressPrefix="127.0.0.0/8" ip="127.0.0.1" port="7776" />
		<gameWorldSocket ip="192.168.168.10" port="7776" />
	</gameWorldSockets>

	<authorizationSockets>
		<authorizationSocket> <!-- Local -->
			<listen ip="192.168.168.10" port="2106" />
			<service host="192.168.168.10" port="2108" />
		</authorizationSocket>
		<authorizationSocket>
			<listen ip="127.0.0.1" port="2106" />
			<service host="auth.rpg-club.eu" port="2106" />
		</authorizationSocket>
	</authorizationSockets>

</sockets>
Image
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: NetPro: Packet Analysis and Visualization tool

Post by Zealar »

Omg i understand it wrong first time

<gameWorldSocket clientAddressPrefix="127.0.0.0/8" ip="127.0.0.1" port="7776" />
So is open socket on that port that is not destination port where will look for server.

Now is working perfect thx.

Btw seems NetPro cannot be used without script_1.3.cache why is not included inside then?
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

Zealar wrote:Omg i understand it wrong first time

<gameWorldSocket clientAddressPrefix="127.0.0.0/8" ip="127.0.0.1" port="7776" />
So is open socket on that port that is not destination port where will look for server.

Now is working perfect thx.

Btw seems NetPro cannot be used without script_1.3.cache why is not included inside then?
Image

As long as NetPro is run via the JDK executable (with tools.jar), it will compile the scripts automatically. Here's an example of what java/javaw should be used on a default JDK installation:
Image
Image
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: NetPro: Packet Analysis and Visualization tool

Post by Zealar »

I'm trying to add new script

Code: Select all

double alias="Progress to next level (%)" mod="HowThatWork" /><!-- NEW -->

Code: Select all

public final class HowThatWork extends ScriptedFieldValueModifier implements DecimalModifier
{
	@Override
	public double apply(double value)
	{
		return value * 100d;
	}
}
But get

Code: Select all

net.l2emuproject.proxy.network.meta.exception.InvalidFieldValueModifierException: null(HowThatWork) cannot be cast to net.l2emuproject.proxy.network.meta.FieldValueModifier
	at net.l2emuproject.proxy.network.meta.container.MetaclassRegistry.getModifier(MetaclassRegistry.java:226)
SaveGame
Posts: 121
Joined: Thu Oct 30, 2014 9:54 pm

Re: NetPro: Packet Analysis and Visualization tool

Post by SaveGame »

Zealar wrote:I'm trying to add new script

Code: Select all

double alias="Progress to next level (%)" mod="HowThatWork" /><!-- NEW -->

Code: Select all

public final class HowThatWork extends ScriptedFieldValueModifier implements DecimalModifier
{
	@Override
	public double apply(double value)
	{
		return value * 100d;
	}
}
But get

Code: Select all

net.l2emuproject.proxy.network.meta.exception.InvalidFieldValueModifierException: null(HowThatWork) cannot be cast to net.l2emuproject.proxy.network.meta.FieldValueModifier
	at net.l2emuproject.proxy.network.meta.container.MetaclassRegistry.getModifier(MetaclassRegistry.java:226)
[menu bar] -> Scripts -> Load/reload…
Input a part of the class name, e.g. 'howt', click ok.
Reload packet definitions.

Don't forget to remove script cache so that it would get rebuilt the next time you launch NP.

If 'Scripts' menu is grayed out/disabled, then you are running on a JRE. ECJ support was not planned, and thus is not available at this time; you must have tools.jar with the default compiler.
Image
User avatar
Zealar
L2j Veteran
L2j Veteran
Posts: 1236
Joined: Sun Jul 15, 2007 10:29 am

Re: NetPro: Packet Analysis and Visualization tool

Post by Zealar »

Is working now :clap:
Few suggestion :
1) On left where packets appear is possible first box "C" "S" to be colored and maybe replaced with icon with arrow for in and out will be easy to read lines.
2) On same packets right button with menu for disable them from show.
3) Same menu but to faster add it for send.
3) On right where packets decrypt will be good icons to got mouse over with short info what symbol mean. (or all that added in button > Help section"
4) Console is ok but will be errors to show it on other tab for not scroll it each time to see if something happen. With all in same color is hard to read. But guess cannot be colored so new tab sound faster solution.

:+1:
Post Reply