moloch-- / sliver-py

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

Armory and extensions #27

Open daddycocoaman opened 1 year ago

daddycocoaman commented 1 year ago

Before handling #21, it makes sense to implement an Armory client so users can get the extensions or aliases they want to register or call. The armory isn't exposed via gRPC so a separate async client is needed to get the data.

666Danger-sudo commented 1 year ago

Isn't there any way to execute commands on the beacon without passing by the wrapper functions? For example:

beacons = await client.beacons() interact = await client.interact_beacon(beacons[0].ID) task = interact.console_execute([COMMAND TO EXECUTE ON CONSOLE] //not existing fuction

This library has unfortunately a lot of limitations. @moloch-- , can we implement this future so it will be more easier than writing wrappers around extensions that can change overtime? It can also be easier for maintaining the code up to date to the newest version of sliver so you don't have to implement command wrappers.

daddycocoaman commented 1 year ago

@666Danger-sudo Since communications with Sliver is over gRPC via protobuf, everything is eventually going to be some wrapper function.

Fortunately, the code generation for the gRPC functions has gotten a little easier to deal with. But the reality is that whenever Sliver gets changes to the .proto files, the underlying code here needs to be regenerated and the wrapper functions will need to pass the written tests. But with your example, interact.execute() does exist.

If you mean this in terms of the Armory, the reason for a separate client is because Sliver does not use gRPC to handle Armory commands. So, in order for SliverPy to know what extensions exist, and for users to be able to download extensions, it has to be written separately.

666Danger-sudo commented 1 year ago

I was trying .execute(), can you tell me whats the issue here? for beacon in beacons: beacon = sliver.InteractiveBeacon(beacon, CLIENT._channel) task = await beacon.execute("ls","") while True: if task.done(): print(await task.result()) break My computer goes in an infinite loop and never stops even the beacon checks in. Another thing is that this will probably be ok for execute os commands on the beacon directly, but will it work if I try to execute extensions?