The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Qualys - connect to the Qualys scanner API with perl

SYNOPSIS

  use Qualys;
  
  $q = new Qualys;
  
  $q->userid($username);
  $q->passwd($password);
  
  $q->ip('{ip1,ip2}');
  $q->iscanner_name('my_qualys_scanner');
  #.... and so on
  
  #or set multiple attributes
  $q->attribs({
  save_report => 'yes',
  specific_vuln => $number
  #.. any other attributes you'd like
  });
  
  $script = 'scan.php';
  $xml_data = $q->connect_to($script); #scanning takes a while

  #now just process the XML data in $xml_data as you wish
  #maybe use XML::Twig

Again, see the http://www.qualys.com/docs/QualysGuard_API_User_Guide.pdf for all the other functions and attributes that you can use.

DESCRIPTION

This module is a wrapper for connecting and using the QualysGuard API for all Qualys partners. It will take care of authentication and creating the correct uri based on the options provided and the selected API script.

Using the Qualys (specifically QualysGuard) API one can integrate QualysGuard into individual appplications using perl. The QualysGuard partners can access security auditing, network discovery, preferences, remediation ticket updates, and user enrollment functions using this interface.

METHODS

The Qualys module inherits the LWP::UserAgent module in order to provide a specific authentication function for get_basic_credentials(). Most likely, you are using this module because you own some Qualys scanners. Therefore, please go through all the Qualys documentation, specifically http://www.qualys.com/docs/QualysGuard_API_User_Guide.pdf.

userid($username)

Sets the username to use when authenticating to the QualysGuard API.

passwd($password)

Sets the password to use when authenticating to the QualysGuard API.

server($host)

Sets the Qualys API host. The default value is qualysapi.qualys.com and it should probably be this unless it is changed in a future release.

api_path($https_path)

Sets the URI to the API. Please note a url should be given with the https. This is to ensure that if the URL ever changes in the future, this module is still adaptable. The default path is set to: https://qualysapi.qualys.com/msp/.

attribs($hashref)

Sets the attributes that will be given to the API script. Example,

 $q_api->attribs({
  iscanner_name => 'qualys_scanner_name',
  save_report => 'yes',
  ref => '{referenceCode}',
  domain => 'mycompany.com:192.168.0.1-192.168.0.25',
  ... whatever your heart desires ...

 });
 
clear_attribs()

Clears all the attributes saved so far using set_attribs().

connect_to($script)

Connects to the API and executes the specific script name (usually a php script) with the given attributes (see set_attrib()) and returns the xml response from the server. Depending on the script executed, this can take from seconds to minutes.

ADVANCED PROGRAMMERS

For some advanced programmers that know what they are doing, I have written a fancy version AUTOLOAD() that automatically creates and sets the corresponding attributes -- this is in order to support all possible attributes. Therefore, you can use any attributes mentioned in the Qualys API documentation, to set the attributes that will be used when you connect to the API script.

 $qapi->asset_groups('ThisIsMyGroup'); #sets asset_groups to ThisIsMyGroup
 $qapi->loadbalancer('no'); #sets loadbalancer attribute to 'no'
 $qapi->ip('{192.168.0.1,192.168.0.2}'); #sets ip attribute to {192.168.0.1,192.168.0.2}
 .. and so on ...
 

I mention this is for advanced users, because doing this is a short cut to using set_attribs() - and therefore watch mispellings.

SEE ALSO

XML::Twig, The Qualys Scanner website: http://www.qualys.com. For all the QualysGuard API information see http://www.qualys.com/docs/QualysGuard_API_User_Guide.pdf

AUTHOR

Anthony G Persaud <apersaud@gmail.com>

COPYRIGHT AND LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.

QualysGuard is a registered trademark of Qualys, Inc. Qualys and the Qualys logo are trademarks of Qualys, Inc. All other trademarks are the property of their respective owners.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 200:

=back doesn't take any parameters, but you said =back 4