Xymon Mailing List Archive search

netrc not working

3 messages in this thread

list Kris Springer · Thu, 21 May 2020 17:28:26 -0600 ·
Hi all.? I'm trying to get xymon to log into a device we have and check for a keyword on a certain page.? I know how to check a site for keyword using 'cont', but the device requires a login and I can't seem to get it to work.? It's just an http device, but the http://username:user-61b8273d29b7@xymon.invalid doesn't work, and neither does the 'netrc' file that I found in an old blog post.? Anyone know how to get this to work?

-- 
Kris Springer
list Ralph Mitchell · Fri, 22 May 2020 01:27:29 -0400 ·
You may need to write a script to handle the check, especially if it does
anything tricky with Javascript or JSON.

Start with the login page:

    curl -s -S -L -b cookies -c cookies -o login_page.html -v
http://thing.mydomain.com

The -v option gets you the headers that go back and forth, in case that's
useful.  Read through the login_page.html and see what's in the login form,
and if it's just a simple POST.  Look for hidden fields to send back,

    curl -s -S -L -b cookies -c cookies -o page.html -d userid=xxxx -d
passwd=xxxx -v http://thing.mydomain.com

that's assuming the variable names in the INPUT fields are "userid" and
"passwd".  Then see what page.html contains.  Lather, rinse, repeat, until
you get to the page you're interested in.

If it *does* do anything tricky with Javascript, JSON, or anything else,
you may never be able to do it in shell scripts.  You might be able to get
something done in python or another language.

Ralph Mitchell


On Thu, May 21, 2020 at 7:28 PM Kris Springer <user-c2caa0a7a8d5@xymon.invalid>
quoted from Kris Springer
wrote:
Hi all.  I'm trying to get xymon to log into a device we have and check
for a keyword on a certain page.  I know how to check a site for keyword
using 'cont', but the device requires a login and I can't seem to get it
to work.  It's just an http device, but the
http://username:user-61b8273d29b7@xymon.invalid doesn't work, and neither does the
'netrc' file that I found in an old blog post.  Anyone know how to get
this to work?

--
Kris Springer

list Jeremy · Fri, 22 May 2020 08:21:34 +0000 ·
I think that permissions on the .netrc file are important.  Needs to be 600 and owned by the user running Xymon.

HTH
quoted from Ralph Mitchell

------ Original Message ------
From: "Ralph M" <user-00a5e44c48c0@xymon.invalid>
To: "Kris Springer" <user-c2caa0a7a8d5@xymon.invalid>
Cc: "Xymon MailingList" <xymon at xymon.com>
Sent: 22/05/2020 06:27:29
Subject: Re: [Xymon] netrc not working
You may need to write a script to handle the check, especially if it does anything tricky with Javascript or JSON.

Start with the login page:

    curl -s -S -L -b cookies -c cookies -o login_page.html -v http://thing.mydomain.com

The -v option gets you the headers that go back and forth, in case that's useful.  Read through the login_page.html and see what's in the login form, and if it's just a simple POST.  Look for hidden fields to send back,

    curl -s -S -L -b cookies -c cookies -o page.html -d userid=xxxx -d passwd=xxxx -v http://thing.mydomain.com

that's assuming the variable names in the INPUT fields are "userid" and "passwd".  Then see what page.html contains.  Lather, rinse, repeat, until you get to the page you're interested in.

If it *does* do anything tricky with Javascript, JSON, or anything else, you may never be able to do it in shell scripts.  You might be able to get something done in python or another language.

Ralph Mitchell


On Thu, May 21, 2020 at 7:28 PM Kris Springer <user-c2caa0a7a8d5@xymon.invalid> wrote:
Hi all.  I'm trying to get xymon to log into a device we have and check
for a keyword on a certain page.  I know how to check a site for keyword
using 'cont', but the device requires a login and I can't seem to get it
to work.  It's just an http device, but the
http://username:user-61b8273d29b7@xymon.invalid doesn't work, and neither does the
'netrc' file that I found in an old blog post.  Anyone know how to get
this to work?

--
Kris Springer

-- 

This email has been checked for viruses by AVG.
https://www.avg.com