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

How to send a command to the agent via socket (Forwarded port as described in the README)? #105

Open
remysabliet opened this issue Mar 1, 2023 · 1 comment

Comments

@remysabliet
Copy link

remysabliet commented Mar 1, 2023

Hello team,

I am trying to run STFService.apk separatly from STF to troubleshoot a permission issue with Minitouch on a XIG02 device. Issues that occured from Android 10 (weirdly only this model as the issue)

As explained In the readme, I ran first the service and then the agent.

For the Service, the command was not working as it is, I had to specify it is a foreground service.
adb shell am start-foreground-service --user 0 -a jp.co.cyberagent.stf.ACTION_START -n jp.co.cyberagent.stf/.Service

Then I started the agent as described in the README to forward the port 1090:
adb forward tcp:1090 localabstract:stfagent

then connecting to it
nc localhost 1090

But now under which format am I supposed to send one of the 4 commands listed below to the device?

  • DO_KEYEVENT
  • DO_TYPE
  • DO_WAKE
  • SET_ROTATION

If for example i write "DO_WAKE" to the socket 1090, the agent will print out a Proto Wire error and close my socket.

Forward to Socket 1090
Screenshot 2023-03-02 at 9 01 58

Agent CLI Output:
Screenshot 2023-03-02 at 9 01 43

Could someone have a clue of how those Proto message are structured and could be sent via socket 1090 ?

Stf when executing the same command with protobuff encode the message to a Node Buffer.. Binaries.
So i wonder if this agent has really be intented to receive STRING command like described in the README.

Thanks in advance

@remysabliet remysabliet changed the title How to send a command to the agent via socket ? How to send a command to the agent via socket (Forwarded port as described in the README)? Mar 2, 2023
@remysabliet
Copy link
Author

remysabliet commented Mar 3, 2023

For the XIG02 (Xiaomi) permission issue on mouse event and type event, I found the way to fix it by enabling USB Debugging (Security Settings). A SimCard is required to enabled this setting.

I was having the error poping up in device logcat InputManager: Permission denial: InjectInputEvent()

My question about how to send command to APK agent is still valid though.

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

No branches or pull requests

1 participant