Why this error occurs?
this error occurs because you may have a server started on this port which you need to start the Metasploit server on it. so to fix this error we have stopped any other server which is trying to use from the same port.
for example, if I had a python simple HTTP server on port 80 and my listener use port 80 this problem will occur.
This is a picture of the error. take a look at it :
as you can see, the Metasploit gave me an error wich is telling us that the port (LPORT) you choose is busy now and that why we get an error calling Handler failed to bind to x.x.x.x:y.
what is the solution to this error?
the solution is really easy. first, you need to check which server is using this port and what its PID?
to do that you need to type the following command in your terminal :
be careful that you have to type your port instead of the 80 in the command. and you can see the command and PID of the python server on port 80.
now you have to kill this server to start your Metasploit server on this port.
to do that you need to kill this PID it's simple you just have to type :
PID in this tutorial is 1749, so ill put this instead of the PID in my terminal like the picture below :
and after hitting enter, any other server on port 80 will terminate and the port will be free to use it :
this is how to fix error handler failed to bind , thank you for reading this tutorial and please let us know if you have any other questions and don't forget following us to make more tutorial.
author: Mohamad Chavoshi
email address: email@example.com
written in: 2019-8-3