make socat open port only on localhost interface - interface

I use this line to open a connection to a server through a socks proxy:
socat -v TCP4-LISTEN:77,fork SOCKS4A:44.44.44.44:33.33.33.33:99,socksport=9898
it works great but I noticed it also opens the port 77 externally (like: 192.168.1.100:77). I would like it to only open it on 127.0.0.1:77.
PS. I do not want to have to configure firewall to block the port

I think what you want is
socat -v TCP4-LISTEN:77,fork,bind=127.0.0.1 SOCKS4A:44.44.44.44:33.33.33.33:99,socksport=9898

Related

How can I check a socket from a webserver?

Im doing a challenge (CTF style) and everyting we got is an IP.
Scanning that IP only one port is open.
If I connect to that IP and port using netcat, I got a kind of "dance" doing in CMD, with a message at the end that says "Check socket 12345".
I need to understand again what truly a socket is because im not getting anywhere trying to connect to that socket.
Its possible to connect to a socket from a specific port? or I only can make a connection from a open port and there the web servers redirect my connection automatically to a socket?
You can use netcat nc and its -p option to set the source port.
Netcat man page say:
-p port
local port number (port numbers can be individual or ranges: lo-hi [inclusive])
Try "nc -p 12345 dest_IP dest_port"

error in connecting irc through xchat

I installed X-chat on Ubuntu 14.04.
in the first step I enter all the details (nickname, realname etc) and choose freenode as server and click Connect.
But I see the following error:
Looking up irc.freenode.net
* Connecting to chat.freenode.net (94.125.182.252) port 8001...
and nothing happens and there is a timeout error.
and when I type:
/join #python
I see the following:
Not connected. Try /server <host> [<port>]
You aren't connecting to the IRC port. Your client is specifying port 8001 but you need to connect to 6667
Check that you and your provider are not blocking port 6667.
To test this, fire up a terminal and type:
telnet chat.freenode.net 6667
Examine the output to see if the command succeeds (if it does, you'll be presented with freenode's welcome banner):
$ telnet chat.freenode.net 6667
Trying 35.156.219.172...
Connected to chat.freenode.net.
Escape character is '^]'.
:jackson.freenode.net NOTICE * :*** Looking up your hostname...
:jackson.freenode.net NOTICE * :*** Checking Ident
:jackson.freenode.net NOTICE * :*** Found your hostname
If it does not, examine your network configuration, firewall, router and anything at your provider that may block that outbound port.
Some providers, especially schools and colleges, block port 6667 for security and you should try one of freenode's many other ports instead: https://freenode.net/kb/answer/chat

Redirect port on Windows from loopback to outside

I have a socket that listen on port 6100 on my development machine, whose lan address is 192.168.1.2
I can access the socket and use it with the address 127.0.0.1:6100, but I can't access it from 192.168.1.2:6100 (I need to access the socket from another client on the Lan)
If I type netstat -an | find "6100" on the command prompt I get:
TCP 127.0.0.1:6100 0.0.0.0:0 LISTENING
So I need to redirect all calls to 192.168.1.2:A_RANDOM_PORT to 127.0.0.1:6100
How can i do that?
I tried with:
netsh interface portproxy add v4tov4 listenport=6200 listenaddress=192.168.1.2 connectport=6100 connectaddress=127.0.0.1
But without luck
I've finally been able to accomplish this task, but only using an external tool.
I downloaded "PassPort port forwarding utility" and set up a redirection from 192.168.1.2 to 127.0.0.1
Unfortunately I haven't been able to do that without an external tool.
You failed to post the code concerned, but you bound your listening socket to 127.0.0.1 instead of 0.0.0.0. Just fix that. No oort forwarding required.

Cannot get irssi to work on Bluehost dedicated IP address

I am trying to get irssi to work over SSH on my Bluehost dedicated IP server.
Bluehost support says port 6667 is open, but you have to have an app listening to it, so running nc -l on the server and then telnet'ing in works, but if I run irssi on the server then it can't connect to freenode.net - it says the connection timed out.
If you do nmap -v -sT then you see the 6667/TCP port, but it's listed as closed.
How can get irssi to run using an ssh shell on Bluehost?
It Would be great to have under a Screen session you could re-login to from anywhere.
Make sure that you ask them if 6667 is open outbound TCP and UDP.
Sometimes they can mistake it for inbound or only open TCP for example. You can telnet to your IRC host on port 6667 even if something is not listening on the Bluehost side, assuming IRC is up and accepting connections, and Bluehost has the port opened, a telnet from your Bluehost account to the IRC server will work fine.

TCP/IP default port for sending console messages?

Is there a dedicated port (lower than 1024) specifically for clients to send text based console output to a server? I've googled extensively but to no avail. What's the best port (lower than 1024) for sending text based console output if any?
A port is just a number. You can see well known port assignments in /etc/services.
You need a server application to be listening on the given port to accept your input. There are number of remote terminal protocols and their implementations, among which are Telnet (port 23) and Secure Shell, or SSH (port 22).
The simplest way to test your socket client is to setup netcat on the server to listen on whatever port you want (port is 777 in the example bellow), and then try to connect to it from somewhere else:
server:~# nc -l -p 777
then
client:~$ nc server 777
Note that on Unix you normally need super-user (root) rights to bind "privileged", i.e. bellow 1024, ports.
I'm going to use telnet (port 23) since that's closest to what I want. Sending console messages to a server from a client. okey dokey thanks!