Raised This Month: $32 Target: $400
 8% 

UDPCap Extension


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 12-01-2017 , 16:39   UDPCap Extension
Reply With Quote #1

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:
Attached Files
File Type: zip udpcap_win.zip (7.5 KB, 281 views)

Last edited by Naydef; 12-01-2017 at 16:50.
Naydef is offline
Scruffy
Junior Member
Join Date: Feb 2017
Old 02-24-2018 , 04:40   Re: UDPCap Extension
Reply With Quote #2

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!
Scruffy is offline
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 02-24-2018 , 06:58   Re: UDPCap Extension
Reply With Quote #3

Quote:
Originally Posted by Scruffy View Post
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.
__________________
My plugins:
*None for now*


Steam:
naydef
Naydef is offline
Scruffy
Junior Member
Join Date: Feb 2017
Old 02-24-2018 , 15:30   Re: UDPCap Extension
Reply With Quote #4

Quote:
Originally Posted by Naydef View Post
  • 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.
Scruffy is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 02-24-2018 , 16:40   Re: UDPCap Extension
Reply With Quote #5

You could push length/data by reference and allow it to be changed plugin side to allow modifying the packets.
hmmmmm is offline
Scruffy
Junior Member
Join Date: Feb 2017
Old 02-24-2018 , 18:31   Re: UDPCap Extension
Reply With Quote #6

Quote:
Originally Posted by hmmmmm View Post
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.
Scruffy is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 02-24-2018 , 19:32   Re: UDPCap Extension
Reply With Quote #7

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.
hmmmmm is offline
Scruffy
Junior Member
Join Date: Feb 2017
Old 02-24-2018 , 20:28   Re: UDPCap Extension
Reply With Quote #8

Quote:
Originally Posted by hmmmmm View Post
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
Scruffy is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 03-23-2018 , 23:51   Re: UDPCap Extension
Reply With Quote #9

hi
not worked !!! please update !!



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

Last edited by Dr.Mohammad; 03-24-2018 at 22:10. Reason: add errors
Dr.Mohammad is offline
Naydef
Senior Member
Join Date: Dec 2015
Location: Doom Town, Nevada
Old 03-26-2018 , 12:45   Re: UDPCap Extension
Reply With Quote #10

Quote:
Originally Posted by Dr.Mohammad View Post
hi
not worked !!! please update !!



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.
__________________
My plugins:
*None for now*


Steam:
naydef
Naydef is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:28.


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