Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   packet interceptor (http://www.go4expert.com/forums/packet-interceptor-t21172/)

transfernly 2Mar2010 14:46

packet interceptor
hello all I am looking for a sample C code for packet interceptor....

Any help is appreciated

Thank you

karthigayan 2Mar2010 15:11

Re: packet interceptor
please explain your requirement briefly .

transfernly 2Mar2010 15:20

Re: packet interceptor
receive the packet as such and modify its contents and then forward it..its a part of my research work.....change few field details and den forward it my another code(which acts as a server)....and do let me know if its possible or not

Thank you

karthigayan 2Mar2010 15:37

Re: packet interceptor
You can do it . Normally the whole packet will store as a structure .So when you receive a socket you can just change the particular structure member ( part of the packet ) then you can forward it .

transfernly 2Mar2010 15:50

Re: packet interceptor
when i have done simple client server programme of data excahnge i used to receive only the data part(payload)

but how to get the entire packet assuch...do u have a sample snippet

karthigayan 2Mar2010 15:59

Re: packet interceptor
I think you are using send and receive functions in you socket program.Instead try with sendto ,recvfrom functions you will get the address and port of the other informations in the packet .

man recvfrom
man sendto

transfernly 2Mar2010 16:09

Re: packet interceptor
yeah....u r right am using send and receive functions....i am using visual studio ..am not coding in linux.....i think i get all the individual fields of the packet ...i think i will be able to get only source ip...port etc etc..but i want the packet right from IP header....

in which structure i receive the details.....and can i send the same packet as such to another server

All times are GMT +5.5. The time now is 07:14.