How to find a local webserver without knowing the IP? - tcp

I am doing a project where I have an embedded device running a webserver, and connected to a local WiFi network. Now I want my smartphone APP to connect to the webserver, but unless I chose to force a static IP to my embedded device, the app has no way of knowing what the IP of the webserver is.
I've looked into mDNS, but android doesn't support this, therefore it's a no go?
Any ideas of how I can connect my app to the embedded device?
(Google Chromecast does exactly this, but how?)

The way GoPro accomplishes this is by having the camera provide an access point, and then connecting directly to it from the client. For the embedded device, you could look at hostapd. You could store the SSID and pass phrase in the app somewhere, perhaps.

Related

How to enter the website via the ip address in the mobile application

I'm working with the esp32 which has access to wifi, but I need to pass wifi credentials and I can complete this by connecting to est32 access point and entering the website via ip address, where I can pass wifi credentials. My question is, can I enter this webpage via ip address through my vue application without closing it?
Or maybe anyone had similar problem, and found interesting solution? How to pass wifi credentials to esp32 (it has also bluetooth) with my own vue application?
Before you start building your own provisioning solution note that Espressif has a rather useful WiFi provisioning example using BLE, complete with an Android and iOS app.

Can't communicate with smart IoT devices using HTTPS

Every time I purchase an IoT device (smart lock, bell, plug, etc.), there usually is also a way to use it by going to http://192.168.1.x but there NEVER seems to be a way to communicate it using HTTPS securely. Is this a big problem for HTTPS? Is there a solution for this? I don't want someone on my network to look at what I am sending to my device over http but I can't use https either. What can I do?
I know that TLS certificates require a hostname to verify the authenticity but these IoT devices only tell me to open the control panel using http and local IP. Does that mean all my communication with my smart device is in plain text and open for everyone to read?
Does that mean all my communication with my smart device is in plain text ...
If it is plain HTTP then yes.
... and open for everyone to read?
If everybody can read the communication inside your local network then yes. Fortunately in most local networks this is not the case. For example if you have your own WLAN which is properly secured with WPA2 and a strong password then only the ones which know this password can access the local network - but these would be able to sniff the traffic to the IoT device then.
... but there NEVER seems to be a way to communicate it using HTTPS securely.
This depends on the actual device, i.e. some might offer HTTPS but many still don't. If this is a problem for you since your network is open to potential attackers then you better put these devices in a separate network where only you have access to.

How to find all the IP addresses a application uses?

Our company computers have very limited access to Internet, when a application needs connection to internet we usually allow the IP addresses that application needs to connect through firewall.
Now I am trying to connect this particular application to their cloud service and added three IPs which I know it uses to pass through firewall, but the application still having issues to connect to the cloud. With unrestricted internet it connects without any issues.
Is there any way of finding the list of IPs this particular application uses through Microsoft network monitor or any other monitoring application, If so could you please let me know how to do it?
Install Wireshark on the same computer where the application runs, then perform capture while the application is trying to connect, by analizing the capture with Wireshark you could be able to see all the connection attempts
Used Microsoft network monitor, Works really well once you start the process on there and start the application the left hand panel will show up with traffics on the apps that are connecting to the internet.

How do I create/manage the stuff on private IP address of a device connected to LAN?

Okay. I really didn't know how to explain the question in title. What I actually want to do is this:
Suppose a device is connected to WiFi, i.e. it's on LAN. It would have a private IP address like 192.168.xx.xx like that. What I want is my (android app/or technically general way) program to have access to that IP and display some info on it, like a webpage or maybe live screen of the device itself?
For ex: http://192.168.0.105:5901/thisScreen would stream live screen of a mobile device. This URL can opened by any device connected to LAN. How do I achieve that streaming access on that particular IP address assigned to the device? (Assume I've control to everything).
How do I even begin for this? Networking? How do I implement it? Any references? I tried to Google my problem but didn't find any help.
Since you ask in general, what you want is to serve sth on a lan ip ex: on 192.168.1.50:80 and that is available to everyone on the same lan to be precise in 192.168.1.0/24 right?
Well if you haven't done any configuration such as subnets smaller than /24 that is what happening by default.
To confirm that run a web server an nginx for example on a local machine and visit the ip of this machine from another device on the same lan, you will see the default page of nginx.
So the only thing you have to configure is a service to run on a local machine and serves sth.

How to connect two devices through Wifi without using mDNS?

I have an embedded webserver running on a device. Now I want a smartphone app to connect to the webserver. They are on the same wifi network but they don't know each others IP addresses.
I understand that this problem is often solved by implementing the mDNS protocol on the server. But are there any alternatives? Can the server maybe ask for specific IP address or similar?
If it has to be entirely automated, such that the embedded webserver is discoverable, perhaps scan the entire netblock looking for the correct response "http://[IP_address]/yes-im-the-one" from your embedded webserver?
Although beware, some network monitors may then consider the IP of your smartphone/device that does that scan "dangerous" and cut it off from the network - this is probably only a "big enterprise" problem.
...after you "find" your server, perhaps the application should cache/remember this, so it doesn't have to scan next time.
Other things you could do: give your embedded webserver a static IP on the LAN, either by setting this on the device itself, or via a DHCP reservation from whatever is the local DHCP server on the LAN.
What allot of emended devices do is come delivered with a static LAN IP already set on it, then it's up to the sysadmin to change their computer's IP temporarily to be in the same range, then they can visit the webserver or telnet into the default IP, and change it to what they want (to match their network's IP range)

Resources