HelloZeroNet / ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network
https://zeronet.io
Other
18.37k stars 2.27k forks source link

A Port Scanner and Automatic Open Port Selection Mode Built Into ZeroNet Would Be A Life Saver #1857

Closed styromaniac closed 5 years ago

styromaniac commented 5 years ago

It's becoming my go-to thing to scan for ports for ZeroNet to use, and port scanners have gotten me where I needed to experience ZeroNet at full speed.

This would be a good thing to put before new users to try instead of digging into router settings, especially when some routers aren't that functional (UPNP doesn't work on the PoS modem/router combo I'm renting even though it's a listed feature) or they don't have admin privileges to make changes there, plus going into router settings is only excessive work if there's already a TCP port open. Port scanners remove a lot of steps and trouble.

"So why not just stick with port scanner apps?"

That's not the point. This is something that probably only I had discovered out of ZeroNet's entire population, and better than making a post on ZeroTalk that would get buried is to present this as a native feature to ZeroNet, and selecting the port automatically if the user prefers.

It's as important as the UPNP port puncher.

HelloZeroNet commented 5 years ago

You mean try to bind and test connecting from outside every port between 1000-65535?

styromaniac commented 5 years ago

I use this to scan for open ports. Hopefully the code is commented well enough.

https://github.com/stealthcopter/AndroidNetworkTools

If ZeroNet can do that, more people will get the most out of ZeroNet in a very simple way.

rllola commented 5 years ago

I like the idea and I believe it can be quite useful. Also port scanning in python is really easy to implement.

You can use something scapy if you are lazy : https://scapy.net/

Edit: Scapy might be overkill for this simple task though.

HelloZeroNet commented 5 years ago

I still don't fully understand how would it work, what ip and ports do you scan with it?

rllola commented 5 years ago

If I understand it well, the idea would be to have a plugin that would replace Port Checker (https://portchecker.co/) and scan your ip address for an open port and will choose this one for Zeronet.

Quite often UPnP doesn't work for me neither and I am working from cafe/hotel/house so I don't have access to the router settings.

Another option would be port forwarding ? Can we do that ?

I really don't know much about network.

HelloZeroNet commented 5 years ago

Yeah Upnp support in public places are very rare, but I don't think that routers will forward random ports to you internal ip address. So I still don't see how is this improve the situation.

rllola commented 5 years ago

Yeah Upnp support in public places are very rare, but I don't think that routers will forward random ports to you internal ip address. So I still don't see how is this improve the situation.

Yeah I just realize that you have to map to your internal ip address so it will not work.

rllola commented 5 years ago

@HelloZeroNet Can we do port forwarding somehow ? Again I am not entirely sure how it would work but could it bypass the router restriction ?

duckartes commented 5 years ago

Hidden sites on Tor ignore port restrictions, as far as I've experienced :)

styromaniac commented 5 years ago

Huh? I find open ports in the wild.

I don't have access to my OWN router's admin panel even, because this router has a bug that locks out the admin just for overriding DNS settings.

It also works at the library.

I believe you have to scan the gateway for open ports.

However it is that you guys think it couldn't work, it actually does very beautifully. There's something so simple yet not well understood about how useful this is with routers you don't even have admin privileges to.

Bet you a few dollars I will find open ports at restaurants. Shall I head to the bakery now and post results?

HelloZeroNet commented 5 years ago

You may find open ports, but it's useless if the incoming connections are not forwarded to your machine.

styromaniac commented 5 years ago

But I don't have any port forwarded from my router to my phone, yet I'm running a tracker with the Bootstrapper plugin.

I'm 12.8.82.187:9001

Maybe on public WiFi you're right. I hadn't gotten Bootstrapper working at the library, but on home WiFi it's different and not for any reason on my behalf.

styromaniac commented 5 years ago

https://play.google.com/store/apps/details?id=threads.server

This, like the port scanner I linked, is finding the open ports on my router. 4001 and 5001.

HelloZeroNet commented 5 years ago

4001/5001 is the default port for ipfs (like you see on the screenshot)

styromaniac commented 5 years ago

Instead, suggest those ports to the user and any likely candidates to work out. Or... make a list showing the IP addresses and port numbers of other nodes.

styromaniac commented 5 years ago

I'm closing this issue because it looks like ZeroNet is finding open ports or successfully port punching now. The port was randomly selected, yet it's open and I'm running a tracker without issue.