AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Sockets] Server - Client (https://forums.alliedmods.net/showthread.php?t=132057)

ot_207 07-11-2010 11:53

[Sockets] Server - Client
 
Is there a way to detect the data that a server transmits to a client through sockets?
I mean reading every damn byte that the server sends to a client. The identification of what is being send, is another problem that I will try to solve alone.

joropito 07-11-2010 21:40

Re: [Sockets] Server - Client
 
Quote:

Originally Posted by ot_207 (Post 1235477)
Is there a way to detect the data that a server transmits to a client through sockets?
I mean reading every damn byte that the server sends to a client. The identification of what is being send, is another problem that I will try to solve alone.

You mean to "see" the traffic between HLDS server and clients?

Under linux can be done outside the hlds architecture. There's a way to modify packets too.
I don't know if sockets module can do it but if you have ioctl access and can bind RAW socket I think can be done.

Check this example for windows:

PHP Code:

import socket

# the public network interface
HOST socket.gethostbyname(socket.gethostname())

# create a raw socket and bind it to the public interface
socket.socket(socket.AF_INETsocket.SOCK_RAWsocket.IPPROTO_IP)
s.bind((HOST0))

# Include IP headers
s.setsockopt(socket.IPPROTO_IPsocket.IP_HDRINCL1)

# receive all packages
s.ioctl(socket.SIO_RCVALLsocket.RCVALL_ON)

# receive a package
print s.recvfrom(65565)

# disabled promiscuous mode
s.ioctl(socket.SIO_RCVALLsocket.RCVALL_OFF

For HL you must know about the packet format used.
Search in google for packet sniffing.
Here's a tutorial http://www.binarytides.com/blog/pack...using-winsock/


A metamod/amxx pcap module will be awesome (win + linux of course)

For linux you can read about pcap library
http://www.tcpdump.org/pcap.htm

ot_207 07-13-2010 03:30

Re: [Sockets] Server - Client
 
Quote:

Originally Posted by joropito (Post 1236152)
You mean to "see" the traffic between HLDS server and clients?

Under linux can be done outside the hlds architecture. There's a way to modify packets too.
I don't know if sockets module can do it but if you have ioctl access and can bind RAW socket I think can be done.

Check this example for windows:

PHP Code:

import socket

# the public network interface
HOST socket.gethostbyname(socket.gethostname())

# create a raw socket and bind it to the public interface
socket.socket(socket.AF_INETsocket.SOCK_RAWsocket.IPPROTO_IP)
s.bind((HOST0))

# Include IP headers
s.setsockopt(socket.IPPROTO_IPsocket.IP_HDRINCL1)

# receive all packages
s.ioctl(socket.SIO_RCVALLsocket.RCVALL_ON)

# receive a package
print s.recvfrom(65565)

# disabled promiscuous mode
s.ioctl(socket.SIO_RCVALLsocket.RCVALL_OFF

For HL you must know about the packet format used.
Search in google for packet sniffing.
Here's a tutorial http://www.binarytides.com/blog/pack...using-winsock/


A metamod/amxx pcap module will be awesome (win + linux of course)

For linux you can read about pcap library
http://www.tcpdump.org/pcap.htm

Yes. Something like you have done here.
I want to see all the info that the server transmits to a client. If it was made for linux where can I find the package that shows the traffic?

joropito 07-13-2010 09:18

Re: [Sockets] Server - Client
 
Quote:

Originally Posted by ot_207 (Post 1237436)
If it was made for linux where can I find the package that shows the traffic?

Don't understand what package you're looking for.

In linux you alway have pcap libraries. Try man tcpdump (use it to capture/read traffic on an interface)


I think porting pcap to a metamod/amxx module should be easy, but it should be threaded to avoid process blocking.

Seta00 07-13-2010 09:36

Re: [Sockets] Server - Client
 
Too bad RAW socket requires root privileges.


All times are GMT -4. The time now is 07:04.

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