Command Line Login script to GroupWise WebAccess

I am working on a command line batch script for linux, that is aimed at logging in to a GroupWise WebAccess server.

I want todo this to verify the status of the Agent that reports it being up/ok, while it does not always neccesarily mean just that when its through the WebAccess portion of our mail system.

I've already made a script thats able to DL and check for the proper front page, however, I am unable to log in to WebAccess this way. I've tried using both WGET and CURL to DL the cookies, they still end up blank.
# These are the code snippets I've used while trying to DL the cookie:
wget \
    --no-check-certificate \
    --save-cookies ~/webmailcookie \
    --post-data "******&User.password=*******" \
    -O - \
    https://webmail/gw/webaccess \
    > /dev/null
curl \
    -k \
    --cookie-jar ~/webmailcookie \
    --data "****&User.password=*******" \
    https://webmail/gw/webaccess \
    > /dev/null

Open in new window

Who is Participating?

You may try this:

#!/usr/local/bin/perl -w
#use LWP::Debug qw(+);  (Uncomment this if you want to see more debugging)
use WWW::Mechanize;
use WWW::Mechanize::DecodedContent;
$url = 'https://<WEB ADDRESS>';
$m = WWW::Mechanize->new();

$m->form_name("<FORM NAME>");
$m->set_fields(<Username Text Field Name on webpage> => $user, <PASSWORD TEXT Field Name on Webpage> => $pass);

print $m->content();
This will display the contents once you are logged into the webpage using given credentials.

TheFlyingCorpseAuthor Commented:
haha, this is too good to be true, it works(slight modification to the set fiels, had to enclose the fields with '' to make it understand it correctly.

Thank you a bunch!
TheFlyingCorpseAuthor Commented:
The expert who answered had good knowledge of coding and it was easy to understand his sollution.

The only thing I had todo was install the extra PERL modules, and it was flying away with the solution I asked for!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.