• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 942
  • Last Modified:

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.id=******&User.password=*******" \
    -O - \
    https://webmail/gw/webaccess \
    > /dev/null
 
 
 
curl \
    -k \
    --cookie-jar ~/webmailcookie \
    --data "User.id=****&User.password=*******" \
    https://webmail/gw/webaccess \
    > /dev/null

Open in new window

0
TheFlyingCorpse
Asked:
TheFlyingCorpse
  • 2
1 Solution
 
saurabhpendharkerCommented:
Hello,

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;
 
$user='<USERNAME>';
$pass=`<PASSWORD>`;
 
$url = 'https://<WEB ADDRESS>';
 
$m = WWW::Mechanize->new();

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

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

0
 
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!
0
 
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!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now