Is it possible to use wget or curl on Gargoyle interface?

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

I am wondering is it possible to use curl or wget to login to Gargoyle? I have found some info on using them to login to a form based login screen, but Gargoyle appears to be a javascript login screen.
I had the idea of trying to grab the WAN up time and displaying it on my own page or maybe grabbing the wan ip address, in a what's my ip type page

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by Lantis »

This would be much simpler just using SSH.
If you want to use a web call, make a POST call to

Code: Select all

http://192.168.1.1/utility/get_password_cookie.sh
With the password as a parameter.
Once you have a valid login cookie from that, you should then be able to GET call most other pages and pass the cookie for authentication.

The gargoyle_session_validator source is here:
https://github.com/ericpaulbishop/gargo ... alidator.c
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

Thanks for that. I think I managed to get a cookie, but can't seem to get it to show me a logged in page like the status overview page. You are right, seems way harder than I had hoped.

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by Lantis »

Code: Select all

curl --data "password=myrootpassword" http://192.168.1.1/utility/get_password_cookie.sh
Returns

Code: Select all

Set-Cookie:hash=C4A26xxxxx53C; Path=/;
Set-Cookie:exp=1617017263; Path=/;
Then

Code: Select all

curl --cookie "hash=C4A26xxxxx53C;exp=1617017263;" http://192.168.1.1/overview.sh
Returns the overview page.

Hope that example helps
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

Thank you very much. With your help I have been able to get what looks like the logged in overview page. But for some reason none of the values are there, here is a snippet of what I saved to a html file.

Code: Select all

Status
Device

    Device Name:
    Gargoyle Version:
    Model:
    Device Configuration:
    Memory Usage:
    Swap Memory Usage:
    Connections:
    CPU Load Averages: (1/5/15 minutes)
    CPU Temperature: °C
    RAM Temperature: °C
    Wifi Temperature: °C

WAN

    WAN IP Address:
    WAN Netmask:
    WAN MAC Address:
    WAN Gateway IP:
    WAN DNS Server(s):
    WAN (PPPoE) Uptime:
    WAN (3G) Signal Strength:

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by Lantis »

Yes, that would be the second part of why SSH would be better and just using something like ifstatus to get the data (depending on what you're looking for).

Gargoyle's GUI uses javascript to load the variables into the UI, which reduces the burden on the router to produce the entire content of the page. Earlier in the page you will see a bunch of lines that begin with "uci.set(...)". This is data coming out of the config files and ready to be loaded into the UI by the code.
There's no particularly good way of doing that with just a cURL call.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

I did see the uci.set stuff in the browser when viewing the source, but it seems curl ignores everything in the <script></script>, because none if it appears in the html file when I capture it.
I will have a look and see if I can work out how to do it with ssh, Can that be done in a batch file?
Edit: I was mistaken the html file I capture does contain the values in javascript variables so might still be able to extract what I want.

Lantis
Moderator
Posts: 6735
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by Lantis »

If you can get a batch file to connect to an ssh server i don't see why not. I have no experience in doing so.

If you let me know what information you're looking to retrieve i can try and advise the simplest commands that give that info.
http://lantisproject.com/downloads/gargoyle_ispyisail.php for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

I am basically after the uptime and the wan IP

rockyd
Posts: 49
Joined: Tue Oct 22, 2019 5:49 am

Re: Is it possible to use wget or curl on Gargoyle interface?

Post by rockyd »

I have been able to extract the uptime from the captured file.

Post Reply