| |

VerySource

 Forgot password?
 Register
Search
View: 982|Reply: 4

How to get the destination IP address and source IP from the intercepted data packet?

[Copy link]

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-12-15 16:00:02
| Show all posts |Read mode
I use HOOK programming to completely intercept the network data packets of the specified process, and can modify and send them. The question is how do I get the IP address and port sent. There are codes in this area on the Internet, but it is for bonding the network card, which is inconvenient.
Reply

Use magic Report

0

Threads

41

Posts

28.00

Credits

Newbie

Rank: 1

Credits
28.00

 China

Post time: 2020-12-15 17:30:01
| Show all posts
Isn't it specified when CONNECT?
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 Australia

 Author| Post time: 2020-12-15 21:00:01
| Show all posts
It's not your own program, it's the program of other people HOOK. You can HOOK connet to get the host and port when you connect, but the other party has already connected, and then HOOK, how to get it?
Reply

Use magic Report

1

Threads

3

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-12-16 01:30:01
| Show all posts
Jump to my own send function as follows:
int WINAPI Mysend(SOCKET s, char FAR *buff, int len, int flags)
  {
          int nReturn;
         
          //You can operate the buff here
          ...................
          nReturn = send(s, buff, len, flags);
          ...................
          //How do I get the source IP and port number, destination IP and port number here??????

          return(nReturn);
  }
Reply

Use magic Report

0

Threads

70

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-12-16 23:30:01
| Show all posts
Raw socket?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list