Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting result in python using sendAndReceive or other methods #456

Open
hitabi opened this issue Jun 21, 2024 · 1 comment
Open

Getting result in python using sendAndReceive or other methods #456

hitabi opened this issue Jun 21, 2024 · 1 comment
Labels

Comments

@hitabi
Copy link

hitabi commented Jun 21, 2024

I am trying to give a run command and get the response programatically in a python script.

I see that Session class has sendAndReceive method session.py#L591 which takes in a Message object. There is also Reflector class's sendAndReceive method reflector.py#L100 which takes in either a Factory such as ReflectionRequestFactory or a Message object. There is no document on it so my guess is that we have to add commands as arguments. Before I dump all my code I want to know if this is the only way or there some one-liner code that I overlooked.

command = 'run app.package.list'
args = Message.Argument(type=Message.Argument.STRING, string=command)
fac = ReflectionRequestFactory(Message.ReflectionRequest.INVOKE).setArguments([args])
res = self.session.reflector.sendAndReceive(fac)
print(res)

Gives error AttributeError: _pb on reflection_request.py:118
request.argument.add().MergeFrom(argument._pb())

@cyberMilosz
Copy link
Contributor

Hey! Full disclosure: it'll take us a while to get back to you on this.

Long story short - there isn't currently an easy/documented way of interacting with drozer programmatically. I agree there should be, and I'll add it to my list.

The methods you identified are used for sending drozer protocol commands between the console and agent - not really relevant to what you're trying to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants