Skip to content

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

Open

Description

@remysabliet

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

Activity

  1. 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)? [/+] on Mar 2, 2023
  2. remysabliet commented on Mar 3, 2023

    @remysabliet
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions