Arduino print commands - printing

I am currently connecting my Arduino Uno with the Wi-Fi shield and everything is going great. Where does the print commands (such as WiFi.localIP() or Serial.print() ) print?
I searched and can't find them. I try to access with my web browser to my IP address, but nothing's working.

Serial.print() will print to the serial interface regardless of whether the Wi-Fi shield is connected or not. This is particularly useful for debugging. These characters WILL NOT go out over the Wi-Fi connection.
To print characters to a connected WiFi client (when using the Arduino as a server), look at the example Wi-Fi Web Server.
Notice how the HTTP response is built up line by line. If you're trying to connect to your Arduino through your web browser, you can follow the format in the example and replace it with the necessary text or HTML you want to see in the browser.

Related

Internet connection problem from different network for NodeMCU ESP8266 which I am using for IOT home automation

Would anyone like to help me with this problem please?
how to connect/control Nodemcu esp8266 wi-fi module from different network for control iot devices from outside of any home/ house?
Internet connection problem from different network for NodeMCU ESP8266 which I am using for IOT home automation.
Actually, in case of an class project, I have used some code (also coppied some code and took help from some website) from internet and also used Blynk for controll my ESP8266.
But not i want to make a personal app by which app I can control my devices outside from my home.
I have already connected with my WI-FI router with my home network!!
It worked well,
But i don't know how to do the same thing from different netwrok.
If possible I think anyone can help me....
Thank you.
To everyone.
This has been answered in greater detail on both the Arduino and Internet of Things StackExchange sites. In summary:
For safety, it is difficult to start a connection to a device on another local network. Devices on WiFi networks are protected from the Internet by a firewall, which is normally configured to return responses to requests sent by the devices, but block all unsolicited messages. Even if the firewall allows an incoming connection on a given port, "port forwarding" or other custom configurations are needed for unexpected messages to reach one of the multiple devices on the network (the devices usually share the same public IP address of the network and external systems' messages cannot reach the right local address without forwarding by the router).
Any device exposed to unsolicited requests like this is at risk of being attacked and can pose a risk to other systems on the network. It is thus safer to leave the firewall the same and instead make the device subscribe to an external webserver, which acts as a mailbox for incoming messages. Then, you can send requests to the server from anything with an internet connection, and the server will store them and relay them to the ESP8266 whenever the ESP asks. MQTT protocol using a server-side broker program like Mosquitto and a client like PubSubClient on your ESP8266 could work for this sort of publish-subscribe model, and MQTT tutorials and explanations are available both on both tool sites and Stack sites.
You can use Arduino IDE to program ESP8266 device.
https://randomnerdtutorials.com/how-to-install-esp8266-board-arduino-ide/
After installing ESP8266 in Arduino IDE. You need to connect ESP8266 with WiFi router(which have internet connected). Once your device is connected with a WiFi router. you can MQTT protocol to communicate with the server. You can use the following library in Arduino to implement MQTT client in ESP8266. ESP8266 is used to send and receive data from a different network. ESP8266 is subscribed to a particular topic. You can publish data to that topic from different MQTT client.
https://github.com/Imroy/pubsubclient
Use the Following link to get more familiar with MQTT protocol
https://www.hivemq.com/blog/mqtt-essentials-part-1-introducing-mqtt
You can use MQTTfx desktop application to send and receive data from NodeMcu(ESP8266).
MQTT basic diagram for understanding

Use USB printer over TCP/IP

I have an application that sends ZPL print jobs via TCP/IP to a client in the network (I can configure IP and Port). I have only a USB printer available that is attached to a client. How can I send print job to the client with the USB printer, and let this client print the job with the USB printer?
Sending to the client is not the problem, I just configure the IP and some Port. But how can the client print this via the USB printer?
There are a couple of methods to do this. They all require a app on the system that the USB printer is attached to. You can send the ZPL to a generic raw driver. You can also use an SDK to send the ZPL to the USB printer. If it's a Zebra printer, we have a Java and a .NET based SDK that can do this. For a complete answer, it would be really helpful if you mentioned the platform/OS the printers will be connected to and the language the 'client' app will be written in.

Find MAC Addresses of devices in range of Wifi router with programatically

How can I programtically get the MAC address of WiFi router.
i want the command or the program in c which will list only the mac address of devices which are connected to the my WiFi router. it it possible to get when i know the IP address of the router?
Getting the MAC of the WiFi router on which you are connected (or try to connect) is probably possible if you have access to low level network frame.
Now it looks you are indeed willing to get the MAC of ALL the devices connected to the WiFi router, which is another thing ! Unless the router has some building functionality that gives you this list (like an HTML summary, I don't know if openWrt provide this), I don't think by running a program in C on a client, you would be able to get the MACs of other connected clients !
But in case the router as the information in an html page (eg : from a remote administration), you might try to simulate login to administration, get this page then parse the page to get the MACs... from a C prog..
Taking your problem from another side, if you have a wireless adapter you can set in monitor mode, you could sniff the wireless traffic on the channel(s) opened by your targeted WiFi router, and list the distinct client connected. Have a look to BackTrack's ssidsniff ?

How can I determine which packet in Wireshark corresponds to what I sent via Postman?

I'm trying to figure out why REST calls sent from my handheld device (Windows CE / Compact Framework) are not making it to my server app (regular, full-fledged .NET app running on my PC).
The handheld device and the PC are connected - I know that because I can see the handheld device in the PC's Windows Explorer, Windows Mobile Device Center verifies the connection between the two is valid, etc.
I reach the breakpoint on my server app running on my PC when I pass the same REST call via Postman, namely:
http://192.168.125.50:21609/api/inventory/sendXML/duckbill/platypus/poisontoe
...but not when calling the same from the handheld device.
So, I want to see in wireshark just what is being sent from postman, so I can see what to look for when attempting to call the same REST method from the handheld device.
I set up a filter in wireshark, namely "ip.dst == 192.168.125.50" and get a handful of results when calling the method via Postman, but nowhere do I see "port 21609" which I would expect to. If I saw this, I would know I was looking at the right packet, but...where is it? When I run Postman and make the call, there are four packets captured by Wireshark, and none of them give that as the port number in the "User Datagram Protocol" element.
If the port number is disregarded, how can I determine which packet is the one from Postman?
UPDATE
Yoel had a good idea; I added "Dest port (unresolved)" and "Sourceport" as columns to display.
I then started a new live capture in Wireshark and sent the URL / REST method from Postman.
The breakpoint in the server app was indeed hit. I F5'd through it, and stopped the Wireshark capture.
"21609" is not seen in the Dest Port column anywhere.
Why? How is the URL being sent, and yet Wireshark is not detecting the port to which it was directed?
Also, in the Protocol column in Wireshark, I see no "HTTP" entries.
To see the destination port in the packet list, you have to add a column by right clicking in a column header and selecting Column preferences.... Then click on the + sign, choose a column title, and put
tcp.dstport
as the Fields parameter.
You can also directly use the display filter with the expression:
tcp.dstport == 21609
(tested with Wireshark 2.2.0)
The answer is as short as:
tcp.port==53218
First that the new postman port is 53218, second the original Answer is tracking only the requests without the responses. So if you want to track the whole communication - tcp.port==53218 will do it.

Capture Mobile Data Packets

I would like to capture packets of the internet traffic of my mobile. I would like to ask that if I install wire shark on my desktop machine, and then make my desktop a wifi hot spot, connect my mobile phone with this desktop powered wifi then Would I be able to capture/analyse packets of my internet traffic of mobile on wire shark at desktop?
Your help is highly appreciated.
(I can try it to see if it works, but don't have access to LAN at the moment and need the answer, Thanks for your help)
Here is one example that I did for my undergrad computer security course. It's called Rogue Access Point. I will not go into detail, but here is a rough guide.
Share your mobile data from your smartphone through USB, and make sure you have internet connectivity.
Connect an Ethernet cable from the Ethernet port to a LAN port of a wireless router to your desktop.
Rename the service set identification (SSID) to the same SSID provided by WiFi provider (For example, Starbuck WiFi, this was what we did, I do not recommend you do it).
Turn on Wireshark and start collecting packet.
Use filter in Wireshark to find packets related to Facebook login. Use keyword: datr You will find something like
Cookie: locale=en_US; c_user=506850624; fr=02PxKMh4c31xOpTft.AWXeEL4hlFqGE5DB0l5hpcqzlZU.BP2Yvw.3d.AWV3N4cB; xs=1%3AUONPf83CTZsfeQ%3A0%3A1349269748; datr=c_l0TvTFOzJaSVQPYIXjZ2am; lu=Tg2KgC1vKc8eTORy62Su_97w
Open Firefox, install any cookie injector Add-on.
Navigate to Facebook page and start the cookie injector.
Copy everything from fr=, in our case 02PxKMh4c31xOpTft.AWXeEL4hlFqGE5DB0l5hpcqzlZU.BP2Yvw.3d.AWV3N4cB and paste to cookie injector. And refresh the page. Now you should be logged in to Facebook with whoever uses your WiFi hotspot to access Facebook previously.
Note: Facebook now uses HTTPS by default unless you change it in your Facebook privacy setting. This method no longer works on Facebook. It "might" work on other login pages. You can easily find a guide on how to set this up on Youtube!
Best of luck!

Resources