Skip to content

Add netcat#40

Open
xyproto wants to merge 5 commits into
wader:mainfrom
xyproto:netcat2
Open

Add netcat#40
xyproto wants to merge 5 commits into
wader:mainfrom
xyproto:netcat2

Conversation

@xyproto

@xyproto xyproto commented Jun 5, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@xyproto xyproto changed the title Add netcat again :) Add netcat Jun 6, 2023
@jwilk

jwilk commented Jun 6, 2023

Copy link
Copy Markdown
Collaborator

This doesn't work for me with traditional netcat:

$ nc -l 0 1337 < file.txt | nc 0 1337
(UNKNOWN) [0.0.0.0] 1337 (?) : Connection refused

It works better with OpenBSD netcat, but it hangs after outputting the file.

@xyproto

xyproto commented Jun 6, 2023

Copy link
Copy Markdown
Contributor Author

It works on macOS. Does this variation work on your system?

nc -l localhost 1337 < file.txt | nc localhost 1337

Or this one, which is shorter?

nc -l ::0 1337 < file.txt | nc ::0 1337

@xyproto

xyproto commented Jun 8, 2023

Copy link
Copy Markdown
Contributor Author

Changed the PR to use ::0 instead (IPv6)

Add a 1 second timeout
@xyproto

xyproto commented Jun 11, 2023

Copy link
Copy Markdown
Contributor Author

Added the -w 1 flag (not needed on macOS, but it was needed on Arch Linux).

@xyproto

xyproto commented Jun 11, 2023

Copy link
Copy Markdown
Contributor Author

This is also an option (for Junk league or Shell league):

nc -l ::0 1337 -w 1 < file.txt &; nc ::0 1337 -w 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants