Shop OBEX P1 Docs P2 Docs Learn Events
WX ESP8266 Forwarding to WWW and Protecting Setting Pages - Page 2 — Parallax Forums

WX ESP8266 Forwarding to WWW and Protecting Setting Pages

2»

Comments

  • ShawnaShawna Posts: 508
    edited 2018-12-10 01:36
    Clock Loop
    Well, I'm still missing something. Here is the output from my "make clean" and then my "make" commands. I tried loading the make.ota file but it just hung there.

    I rebooted the module and it hasn't changed. I mean the module is functioning as it was before I tried updating the firmware.


    Does the wx have to be in STA-AP mode? I wouldn't think so.

    I didn't see any erros.

    I will attach a zip file of my Parallax-ESP folder, if you would be willing to see if it looks ok. All i changed was some text on the index.html home page as a test.
    The make.ota file is not very large.

    Thanks
    nick@ubuntu:~/esp-open-sdk/Parallax-ESP$ make clean
    VERSION v1.0 (2018-12-09 17:07:29 24-g5c340ae)
    make[1]: Entering directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd'
    make[2]: Entering directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    rm -f mkespfsimage main.o heatshrink_encoder.o
    make[2]: Leaving directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    make[1]: Leaving directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd'
    nick@ubuntu:~/esp-open-sdk/Parallax-ESP$ Make
    
    Command 'Make' not found, did you mean:
    
      command 'rake' from snap ruby (2.5.3)
      command 'fake' from deb fake
      command 'make' from deb make
      command 'make' from deb make-guile
      command 'rake' from deb rake
      command 'jake' from deb node-jake
    
    See 'snap info <snapname>' for additional versions.
    
    nick@ubuntu:~/esp-open-sdk/Parallax-ESP$ make
    VERSION v1.0 (2018-12-09 17:07:58 24-g5c340ae)
    make[1]: Entering directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd'
    CC espfs/espfs.c
    CC espfs/heatshrink_decoder.c
    CC core/httpd-nonos.c
    CC core/httpd-freertos.c
    CC core/sha1.c
    CC core/httpdespfs.c
    CC core/auth.c
    CC core/base64.c
    CC core/httpd.c
    CC util/cgiwebsocket.c
    CC util/cgiflash.c
    CC util/captdns.c
    CC util/cgiwifi.c
    AR libesphttpd.a
    make[2]: Entering directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o main.o main.c
    cc -I../../lib/heatshrink -I../../include -I.. -std=gnu99 -DESPFS_HEATSHRINK   -c -o heatshrink_encoder.o heatshrink_encoder.c
    cc -o mkespfsimage main.o heatshrink_encoder.o
    make[2]: Leaving directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd/espfs/mkespfsimage'
    w3.css (30%, heatshrink)
    websocket/index.html (51%, heatshrink)
    newpage.html (59%, heatshrink)
    console.js (40%, heatshrink)
    settings.html (28%, heatshrink)
    update-ffs.html (46%, heatshrink)
    favicon.ico (78%, heatshrink)
    ui.js (43%, heatshrink)
    log.html (57%, heatshrink)
    index.html (58%, heatshrink)
    logo.png (100%, none)
    indexold.html (58%, heatshrink)
    wifi/140medley.min.js (74%, heatshrink)
    wifi/connecting.html (52%, heatshrink)
    wifi/wifi.html (41%, heatshrink)
    wifi/icons.png (100%, none)
    wifi/style.css (94%, heatshrink)
    style.css (40%, heatshrink)
    flash/140medley.min.js (74%, heatshrink)
    flash/index.html (50%, heatshrink)
    make[1]: Leaving directory '/home/nick/esp-open-sdk/Parallax-ESP/libesphttpd'
    CC parallax/sscp-settings.c
    CC parallax/cgiprop.c
    CC parallax/sscp.c
    CC parallax/sscp-fs.c
    CC parallax/user_main.c
    CC parallax/discovery.c
    CC parallax/roffs.c
    CC parallax/sscp-tcp.c
    CC parallax/sscp-wifi.c
    CC parallax/sscp-ws.c
    CC parallax/sscp-cmds.c
    CC parallax/sscp-http.c
    CC parallax/httpdroffs.c
    CC parallax/proploader.c
    CC esp-link-stuff/crc16.c
    CC esp-link-stuff/config.c
    CC esp-link-stuff/uart.c
    CC esp-link-stuff/log.c
    CC esp-link-stuff/gpio-helpers.c
    CC esp-link-stuff/task.c
    CC esp-link-stuff/status.c
    CC esp-link-stuff/serbridge.c
    AR build/httpd_app.a
    LD build/httpd.user1.out
    LD build/httpd.user2.out
    APPGEN build/httpd.user1.bin
    -692178031
    692178030
    ** user1.bin uses 318644 bytes of available
    APPGEN build/httpd.user2.bin
    -761873561
    761873560
    ** user1.bin uses 318644 bytes of available
    Header: 40 bytes, user1: 318644 bytes, user2: 318644 bytes.
    

  • Clock LoopClock Loop Posts: 2,069
    edited 2018-12-10 01:49
    Your comple went fine.

    The problem is you are going too fast.
    I didn't say use the make.ota file for anything.
    You compiled the file on the second post if you followed along. Its the OTA file. You should upload it to your WX device asap.
    = result of compile flash files/.OTA update file.
    /home/pi/Parallax-ESP/build/httpd.ota
    
    In this section --> https://forums.parallax.com/discussion/comment/1453063/#Comment_1453063
  • Your right, I am, I missed that, trying to do too many things at once.
    Thanks for your help, I will give it a try.
  • David BetzDavid Betz Posts: 14,511
    edited 2018-12-10 02:23
    Shawna wrote: »
    How can I change the web pages without the ESP SDK? I thought the only place to add web pages was flash folder.
    Yes, that is correct although there is no reason you can't open pages in the /files/ subdirectory for testing purposes. Once you get it working you can send me the html and js files and I can build them into the default image.

  • ShawnaShawna Posts: 508
    edited 2018-12-11 23:17
    @Clock Loop,

    Thank You for helping me figure out how to compile the ESP-Parallax software. The thread that you created is very good! There is a lot of info there, and its a little overwhelming because I am not real familiar with Linux. The tutorial if you will, is written well, and easy to follow if a person just takes their time and reads through it.

    This Thread: https://forums.parallax.com/discussion/169250/parallaxwx-esp8266-raspberrypi-debian-esp-open-sdk-simpleide-openspin-proploader-devel/p1


    I ended up using the password protection from this site that you posted earlier.

    https://maxlaumeister.com/clientside-html-password/

    I used the maxlaumeister site to password protect all of the settings pages on the WX. The password protection uses two .js files to work. I copied the two .js files used for the protection to the WX. I also modified the html code generated so that the password protection will work locally without internet connection.

    This portion of generated code.
    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/pbkdf2.js"></script>
    

    I changed to something like this.
    <script src="WhereYouPutThem/aes.js"></script>
        <script src="WhereYouPutThem/pbkdf2.js"></script>
    

    I don't know how secure it is, but its good enough for what I am doing.

    I also think that tunneling between two routers is an interesting idea, I will have to do some more reading on that.

    @David Betz,

    As far as I can gather you are largely responsible for putting together the software for the WX module. The module adds a lot of possibilities to the Prop.

    Thank You

    As far as contributing to password protection, I wish I could help more, but I honestly am not very good with html or javascript. I can look at code that someone else has put together and muddle my way through it, but putting something together that is made for distribution is way out of my league.


    With the tutorial thread by Clock Loop, and the Maxlaumeister Password Generator, its not real hard to add the password protection to the WX module.

    Not sure what my next quest will be, I may try to find the port 80 configuration and try changing it.
    How hard would it be to add port configuration to the wifi.html page?


  • @Shawna

    Thats great that you got the page working, however, you may find that it won't work simply because the processor on the PropellerESP module doesn't know how to decrypt the data.
    This means after you encrypt the html pages, the processor won't be able to read the data in the html file, thus no settings will be changed. If thats how the settings are stored... mabee not.
    Dod you test the encrypted page for all functionality, and that it actually changes the PropellerESP board?
    This tool only encrypts the HTML document itself. If you inline your CSS/JS, or if you convert your images to data uri's, then they will be encrypted too. Otherwise they will just be linked. 
    Since the HTML itself is encrypted though, a visitor without the password will not be able see the URLs of any of the linked resources.
    

    I need to look it over and see how it works.
    @"David Betz" would know more about how the html config pages store their setting changes.
    Does the html get parsed, or does the setting button "save to flash" do some other form of communication?


    Shawn, you know whats funny about that writeup, I didn't really know any of it when I started it.
    I knew a bit about linux, and the PropellerESP, but not much more.

    I like to have documentation simply so when I do it again, I don't need to look it all back up. heh.
    I am glad it helps! I have used it to reinstall and rebuild an entire linux system back to my desired level of developer tools installed and working.

    QT is a big feat to get working, but once you do, its nice to be able to check out all the different QT open source programs out there...

    Port 80 config is probably in the code somewhere.
    A useful thing is a file search tool that can search the contents of files.
    Then you can search the entire ParallaxESP for keywords like "port" or "80" or "socket"
    With a tool like Recoll https://www.lesbonscomptes.com/recoll/
    My indexing isn't done yet (i have too many gits) so i can't search yet.
  • Clock Loop wrote: »
    @Shawna

    Thats great that you got the page working, however, you may find that it won't work simply because the processor on the PropellerESP module doesn't know how to decrypt the data.
    This means after you encrypt the html pages, the processor won't be able to read the data in the html file, thus no settings will be changed. If thats how the settings are stored... mabee not.
    Dod you test the encrypted page for all functionality, and that it actually changes the PropellerESP board?

    I just used the encrypted update-ffs.html page to upload a html file to flash and it worked fine. I am pretty sure that I performed an ota last night with the encrypted firmware upgrade page also. I just switched the module from sta mode to sta+ap mode with the encrypted wifi.html page. It seems to be working fine.

    I think this works because............
    1) The html pages are encrypted before they are loaded "stored" on the server.
    2) When the web browser "client" requests the page the script in the html forces a password request. That part of the html file is not encrypted.
    3) If the password is correct I believe the client actually de-crypts everything using the two .js keys.
    4) I don't think anything is encrypted headed back to the server "PropellerESP board". The PropellerESP board has no idea anything was ever encrypted.

    This is how I think it works, I really don,t know.

    If this is the case, then I think its a fairly good way of keeping a randow out of your server. If someone was watching the traffic between the client and the server they would probably be able to see the password. For my use that scenario does not bother me.

    Clock Loop wrote: »
    @Shawna
    Port 80 config is probably in the code somewhere.
    A useful thing is a file search tool that can search the contents of files.
    Then you can search the entire ParallaxESP for keywords like "port" or "80" or "socket"
    With a tool like Recoll https://www.lesbonscomptes.com/recoll/
    My indexing isn't done yet (i have too many gits) so i can't search yet.

    I guess I didn't know they made a program like this, I am definitely going to have to check it out. It would definitely speed up my search, because I don't know where to look for the setting.


    Shawn

  • Shawna wrote: »
    The PropellerESP board has no idea anything was ever encrypted.
    Yes, that is correct. The WX firmware knows nothing about HTML or JavaScript. It just serves the files and it is the browser interpreter that interprets them.
Sign In or Register to comment.