 Okay, this video is gonna be about the Cancun Smart Plug. I just ordered on Amazon, just got it in today. I've played with it for five to 10 minutes and I'm loving it so far. So if you wanna get one of these devices, if you go to Amazon and you search Cancun Smart Plug, you can see it right here. I bought mine for 20 bucks. Now all of a sudden, they're new for 15. I wish I saw that when I bought mine. These are cheap little devices running Linux. And the reason I bought one is because I heard that you can get a root shell on it. Because a lot of these devices, you need a app for either Android or iPhone. I hate installing unneeded software on my devices, especially proprietary software. So if I could get a device that I can access and control without that, especially if I have a full root shell, that's what I'm up for. So I plugged it in and it says, the directions say plug it in, wait 20 seconds, install the app on your device and then try connecting to it. Plugged it in, waited 20 seconds for it to boot. I'm at my desktop so I plugged in a USB Wi-Fi dongle if I do IF config. You don't see my Wi-Fi device. If I hit dash A, you can see it is there. It just isn't up so what I would do is pseudo IF config, LAN zero up or whatever your device is called. Now if I do IF config without the A, it's there. And so what I'm gonna do next is I'm going to scan the for Wi-Fi connection. So I'm gonna say, so this device by default is not encrypted until you get it set up in which case it'll be connected to your network eventually. But today we're just gonna connect to it and since there's no encryption, I'm not, I don't need a network manager, I could just use some commands here in the shell to connect to it. So I'm gonna do pseudo IW list and I wanna scan, we'll land zero. So we'll land zero scan, give it a few seconds, it's gonna find two networks, my home regular router and then this one, okay, SP3, that's the one we want to connect to that is the plug. It's acting kind of as a router right now or at least an access point. So now what I'm gonna do is I'm gonna say pseudo. By the way, I'm hitting control L to clear the screen just to keep things clean for you guys. So pseudo IW config, we'll land zero and we want to connect to ESSID of zero K underscore three P or SP3. So my device knows to connect to it now. We need to get an IP address from the device. So I'm gonna say pseudo DHC client or DH client and I'll say we'll land zero space in there and it's this file exists because I've already connected to it about 10 minutes ago. So it's already given me an IP address which you may have seen earlier when I did IF config. You can see my IP address on the wireless device connected to that right there. So now I need to find the IP address of the device itself. So you can use NMAP but the way I usually do it is I like having ARP scan in and if I just do pseudo ARP scan dash L dash, oops, dash L dash capital I and my wireless device which is we'll land zero. I hit enter, it's gonna do a quick scan and the only other device it finds is this one right here. So I'm gonna start doing now is I'm gonna do an NMAP scan on that and that's gonna take a few minutes or about a minute. So what I'm gonna do is I'm gonna hit I'm gonna open up a new shell here and what I'm gonna do is I'm gonna say Google Chrome and I'm just gonna go to that IP address just to see if there's a web server set up on that. You use whatever web browser you want and it opened up on my second screen here. So here we go. When you go to the device there is a web server running on it but this is all you get as the main index. If I try to go up a directory it doesn't bring me anywhere. So at least we know there is a web server running on it and that's a good thing. Now, if we close this and we exit out of this we still have NMAP scan, oh, it just finished and you can see there are three ports open. Port 53 and port 22 and the port 22 is the reason I bought this device. So if I do SSH and I'm gonna log in as root give it the IP address which is 192.168.10.253. The first time you connect it's gonna say about security key, you wanna type yes to accept that and by default from a Google search I did it's gonna be one of three passwords. It's either gonna be admin all our case, one, two, three, four or it's going to be P9Z34C. I'll have all this information in the link in the description. Mine was that long one all lower case so we'll go ahead and type that in, hit enter. Ta-da, we have a root shell on the plug itself. This is great. So just real quick, let's check out some things on this system I'm gonna do. Well, obviously it's running busybox. Let's see what tools are installed on busybox. Lots of good tools. They even have churroot installed which means if somehow I could get storage on this device a little more storage than what's available I could theoretically boot into any distro I want. I could boot Debian in a churroot but really there's other devices that are about the same price for $15 to $20 that give you USB ports that you can do that sort of thing with. You see there's some other tools here. I don't see the HTTPD, the web server that you can run through busybox which I like to use but we do know there is a web server on there so we just need to figure out where that is which we'll do in a future video but let's also just check out how much space is on this device. So I'll do DF-H and here you can see we have a few different partitions. The largest partition is about 14 megabytes. It's the temporary partition which is probably running in RAM. So why don't we see what our RAM is. So I'll say Free-M, see out of the memory and our total memory is 29 megabytes so it's probably a 32 megabyte chip. So that's obviously not a powerhouse here but of course what is it designed to do? It's designed to turn devices on and off but real quick before we get into that last little part I do want to say by default again you had the password you'll probably want to change that default password and remember it but of course you can use passwd hit enter you can type in the password that you want I'm putting a real short one in just as an example it's saying too short I type in a second time it's telling me it's too short but I'm root so it's going to let me do that anyway so if I was to exit out and reconnect I can type in my new password hey okay so the password did take so now what do we want to do? We want to be able to turn devices on and off that we have plugged into this smart plug so let me go ahead and plug this right in and by default the plug is on which is a good thing you know in case for some reason you don't have access to it by default wherever you plug into it will be on but just like on your desktop you can turn every little LED on and off on your computer, your laptop, or desktop if it has little blinky lights on it you can turn them on and off usually by just echoing into a file because in Linux everything is a file so if we echo zero is on one is on, zero is off so if you want to turn it off we're going to say zero and we're going to put zero into a file so I'm going to say sys class leds tp and I'm hitting tab to complete so tp link, blue relay and we're going to say brightness so we're putting zero into brightness and we can turn our device off and again same command putting a one into there we can turn the light back on or whatever device we have plugged into it and of course we can read those values so if I was to cat that out I can see that the device is on and if we turn it off and I cat out that file I can see that it's off so we can write scripts to check whether it's on or off so we can make a toggle switch that turns it on and off we can have a different button for off we can have one button that checks and we will be making a GUI interface once I figure out the HTTP server on this thing but of course I can do like a while loop should be able to do something like this we're going to go let's see I guess we don't need to do a while loop we'll just do turn it on sleep for 5 seconds and then we'll turn it off and then we'll sleep for 5 seconds and then we'll turn it back on so when I run this command we're going to turn the light on it's going to wait 5 seconds and turn the light off and it's going to wait another 5 seconds and then turn the light back on so obviously lots of stuff we can do we can do remote access I can tell you a little over 10 years well yeah definitely about 15 years ago I actually worked for a company programming home automation systems this is again 15 years ago so it was kind of a new thing big expensive things big multi-million dollar homes and one of the features that we could program into them that I always thought was a neat idea was the vacation mode we could program into these systems we could pick certain lights and put them in as variables into the vacation mode and so when a person is leaving the house they'll have a keypad and they can press that vacation mode and we can set a certain time so we can say well after 9 o'clock until midnight randomly turn these lights on and off at random intervals so you know when you go away on vacation sometimes you'll leave a light on so it looks like somebody's home well this would change it so if someone was watching your house the lights are different each night and you can see them going on and off at different times so I've always wanted to be able to do that at my own house and now I can with a $20 device probably better if I had two or three put them in different rooms but I can write a script and have it on the device itself after a certain time you know turn these lights on and off maybe every 15 or 20 minutes and so it'll look like somebody's at home so that's one of my goals with this project and also again I'm going to try to make a web interface so I can access this with my phone or tablet and also at this point again right now I'm connected from my desktop directly to the device through wifi I want to get it on my network if possible of course that's what it's designed to do but I need to figure out how to do it without their you know planetary application worst case scenario if I can't figure out although I should be able to I have a root shell here I just need to look at what tools they have for networking obviously it has to be able to be doing it but let's say I couldn't figure it out I could always install the device or the app on a virtual machine and then get set up and then remove that virtual machine so few more weeks of this I hope that you come back so you don't miss any videos I hope you found this useful and as always I hope that you visit my website filmsbychris.com that's Chris of the K there should be a link in the description as well as notes to everything we've done today and I just hope that you have a great day okay this is an introduction to filmsbychris.com I'm Chris that's Chris of the K that's me right there my daughter Ember and my wife Jennifer we pretty much live in the swamps of Florida I'm a firefighter by day as well as by night we work long hours but that's not why you're here you're here about the videos I put up on YouTube these videos are mainly about computers and programming which means most of my videos look something like this and if that's what you're interested in great! if not, that's alright I do videos on other topics too such as video editing, special effects photo editing, 3D design and music creation if you are one of my viewers and you enjoy my videos my Patreon page is a place where you can go to help support my videos so I ask that you take the time to go to my Patreon page and look at different levels of rewards you can receive 4 different levels of backing there should be a link in the description of this video if you are watching it on YouTube otherwise you can visit patreon.com forward slash metalx1000 and I thank you for your time and your support have a great day