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

netcat #26

Open
katcipis opened this issue Dec 27, 2016 · 3 comments
Open

netcat #26

katcipis opened this issue Dec 27, 2016 · 3 comments
Assignees

Comments

@katcipis
Copy link
Collaborator

Lets develop an nc. Should work with:

  • tcp://:
  • unix:///var/run/docker.sock

So we can hack the shit out of stuff :-)

@i4ki
Copy link
Collaborator

i4ki commented Jan 3, 2017

What annoys me the most is that netcat implementations only handle one connection at time. GNU nc have some advanced support for multiple connections but as far as I remember it sucks...

What about:

# listen to tcp port 8080 and send 'response.dump' to first client connection
$ cat response.dump | nc -stats -l tcp://:8080 
Remote client: 192.168.10.56:48500
Bytes sent: 486
TCP Connection: 30ms
Content transfer: 2ms
Done
$
# -repeat handle multiple connections
$ cat response.dump | nc -stats -repeat -listen tcp://:8080 
Press CTRL-D to abort...

Remote client: 192.168.10.56:48500
Bytes sent: 486
TCP Connection: 30ms
Content transfer: 2ms
Done
Remote client: 192.168.10.56:42196
Bytes sent: 486
TCP Connection: 30ms
Content transfer: 2ms
Done
^D
$

@i4ki
Copy link
Collaborator

i4ki commented Jan 3, 2017

Another idea, maybe it sucks but who knows... is add support for HTTP protocol out of the box... it's everywhere and rule the IT world...

Something like below could be interesting:

$ cat input.json | nc http://www.jsonlint.com/indent
{
        "data": "test",
        "data2": "test2"
}
$

And, the most nice:

# serve index.html to every HTTP connection on port 8080
$ cat index.html | nc -repeat -listen http://0.0.0.0:8080
Press CTRL-D to abort...
^D

# Serve the input files in HTTP port 8080
$ ls | nc -repeat -serve -listen http://0.0.0.0:8080

# or a directory tree
$ find . | nc -repeat -serve -listen http://0.0.0.0:8080

# Instead of serve a directory, serving specific input files avoid path traversal attacks.

Maybe it's too much... I don't know.

@katcipis
Copy link
Collaborator Author

katcipis commented Jan 8, 2017

@tiago4orion the http thing I'm also thinking it may be too much, I need time to let the idea grow :-).

About the -repeat option, sounds interesting, but what would be the semantics ? I send the stdin and close the connection or a wait for the other side to close it ? It seems like you are modeling a request/response thing, but nc would be more general than this no ?

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

No branches or pull requests

2 participants