Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic Port #147

Open
prashantchandak7 opened this issue Apr 29, 2019 · 9 comments

Comments

Projects
None yet
2 participants
@prashantchandak7
Copy link

commented Apr 29, 2019

What OS?

  • Windows
  • [y ] Mac
  • Linux (Which distro?)

Description of issue

The client a hardware sends packets to packet sender set as server on Mac.

How can I configure packet sender to send packets on port number same as received from client?

Please note client changes port randomly.

Screen Shot 2019-04-29 at 6 57 45 PM

@dannagle

This comment has been minimized.

Copy link
Owner

commented Apr 29, 2019

That is how TCP normally works. The source port is always dynamic while the target port of the server remains fixed.

You can set Packet Sender's server port using (on Mac) PacketSender --> Preferences.

mac-preferences

Then changing the server port away from zero (which means random).

mac-tcp-server-choice

If your testing requires a fixed source port when using TCP, you may do so on the command line using the -b option.

@prashantchandak7

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

How can I bind port?

@dannagle

This comment has been minimized.

Copy link
Owner

commented Apr 29, 2019

Navigate to the executable. Assuming default location, it is here:
cd /Applications/PacketSender.app/Contents/MacOS/

This example command says to use hex notation, waits 500 ms for a response, binds source port to port 5000, and sends to address 127.0.01, port 15000, hex stream AA BB CC DD EE FF, using TCP.

./PacketSender -x -w 500 -b 5000 127.0.0.1 15000 "aa bb cc dd ee ff"

You can use "--help" to get the complete help output.

@prashantchandak7

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

I am getting an error. I do not have any defined port on client to respond to or the option is to reply back on same port from which I receive request from client.

Screen Shot 2019-04-29 at 8 21 56 PM

@dannagle

This comment has been minimized.

Copy link
Owner

commented Apr 29, 2019

You left out the target port number. It goes after IP address.

@prashantchandak7

This comment has been minimized.

Copy link
Author

commented Apr 29, 2019

Please see TCP flow data. 192.168.1.21 is server and 192.168.1.5 is client.

The server/source IP port needs to be binded and destination IP port needs to be dynamic based on the port from which client is requested to create a socket.

Is it possible to configure this in packet sender?

Screen Shot 2019-04-30 at 1 14 28 AM

@dannagle

This comment has been minimized.

Copy link
Owner

commented Apr 30, 2019

If you want to use a fixed port for both source and destination port for TCP (like Packet Sender does for UDP), the only way to do this is through the command line interface using the -b option.

Packet Sender's UDP source and client is a fixed port on both sides because that is the only reliable way to collect responses. TCP does not need that since it is session-based. The GUI client for TCP will always request a dynamic port to connect a client to a server. This is how normal TCP operates, which is why your specialized use case is on the command line only (at least it is for now --you are not the first user needing to do this test).

@prashantchandak7

This comment has been minimized.

Copy link
Author

commented Apr 30, 2019

Ok, but the client changes port every 5 seconds - so it is not possible to type manually destination port unless it can pick dynamically.

@dannagle

This comment has been minimized.

Copy link
Owner

commented Apr 30, 2019

With the server and client ports frequently changing, you will need to write scripting logic around the command line interface. Packet Sender cannot solve a setup this complicated by itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.