forked from Hay1tsme/artemis
ADB: update touch
This commit is contained in:
parent
2c40343d9f
commit
e9368b2e57
@ -1,2 +1,3 @@
|
||||
from .base import ADBBaseRequest, ADBBaseResponse, ADBHeader, ADBHeaderException
|
||||
from .lookup import ADBLookupRequest, ADBLookupResponse
|
||||
from .touch import ADBTouchRequest, ADBTouchResponse
|
||||
|
@ -1,8 +1,7 @@
|
||||
from construct import Struct, AlignedStruct, Int32sl, Int16ul, Padding
|
||||
from construct import Struct, Int32sl, Padding
|
||||
|
||||
from .base import *
|
||||
|
||||
|
||||
class ADBLookupRequest(ADBBaseRequest):
|
||||
def __init__(self, data: bytes) -> None:
|
||||
super().__init__(data)
|
||||
|
28
core/adb_handlers/touch.py
Normal file
28
core/adb_handlers/touch.py
Normal file
@ -0,0 +1,28 @@
|
||||
from construct import Struct, Int16ul, Padding
|
||||
|
||||
from .base import *
|
||||
|
||||
class ADBTouchRequest(ADBBaseRequest):
|
||||
def __init__(self, data: bytes) -> None:
|
||||
super().__init__(data)
|
||||
self.access_code = data[0x20:0x2A].hex()
|
||||
|
||||
class ADBTouchResponse(ADBBaseResponse):
|
||||
def __init__(self, code: int = 0, length: int = 10, status: int = 1) -> None:
|
||||
super().__init__(code, length, status)
|
||||
self.unk1 = 0x006F
|
||||
self.unk2 = 0x0001
|
||||
|
||||
def make(self):
|
||||
header = super().make()
|
||||
resp_struct = Struct(
|
||||
Padding(0x05),
|
||||
"unk1" / Int16ul,
|
||||
Padding(2),
|
||||
"unk2" / Int16ul,
|
||||
)
|
||||
|
||||
return header + resp_struct.build(dict(
|
||||
unk1 = self.unk1,
|
||||
unk2 = self.unk2
|
||||
))
|
@ -183,15 +183,16 @@ class AimedbProtocol(Protocol):
|
||||
|
||||
return self.append_padding(ret)
|
||||
|
||||
def handle_touch(self, data: bytes, resp_code: int) -> bytes:
|
||||
self.logger.info(f"touch from {self.transport.getPeer().host}")
|
||||
def handle_touch(self, data: bytes, resp_code: int) -> ADBBaseResponse:
|
||||
"""
|
||||
ret = struct.pack(
|
||||
"<5H", 0xA13E, 0x3087, self.AIMEDB_RESPONSE_CODES["touch"], 0x0050, 0x0001
|
||||
)
|
||||
ret += bytes(5)
|
||||
ret += struct.pack("<3H", 0x6F, 0, 1)
|
||||
"""
|
||||
|
||||
return self.append_padding(ret)
|
||||
return ADBTouchResponse(resp_code, 0x0050)
|
||||
|
||||
def handle_register(self, data: bytes, resp_code: int) -> bytes:
|
||||
luid = data[0x20:0x2A].hex()
|
||||
|
Loading…
Reference in New Issue
Block a user