Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By forlotto
#33416 If I recall correct gpio values could be changed just with a URL as long as you had the ip it was something like this:

http://espaddress/pin1=0

This means that anyone visiting your IP to see what you have live can see what is going on...
And people will know what basic nodemcu is.

So if you have a relay hooked up to your lighting and you wish to switch it on/off remotely it can be done by simply visiting the URL this is great but it will lead to folks shutting stuff on/off that you do not want to.

So it is my suggestion to integrate the interface password into the on off function.

So instead of turning stuff off like
http://espipadress/pin0=1

Once password is entered we turn stuff on and off like this
http://espipaddress/password/pin0=1
or
http//espipaddress/passwordpin0=1
or
http://espipaddress/pin0=1password



This way everything is protected against abusive usage.

I currently do this with LUA on my device as a protection then I have a local webpage I run with buttons to turn stuff on and off etc...

Would really love to see this security measure integrated.

Thanks!
User avatar
By Mmiscool
#33418 Hello. This is possible with esp8266 basic. The demo from the link below will allow for arbitrary I/o pin control. You could ad another urlmsg to use for a password.

http://www.esp8266basic.com/msg-url-advanced.html
User avatar
By forlotto
#33475 Ahhh I see!

So basic does not handle on/off by url as a standard its not hard coded in so to speak you actually must first run the program which will allow for it ...

So with the example code.
Code: Select all    msgbranch [mybranch]
    print "You can send msgs to the esp and do things based on accessing a URL"
    wait
    [mybranch]
    MyReturnMsg = "Not a valid msg received"
    msgget "pin" pinNo
    msgget "stat" pinStatus
    msgget "action" pinAction
    if pinAction == "po" then gosub [po.pin]
    if pinAction == "pi" then gosub [pi.pin]
    if pinAction == "pwo" then gosub [pwo.pin]
    if pinAction == "pwi" then gosub [pwi.pin]
    if pinAction == "ai" then gosub [ai.pin]
    print "DOne with retrn code"
    msgreturn MyReturnMsg
    wait

    [po.pin]
    po pinNo pinStatus
    MyReturnMsg = "good"
    return

    [pi.pin]
    pi pinNo MyReturnMsg
    return

    [pwo.pin]
    pwo pinNo pinStatus
    MyReturnMsg = "good"
    return

    [pi.pin]
    pwi pinNo MyReturnMsg
    return

    [ai.pin]
    ai MyReturnMsg
    return


I could modify like so...

Code: Select all  if pinAction == "po-password" then gosub [po.pin]
    if pinAction == "pi-password" then gosub [pi.pin]
    if pinAction == "pwo-password" then gosub [pwo.pin]
    if pinAction == "pwi-password" then gosub [pwi.pin]
    if pinAction == "ai-password" then gosub [ai.pin]


This way in order to preform any pin action the action would have to contain the action po-password.

What I don't understand is exactly where the code is doing any reading of any sort ...

Is there a buffer setup somewhere that automatically reads all requests that I am just not seeing.

I am curious how this buffer is handling data coming into it. Is there prevention for say overflow or execution of data ?

How does it take a URL request and know that the URL code pertains to it without some of the functions being hard coded in ?
I am not seeing anywhere within the code how the data is being scanned.

Sorry if I am not making since to you but I am a bit concerned that people will indeed like to find node setups and tinker with them as it is human nature while it is not my goal to provide smartcard strength security (which I know is still somehow breakable) it is my goal to deter the average tech savvy individual from doing so or at least doing enough to where your interest would have to lie explicitly in pen testing in order to fool and turn my lights on or off so to speak.


Short term goal:
Use esp8266 basic to control a single device via a web page with simple on/off and possibly allow for weekly timers possibly 5 per day for every 7 days.

Long term goal:
Have several esp8266 devices controllable by a single web page that also allows for weekly timers viola home automation.

Back burner goal: Possibly make a wireless button or group of buttons that would work as keystrokes for any device connected to it essentially preform keyboard enumeration and set whatever keys you wish the gpio to serve as or possibly a string of keys like entering a password with the push of a button so you'll never forget it. I could think of many applications for this.

Other goals at this point are unknown although I will likely think of more applications I have seen some pretty neat lighting effects who knows maybe an XMAS lights display etc IDK I suppose the clock on kickstarter was a neat concept simple yet new and effective.

Warning TL:DR coming up lol!
Personal Motivation Behind My goals no need to read:
Turning switches on and off if you spent just 2 minutes walking around turning switches on and off since you were born on average this would equate to 40 days of your life!!!

I know a lot of people may think that it is lazy etc... But once life winds down and you get to the golden years if you observe people would give anything to live another 40 days and if I were to guess a good portion of those days would be when the quality of living is good or good enough at least 38 of them. Another good portion of them would be when you have motivation, youth, etc... likely 25-28 of those days depending on the individual.

Home automation could essentially provide you with a priceless commodity which is more time to live less time to preform menial tasks more or less I really see the reason for smart homes and the want once I started crunching numbers. Automation in a factory has been done for ages it is time that the working class had affordable automation of their own I feel so that they can leverage automation to buy them more time through out the course of a day as well as it seems the plate just keeps getting fuller for families and they have less and less time to function as a family because more and more of their time is focused on money as a means to an end. Estimated to be in the 70% + of energy expenditure of a persons life during their waking hours is money... So that leaves you 30% of your energy to preform menial tasks and function as a family. If technology can eliminate menial tasks at home at a fairly low cost we could give people some of the leverage back that was craftily taken away over the last 45-60 years...
User avatar
By Mmiscool
#33481 I have worked very hard to make it so that there is no twiddling around parsing url requests and what not and just let the interpreter do the work for you.

As to being able to controll many devices.

I posted the following example. It shows you how to under windows or linux from the command line turn things on or off.

If you set up a web server on you PC you could have that provide a nice shinny interface for all your device in one spot. As long as your server ws on the same network as the esps it could securely tug on the required urls for the esps and control them.

In php you could use some thing like this. You will have to change the ip for your device.
Code: Select all  <?php
$output = shell_exec('wget "http://172.16.0.182/msg?pin=2&stat=1&action=po" -q -O -');
echo "<pre>$output</pre>";
?>