| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| Xyal How do I cheat?
 
 ![]() Reputation: 0 
 Joined: 26 Aug 2007
 Posts: 3
 
 
 | 
			
				|  Posted: Sat Feb 16, 2008 10:38 am    Post subject: Winsock Hooking |   |  
				| 
 |  
				| So I decided to write a packet sniffer/editor that works by utilizing a system wide hook of the Winsock send/recv functions. I don't plan to support WSA* functions from Winsock 2. 
 I want to be able to filter packets by process among other things such as src/dest ports, protocol and what not. I'm stumped however, on how to filter by process.
 
 I can only think of doing this by scanning memory or perhaps reading the stack to find out where the api call returns to and checking if its within selected process memory. Any other methods or ideas on how to do this would be appreciated.
 
 P.S. I realize for things like src/dest port filtering and the like I may have to utilize a lower level method of capturing packets to obtain access to the tcp header. A library such as libpcap for the win32 platform for example would probably work.
 
 Regards,
 --
 Xyal.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| samuri25404 Grandmaster Cheater
 
  Reputation: 7 
 Joined: 04 May 2007
 Posts: 955
 Location: Why do you care?
 
 | 
			
				|  Posted: Sat Feb 16, 2008 1:24 pm    Post subject: |   |  
				| 
 |  
				| 1) How the hell did you get to post in here? 
 2) Read the rules--NO REQUESTS
 _________________
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| benlue Moderator
 
 ![]() Reputation: 0 
 Joined: 09 Oct 2006
 Posts: 2142
 
 
 | 
			
				|  Posted: Sat Feb 16, 2008 8:44 pm    Post subject: |   |  
				| 
 |  
				| Moved back to the normal section. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| MasterChief Grandmaster Cheater Supreme
 
  Reputation: 0 
 Joined: 07 Dec 2006
 Posts: 1208
 Location: Texas
 
 | 
			
				|  Posted: Sat Feb 16, 2008 9:50 pm    Post subject: |   |  
				| 
 |  
				| if your PE is for MS i was thinking to use winpcap over winsock, but i could be wrong. _________________
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| atom0s Moderator
 
  Reputation: 205 
 Joined: 25 Jan 2006
 Posts: 8587
 Location: 127.0.0.1
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| nog_lorp Grandmaster Cheater
 
  Reputation: 0 
 Joined: 26 Feb 2006
 Posts: 743
 
 
 | 
			
				|  Posted: Sat Nov 29, 2008 2:53 pm    Post subject: |   |  
				| 
 |  
				| Hook the socket() function to call GetCurrentProcessId and create a system-wide table mapping sockets to their owners. Then in send and recv check if the socket being used belongs to a process for which hooking is desired. A driver to manage the table would probably be needed (to prune it and such). _________________
 
 Mutilated lips give a kiss on the wrist of the worm-like tips of tentacles expanding in my mind
I'm fine accepting only fresh brine you can get another drop of this yeah you wish
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| hcavolsdsadgadsg I'm a spammer
 
 ![]() Reputation: 26 
 Joined: 11 Jun 2007
 Posts: 5801
 
 
 | 
			
				|  Posted: Sat Nov 29, 2008 4:21 pm    Post subject: |   |  
				| 
 |  
				| Wow, noggie 
 way to bump the worlds oldest post.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| GMZorita Grandmaster Cheater Supreme
 
 ![]() Reputation: 0 
 Joined: 21 Mar 2007
 Posts: 1361
 
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| nog_lorp Grandmaster Cheater
 
  Reputation: 0 
 Joined: 26 Feb 2006
 Posts: 743
 
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |