java hijack socket possible?

前端 未结 3 1507
旧巷少年郎
旧巷少年郎 2021-01-26 17:08

I suddenly find myself wondering this question, is it possible in java to hijack a socket?

say a server is listening on port 5000, would it be possible to write a java p

相关标签:
3条回答
  • 2021-01-26 17:33

    Or maybe you want to capture the traffic and inject your packets in communication ? If so, then try jpcap

    0 讨论(0)
  • 2021-01-26 17:38

    Network sockets are managed by the operating system, and the OS will not let you bind to a socket that is already in use. So yes, you would need to do some trickery on the network driver level.

    0 讨论(0)
  • 2021-01-26 17:38

    Sounds like you are being naughty. As Thilo said, you can't typically hijack a port. You could proxy for the port, so have clients connect to port 5001, and your program listens on 5001, then forwards to 5000. You could also do the same at the host level - replace host X with host y. Host y runs your program on port 5000 and forwards to host X on port 5000.

    0 讨论(0)
提交回复
热议问题