AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   UDPCap Extension (https://forums.alliedmods.net/showthread.php?t=303299)

Naydef 12-01-2017 16:39

UDPCap Extension
 
1 Attachment(s)
UDPCap extension
Version: 0.0.0.1


Description:
Allows plugin developers to catch UDP packets sent to the server with the ability of getting IP, port, length of data, data itself, etc. Also plugins can selectively prevent futher processing of the packets or vice versa. Please notice that the extension is currently only for the Windows OS, although it contains the required gamedata for Linux OSes.

Changelog:
Spoiler


Sample plugin:
Spoiler


Compatibility:
The extension is tested and confirmed working on these games/OSes:
  • TF2/Windows Vista


Credit:
Zephyrus - Copypasted some code from Console Cleaner extension at first, but then removed it.


Source Code:
https://github.com/naydef/UDPCap-ext


Bugs/Improvements:
  • None

Note:
  1. You can only capture UDP packets received by the server, not possible to capture those sent by the server(If requested, might add such functionality)
  2. Gamedata taken from TF2 engine.dll, so gamedata might not work on other Source games
  3. This the first public extension I released.

Feedback is very welcomed!



Files:

Scruffy 02-24-2018 04:40

Re: UDPCap Extension
 
Wow! This is fantastic! Can't wait to set this up on my server!

I can think of several use cases, but most of them require one of:
  • capturing the server's response
  • modifying the inbound packet
  • modifying the outbound packet

I'll see if I can use this to log voice chat to disk.

In the meantime, the features above and a linux .so binary would be useful.

I can confirm, it works like a charm for TF2 on Windows 10.

Again, thanks, this is fantastic extension!

Naydef 02-24-2018 06:58

Re: UDPCap Extension
 
Quote:

Originally Posted by Scruffy (Post 2579808)
Wow! This is fantastic! Can't wait to set this up on my server!

I can think of several use cases, but most of them require one of:
  • capturing the server's response
  • modifying the inbound packet
  • modifying the outbound packet

I'll see if I can use this to log voice chat to disk.

In the meantime, the features above and a linux .so binary would be useful.

I can confirm, it works like a charm for TF2 on Windows 10.

Again, thanks, this is fantastic extension!

Thanks. About the suggestions:
  • Capturing server response - probably will add such callback
  • modifying inbound packet - currently you can block packet from the client and use Socket extension to send packet with modified data
  • modifying the outbound packet - same as second
Probably for the Linux variant of the extension, the way i made extension makes it rather hard to compile on Linux. Probably when I have more time going to compile it.

Scruffy 02-24-2018 15:30

Re: UDPCap Extension
 
Quote:

Originally Posted by Naydef (Post 2579825)
  • modifying inbound packet - currently you can block packet from the client and use Socket extension to send packet with modified data

I don't doubt blocking the packet will work, but I don't think Socket ext is able to send a modified packet from the right source IP and port.

When sending a replacement packet from the client to the server, SrcDS will expect the source IP address to be consistent with that client's - some internet IP, whereas the actual source IP will be SrcDS' localhost. Given that SrcDS distinguishes clients by IP:port data in the packet, I expect the packet would be disregarded. Similarly, to send a modified outbound packet to a client, the socket ext will bind to some port other than SrcDS' port; as such, NAT or not, the client will ignore the packet since it came from the wrong port on albeit the right IP.

I'm not sure what implementation you had in mind when you said that Socket ext could be used to send the modified packet - please clarify.

hmmmmm 02-24-2018 16:40

Re: UDPCap Extension
 
You could push length/data by reference and allow it to be changed plugin side to allow modifying the packets.

Scruffy 02-24-2018 18:31

Re: UDPCap Extension
 
Quote:

Originally Posted by hmmmmm (Post 2579966)
You could push length/data by reference and allow it to be changed plugin side to allow modifying the packets.

I doubt it would be as simple as that. That would make the changed data available to the extension, but the extension would still need to implement the functionality to resend an updated packet.

hmmmmm 02-24-2018 19:32

Re: UDPCap Extension
 
All it is is a detour. After calling the forward, it then calls the original function with the same params (unless plugin returns Plugin_Handled or whatever). It would be easy to change the params passed in to the original function.

Scruffy 02-24-2018 20:28

Re: UDPCap Extension
 
Quote:

Originally Posted by hmmmmm (Post 2579987)
All it is is a detour. After calling the forward, it then calls the original function with the same params (unless plugin returns Plugin_Handled or whatever). It would be easy to change the params passed in to the original function.

You seem more qualified than I am. Perhaps you should submit a pull request

Dr.Mohammad 03-23-2018 23:51

Re: UDPCap Extension
 
hi
not worked !!! please update !!

http://s8.picofile.com/file/8322372068/Captur333e.PNG

i used last sm v1.8 and used this version ext:
https://forums.alliedmods.net/attach...3&d=1512164184

Naydef 03-26-2018 12:45

Re: UDPCap Extension
 
Quote:

Originally Posted by Dr.Mohammad (Post 2584379)
hi
not worked !!! please update !!

http://s8.picofile.com/file/8322372068/Captur333e.PNG

i used last sm v1.8 and used this version ext:
https://forums.alliedmods.net/attach...3&d=1512164184

Next time tell me the game you're trying to run the extension. I suppose it's CS:GO, anyway the extensions ships with only TF2 gamedata and general gamedata(based on TF2 one) for other games. I already have made CS:GO ProcessIncomingPacket function signature, but the function is trickier to hook compared to other games because it uses the _fastcall calling convention. Also I will have more time for the extension to improve the incoming week.


All times are GMT -4. The time now is 00:14.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.