This repository has been archived by the owner on Oct 29, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85a1280
commit de0fc52
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |