Skip to content
This repository has been archived by the owner on Oct 29, 2018. It is now read-only.

Commit

Permalink
Added lce_asset example
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMcGrath committed May 8, 2012
1 parent 85a1280 commit de0fc52
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions examples/lce_assets/lce_assets.py
@@ -0,0 +1,35 @@
#!/usr/bin/env python
import securitycenter
import time

# NOTE: all time is based on Unix time. 86400 is 1 day in seconds.

update_list = [{
'asset_id': 28,
'filters': {
'sensor': 'HomeNet_Snort',
'endtime': int(time.time()),
'starttime': (int(time.time()) - 86400),
},
},{
'asset_id': 29,
'filters': {
'type': 'nbs',
'endtime': int(time.time()),
'starttime': (int(time.time()) - 86400),
},
},
]

host = 'HOST'
username = 'api_user'
password = 's3cr3tp@ssw0rd'

sc = securitycenter.SecurityCenter(host, username, password)

for update in update_list:
events = sc.query('sumip', source='lce', **update['filters'])
ips = []
for event in events:
ips.append(event['address'])
sc.asset_update(update['asset_id'], ips=ips)

0 comments on commit de0fc52

Please sign in to comment.