Skip to content
Browse files

Added lce_asset example

  • Loading branch information...
1 parent 85a1280 commit de0fc52fe1a0c72e966808f11ca441bd62a6bbb1 @SteveMcGrath committed
Showing with 35 additions and 0 deletions.
  1. +35 −0 examples/lce_assets/lce_assets.py
View
35 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.
Something went wrong with that request. Please try again.