Last active
August 29, 2015 14:18
-
-
Save jgarman/69834eaf0f681f539b6a to your computer and use it in GitHub Desktop.
Example CbApi code with boilerplate
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
import cbapi | |
# Connect to the Cb server on cbserver.local. | |
cb = cbapi.CbApi("https://cbserver.local.", token="API_TOKEN", ssl_verify=False) | |
while True: | |
# find all executions of a process named "svchost.exe" not in a Windows System directory | |
procs = cb.process_search('process_name:svchost.exe -path:c:\\windows\\system32\\svchost.exe -path:c:\\windows\\syswow64\\svchost.exe', start=start) | |
if len(procs["results"]) == 0: | |
break | |
for result in procs["results"]: | |
proc_detail = cb.process_events(result['id'], result['segment_id']) | |
print proc_detail['process']['start'], proc_detail['process']['hostname'], proc_detail['process']['path'] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment