0
I'm having difficulty remmebering a certain command I would use in bash that would give information about a port it would 'knock' on.
I've used ssh backdoors before so that I can access my home computer when I'm away. This worked out nicely as an alternative versus using a dns solution in response to my ISP changing my computer's IP unpredictably.
I can set up an ssh tunnel with no problems doing the following
me@home$ ssh -X -R 2222:localhost:22 me@my_server
And then using these commands to follow the tunnel back home
me@somewhere_remote$ ssh me@my_server
me@myserver password:
me@mys_erver$ ssh -p 2222 me@localhost
me@localhost's password:
me@home$
That all works fine and I have no issue with that whatsoever. Just illustrating my use case.
My problem, or more of an annoyance, is that I remember I used to know and use a command that would allow me to knock on a port and it would print out a single line saying what service was running on the port.
So if I was currently logged in as me@my_server I could do something like this
me@my_server$ knock localhost:2222
me@my_server$ OpenSSH_5.8p1
Where some command in place of 'knock' would print out the ssh version being port-forwarded to my_server.
Some commands that come to mind as possibilities include netcat, netstat, and nmap, but I can't remember which I used to get this functionality. My best guess is that it looked like
nc -p localhost:2222
But that doesn't really do anything so I must have some parameter wrong.
I've reviewed the man pages for each command thoroughly but I can't seem to find how to do this. I've grep'd through my history and can't find it since it has been too long since last using it! (I used to just do ctrl+R n___ and it would come up).
This was a very useful command, as one could check what port they were connecting to and what service was listening. I can certainly get on without it, but I have a constant nagging in my head now trying to remember what it was!
Does anyone know of such a command? I may have some of the finer details mixed up, but I remember that it did something roughly as I have explained.
Thanks for any suggestions and help!
I'm familiar with nmap and have used it often - but it doesn't do what I thought this utility did. However, the -sV flag for service versioning does essentially the same thing, which is nice. – mrchampe – 2012-10-21T00:20:33.573