Skip to content

[BUG] python 3.6 doesnt like import Queue in event.py #288

@chrisnewmanuk

Description

@chrisnewmanuk

** Prep **
pip3 install cbapi

Describe the bug
As per screenshot.

Steps to Reproduce
(cribbed from https://github.com/carbonblack/cbapi-python/blob/master/examples/response/event/get_reg_autoruns.py)

from cbapi.event import on_event, registry
from cbapi.example_helpers import get_cb_response_object, build_cli_parser
import re
from cbapi.response import sensor_events, event
import sys
import time

class DirectoryList(object):
def init(self, directory):
self.directory = directory

def run(self, session):
    result = None
    try:
        result = session.list_directory(self.directory)
    except:
        result = "could not get dir list"
    return result

def main():

parser.add_argument("-H", "--hostname", help="Hostname to download from", required=True)
args = parser.parse_args()
cb = get_cb_response_object(args)
sensors = cb.select(Sensor).where("hostname:{0}".format(args.hostname))
for sensor in sensors:
    job = DirectoryList("c:\\")
    x = cb.live_response.submit_job(job.run, sensor.sensor_id)

Expected behavior
Events can be queued via submit_job() without errors

Screenshots
image

Additional context
Tried to fix Queue to queue trick but that didnt work and resulted in:
image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions