Page 1 of 1

Automatic reporting of installed software (e.g., via email)

Published: October 6, 2016 - 9:18 AM
by Remi Pinck
Hello,

we have been using Wapt with satisfaction for some time now.
Currently, users do not have the admin password to install new programs except in certain special cases (developers, etc.).
For these "special cases," we would like to have an automatic report of new software installed during the day so that we can remove pirated software as quickly as possible.
Is there a way to do this with Wapt?

Thank you and have a good day

, Rémi Pinck

Re: Automatic reporting of installed software (e.g., by email)

Published: October 7, 2016 - 3:32 PM
by sfonteneau
Remi Pinck wrote:Hello,

we have been using Wapt with satisfaction for some time now.
Currently, users do not have the admin password to install new programs except in certain special cases (developers, etc.).
For these "special cases," we would like to have an automatic report of new software installed during the day so that we can remove pirated software as quickly as possible.


Is there a way to do this with Wapt?

One could easily imagine a package that installs itself every time the machine shuts down

computer shutdown script:

Code: Select all

 wapt-get install -f tis-scanpackage 


And this program scans the software list each time; if the software list has changed since the last scan, the package sends the name of the affected software via email with blat

So yes, it's possible

Re: Automatic reporting of installed software (e.g., by email)

Published: October 7, 2016 - 4:37 PM
by htouvet
Here's a small example script to put in c;\wapt\softaudit.py that does the job...

Then, in a command prompt, run `waptpython c:\wapt\softaudit.py --days=5`

Code: Select all

import sys,os
from common import *
from getpass import getpass
from optparse import OptionParser

def compact_date(adatetime=None):
    if adatetime is None:
        adatetime = datetime.datetime.today()
    return adatetime.strftime('%Y%m%d')

if __name__ == '__main__':
    parser=OptionParser(usage="Sample script which check softwares installed recently on wapt registred computers")
    parser.add_option("-c","--config", dest="config", default=os.path.join(os.path.dirname(sys.argv[0]),'wapt-get.ini') , help="Config file full path (default: %default)")
    parser.add_option("-d","--days", dest="days", default=1, type='int', help="Days back to look at (default: %default)")
    (options,args) = parser.parse_args()

    server_password = getpass('Please input wapt server admin password:')

    # initialise wapt api with local config file
    wapt = Wapt(config_filename = options.config)
    wapt.dbpath=':memory:'

    # get the collection of *all* hosts from waptserver inventory
    hosts =  wapt.waptserver.get('api/v1/hosts?columns=uuid,host.computer_fqdn',auth=('admin',server_password))

    print(u'Logiciels installés depuis %s jours sur les %s machines de wapt:\n'%(options.days,len(hosts['result'])))
    for h in hosts['result']:
        try:
            uuid = h['uuid']

            hostname = h['host']['computer_fqdn']
            ip = ','.join(h['host']['connected_ips'])
            description = h['host']['description']

            softs = wapt.waptserver.get('api/v1/host_data?uuid=%s&field=softwares'%(uuid,),auth=('admin',server_password)).get('result',[])
            datemin = compact_date(datetime.datetime.now()-datetime.timedelta(days=options.days)) # forme YYYYMMDD 20161007
            recent_installs = [s['name'] for s in softs if s['install_date'] >= datemin]
            if recent_installs:
                print "%s (%s)  %s:\n    %s\n" %(hostname,ip,description,'\n    '.join(recent_installs))
        except Exception as e:
            print " error %s" % e

Re: Automatic reporting of installed software (e.g., by email)

Published: October 10, 2016 - 10:22 AM
by Floflobel
Hello,

it's very difficult to put the WAPT admin password in plain text. Someone with even a little technical knowledge could easily guess it.
Isn't there another solution?

Sincerely,

Re: Automatic reporting of installed software (e.g., by email)

Published: October 13, 2016 - 10:34 AM
by Remi Pinck
Hello,

thank you for the script suggestion (I will forward it to the admin who manages the project).
Indeed, the password issue still needs to be resolved.

Have a good day,

Rémi.