moloch-- / sliver-py

A Python gRPC Client Library for Sliver
GNU General Public License v3.0
62 stars 13 forks source link

Error querying beacon tasks #4

Closed thespicybyte closed 1 year ago

thespicybyte commented 2 years ago

While working on a work around for issue #3, I found another issue relating to querying a beacons tasks. My idea was to get all active beacons using SliverClient.beacons(), iterate through each one and query for it's tasks using SliverClient.beacon_tasks(). Code:

async def main():
    client = await login(CONFIG_PATH)
    beacons = await client.beacons()

    for beacon in beacons:
        tasks = await client.beacon_tasks(beacon.ID)

        if len(tasks) == 0:
            interactive_beacon = await client.interact_beacon(beacon.ID)
            print("tasking: %s" % beacon.ID)
            await interactive_beacon.pwd()

Stacktrace:

Traceback (most recent call last):
  File "/share/tmp/silverpy/sliverHandler.py", line 159, in <module>
    asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/share/tmp/silverpy/sliverHandler.py", line 105, in main
    tasks = await client.beacon_tasks(beacon.ID)
  File "/usr/local/lib/python3.9/dist-packages/sliver/client.py", line 279, in beacon_tasks
    beacon = self.Beacon()
AttributeError: 'SliverClient' object has no attribute 'Beacon'

When I opened up the library I saw a few methods that have similar unresolved errors including beacon_task_content, rm_beacon, update_session, and kill_session.

Trying to work around that error, I saw InteractiveBeacon.beacon_tasks in the docs so I tried to use that. The downside to that was it doesn't seem to query previous tasks ran against that beacon but only tasks that that InteractiveBeacon object kicked off. Is that by design or a bug?

daddycocoaman commented 1 year ago

@thespicybyte Is this issue still valid? Looks like the version you're using has gotten updates since and the Beacon objects are returned. Looks like #3 might still be a problem though so I'll looking through that.

daddycocoaman commented 1 year ago

Fixed in v0.0.18.