vortex-5 / ddwrt-bwmon

An Individual Bandwidth Monitor For DD-WRT
171 stars 37 forks source link

README.MD: Use CURL instead of WGET for successful HTTPS transfers on router #58

Closed DarryDoo closed 5 years ago

DarryDoo commented 6 years ago

Hopefully I'm not wasting your time with something "everybody knows".

darren@HP-EliteBook-8470p ~ $ telnet router
Trying 192.168.3.1...
Connected to router.
Escape character is '^]'.

DD-WRT v3.0-r33006 giga (c) 2017 NewMedia-NET GmbH
Release: 08/03/17

router login: root
Password: 
==========================================================

     ___  ___     _      _____  ______       ____  ___ 
    / _ \/ _ \___| | /| / / _ \/_  __/ _  __|_  / / _ \
   / // / // /___/ |/ |/ / , _/ / /   | |/ //_ <_/ // /
  /____/____/    |__/|__/_/|_| /_/    |___/____(_)___/ 

                       DD-WRT v3.0
                   http://www.dd-wrt.com

==========================================================

BusyBox v1.27.1 (2017-08-03 11:53:08 CEST) built-in shell (ash)

; let's download the URL in the README.MD:
root@router:/jffs# wget https://github.com/vortex-5/ddwrt-bwmon/releases/download/1.10/bwmon.tar.gz
wget: not an http or ftp url: https://github.com/vortex-5/ddwrt-bwmon/releases/download/1.10/bwmon.tar.gz

; ok, let's try this: 
root@router:/jffs# wget http://github.com/vortex-5/ddwrt-bwmon/releases/download/1.10/bwmon.tar.gz
Connecting to github.com (192.30.253.112:80)
wget: not an http or ftp url: https://github.com/vortex-5/ddwrt-bwmon/releases/download/1.10/bwmon.tar.gz
; wget follows redirects ok, but still can't handle HTTPS.

; all right, let's see if there's a workaround:
root@router:/jffs# curl -kLO https://github.com/vortex-5/ddwrt-bwmon/releases/download/1.10/bwmon.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   602    0   602    0     0   1925      0 --:--:-- --:--:-- --:--:--  1941
100   99k  100   99k    0     0  87559      0  0:00:01  0:00:01 --:--:--  194k

root@router:/jffs# ls -l
-rw-r--r--    1 root     root        102162 Apr 23 13:58 bwmon.tar.gz
-rw-r--r--    1 root     root           409 Apr 23 13:11 dnsmasq.leases
drwxr-xr-x    3 root     root             0 Apr 23 12:50 tmp
root@router:/jffs# 
; I like success.

For the uninformed (eg. me prior to playing with this), curl switches -k: ignore certificate errors, -L: follow redirects, and -O: auto-name locally-created file.

SOLUTION: wget changes to curl -kLO. Easy peasy.

vortex-5 commented 6 years ago

strange wget works for me wget is also more universally understood as the "right" tool for file transfers curl to my understanding is for making requests and processing results.

both are capable of file transfers but wget seems more specifically designed to handle it.

perhaps different routers have a wget with https or not?

vortex-5 commented 6 years ago

I'll look into this when I get home.

starck22 commented 5 years ago

I tried using Curl, enabling a ton of stuff on DD WRT and I cannot get this to download at all as it says it is read only file system.

Any suggestions? I'm desperately trying to get this BWMON to work on my router (R6700) but I am basically just trying to follow guides (I had to look up how to SSH....) - any guidance would be amazing y'all.

vortex-5 commented 5 years ago

in linux parts of the file system maybe mounted as read only.

If it says your file system is read only then the path you are currently on is set to read only.

Parts of the DDWRT file system maybe read only depending on how you configured the mount points in the GUI under services USB storage. Default storage location is in /tmp/mnt I believe but this isn't a good long term location so in the readme you're recommended to set a mount point in the gui to /jffs/ if you don't set this the original /jffs/ folder will be read only most likely.

gwescot commented 5 years ago

I have a TP-Link Archer C8 router. Using Putty SSH to download the bwmon.tar.gz routine from the github.com site via the WGET command I get a message that the GitHub site is not HTTP (WGET only accesses HTTP and FTP sites). I get 'not found' when I use the CURL command. I formatted a USB drive to ext4 but Windows doesn't recognize the format so I can't copy downloaded files to it so I can put the USB drive in the router. Please advise. Thanks

vortex-5 commented 5 years ago

You can also format your USB drive to NTFS if you are on windows.

gwescot commented 5 years ago

That worked. Thanks

DarryDoo commented 5 years ago

I recently discovered the reason why https does not work in wget out of the box. The problem is actually an SSL configuration issue.

I found that this script solves the problem nicely.

https://oct8l.gitlab.io/posts/2018/94/allow-ssl-in-wget-openwrt/

Cheers Darren