wget https on limited memory

Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware
Author Message
legolas
DD-WRT Novice


Joined: 22 Feb 2017
Posts: 26

PostPosted: Wed Apr 07, 2021 1:09    Post subject: wget https on limited memory Reply with quote
Hello
I need wget, curl or netcat with https support, and the best way to do it is using Entware, as stated here.
My router has 4/32 MB memory, its possible to use Entware entirely on ramfs? It's a tplink wr740n

http://bin.entware.net/mipssf-k3.4/installer/generic.sh has no option for installing on /tmp folder.

Another option is building the curl and libraries and placing them in /tmp, but where can I find a proper guide to it?

Thank you!

_________________
In use, community ISP:
1 tplink WR842ND; 2 WR741N; 3 WR740N : with DD-WRT
1 mymax WR934-BK "original" firmware
1 d-link dsl-2740e with Totolink ND300
2 Sagem F@ST2704 with OpenWrt
1 wavlink ND300
1 wrt54g
waiting:
1 wrt54g
airgrid m5 bullet
Sponsor
ian5142
DD-WRT Guru


Joined: 23 Oct 2013
Posts: 2318
Location: Canada

PostPosted: Wed Apr 07, 2021 2:54    Post subject: End goal Reply with quote
Just out of curiosity, what is your end goal in requiring https?

If it is for Command line upgrading the router, just use the ftp link. Works fine. I use it most times.

_________________
Before asking a question on the forums, update dd-wrt: Where do I download firmware? I suggest reading it all.
QCA Best WiFi Settings


Some dd-wrt wiki pages are up to date, others are not. PM me if you find an old one.

Atheros:
Netgear R7800 x3 - WDS AP / station, gateway, QoS
TP-Link Archer C7 v2 x2 - WDS Station
TP-Link TL-WDR3600 v1 - WDS Station
TP-Link 841nd v8 - NU
D-Link 615 C1/E3/I1 x 7 - 1 WDS station
D-Link 825 B1 - NU
D-Link 862L A1 x2 - WDS Station
Netgear WNDR3700v2 - NU
UBNT loco M2 x2 - airOS

Broadcom
Linksys EA6400 - Gateway, QoS
Asus N66U - AP
Netgear WNDR3700v3 - not used
MediaTek
UBNT EdgeRouter X - switch
legolas
DD-WRT Novice


Joined: 22 Feb 2017
Posts: 26

PostPosted: Wed Apr 07, 2021 10:48    Post subject: Re: End goal Reply with quote
ian5142 wrote:
Just out of curiosity, what is your end goal in requiring https?

If it is for Command line upgrading the router, just use the ftp link. Works fine. I use it most times.


It's to automatically login on a hotspot portal, need to do it every 15 minutes.
Works fine from PC with Linux, but will be better porting it to router.

_________________
In use, community ISP:
1 tplink WR842ND; 2 WR741N; 3 WR740N : with DD-WRT
1 mymax WR934-BK "original" firmware
1 d-link dsl-2740e with Totolink ND300
2 Sagem F@ST2704 with OpenWrt
1 wavlink ND300
1 wrt54g
waiting:
1 wrt54g
airgrid m5 bullet
legolas
DD-WRT Novice


Joined: 22 Feb 2017
Posts: 26

PostPosted: Mon Apr 12, 2021 13:42    Post subject: Reply with quote
Just resolved my issue by compiling wget from openwrt SDK for my router.
You need to use the SDK downloaded for you router, its on Supplementary files section on the page where the router build is listed, in my case for tl-wr740n:
https://downloads.openwrt.org/releases/18.06.2/targets/ar71xx/tiny/

openwrt-sdk-18.06.2-ar71xx-tiny_gcc-7.3.0_musl.Linux-x86_64.tar.xz

The process using SDK is quite straightforward:
Once downloaded and inside the root folder of SDK:
Install dependencies needed for build system and the code for your packages.
And then
Code:
./scripts/feeds install wget #or pkg you want to build

Code:
make package/wget/compile


The .ipk is inside <SDK_root_dir>/bin/packages/mips_24kc/packages
Extract them using
Code:
tar zxpvf package.ipk


Inside data.tar.gz you can find the binary for the program.

Just place it on the ./tmp folder of the router, chmod and execute it.
If it has dependencies, they will appear
Code:
Error loading shared library libpcre.so.1: No such file or directory (needed by /tmp/wget-ssl)
Error loading shared library libssl.so.1.0.0: No such file or directory (needed by /tmp/wget-ssl)
Error loading shared library libcrypto.so.1.0.0: No such file or directory (needed by /tmp/wget-ssl)
Error loading shared library libz.so.1: No such file or directory (needed by /tmp/wget-ssl)

So extract the libs and links listed above from the same folder you extracted the binary and place it on router in a lib folder on tmp.
Modify LD_LIBRARY_PATH to add that folder:
Code:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/lib

Here you are done.
If needed, download ca certificates to /tmp and use them with parameter --certificate=FILE or just --no-check-certificate .
Need to do the setup after every boot, you can use a startup script, this one is suitable for wr740n router:
Code:
#!/bin/sh

WGETHOST=www.zippyshare.com
WGETURL=http://www70.zippyshare.com/d/hUonwDph/45924/wget-ssl.bin
LIBS=http://www34.zippyshare.com/d/y0c2TZBN/38573/lib.tar

export PATH=$PATH:/tmp
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/tmp/lib

setup_wget()
{
    while sleep 30
    do
        ping -w1 $WGETHOST || continue
        wget $WGETURL -O /tmp/wget-ssl
        wget $LIBS -O /tmp/lib.tar
       
        if [[ "a5176df15a3f60327ee61a0ad00dbac1" != $(md5sum /tmp/wget-ssl | awk '{ print $1 }') ]]
        then
            continue
        fi
       
        tar -xvf /tmp/lib.tar

        rm -r /tmp/lib.tar
        chmod +x /tmp/wget-ssl
        wget-ssl -q --spider --no-check-certificate $WGETHOST && break # complete setup
       
        # error, cleanup and try again
        rm -r /tmp/wget-ssl
        rm -r /tmp/lib
       
    done
}

setup_wget

exit 0

_________________
In use, community ISP:
1 tplink WR842ND; 2 WR741N; 3 WR740N : with DD-WRT
1 mymax WR934-BK "original" firmware
1 d-link dsl-2740e with Totolink ND300
2 Sagem F@ST2704 with OpenWrt
1 wavlink ND300
1 wrt54g
waiting:
1 wrt54g
airgrid m5 bullet
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Atheros WiSOC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum