输出:
'''
PS D:\Sproto> & C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe d:/Sproto/getfullinfo.py
Unpack: 0100722801000000480000000e0000000200ec0300000400000066d20d000e0000000200ee0300000400000072fe07000e0000000200f003000004000000f02814000e0000000200f20300000400000078fe150000000000
{'type': 5176} 4
Content: 01000000480000000e0000000200ec0300000400000066d20d000e0000000200ee0300000400000072fe07000e0000000200f003000004000000f02814000e0000000200f20300000400000078fe150000000000
notify_alliance_resource_update <capsule object NULL at 0x00000280701EED20> None
set string:map key type not support
set string:sproto c lib error
Traceback (most recent call last):
File "d:/Sproto/getfullinfo.py", line 23, in
print(rainft.S2Cspb.decode(req,content))
File "d:\Sproto\rainft.py", line 44, in decode
return core.sproto_decode(st, chunk)
pysproto.error: sproto c lib error
'''
代码:
'''
from asyncio import sleep
import rainft
rainft.SprotoInitialize()
key = bytes.fromhex("3e8507c9")
raw = bytes.fromhex("1d0172280111480e4d02ec03045c66d20d0e3402ee03710472fe07d10e02f003c404f02845140e0213f203040778fe15")
rainft.SpbRpc.dispatch(raw)
raw = bytes.fromhex("1d011e370111e3df0d14582140011d0cec03cc1101257d17ac1fac1f34c404c2be472b0e06021ffa044c03067d0244055a03047cbee3056a047ceae4056a047ca71f36181c5405cc17741fac1f0c4401045c66dd6d5504054120045c66dd6d2dfc04c2be2b0e3dff04de9f0fdf65160e2a19a60f032b160ef425700fdb161a0e19d4160e1f16160ef7a2180e43ea150e04b848b00704b848b00704783ba21201")
unpacked = bytes.fromhex("01001e3701000000e3000000df000000140058210000000000000000000001000c00ec03cc00000001000000250000001700ac1fac1f3400000004000000c2be2b0e060000000200fa044c0306000000020044055a0304000000bee3056a04000000eae4056a04000000a71f36181c0000000500cc00170000001f00ac1f0c000000010000000400000066dd6d00550000000500000000002000000000000400000066dd6d002d00000004c2be2b0e3dde9f0fdf65160e2a19a60f032b160ef425700fdb161a0e19d4160e1f16160ef7a2180e43ea150e0400000048b007000400000048b00700040000003ba2120100")
#unpack
print("Unpack: " + rainft.S2Cspb.unpack(raw).hex() + "\n====================\n")
unpacked = rainft.S2Cspb.unpack(raw)
#decodeheader set content
header, size = rainft.S2Cspb.decode("package",unpacked)
print(header, size)
content = unpacked[size:]
print("Content: " + content.hex() + "\n====================\n")
#protocol
protoname, req, resp = rainft.S2Cspb.protocol(header['type'])
print(protoname, req, resp)
#decodecontent
print(rainft.S2Cspb.decode(req,content))
'''
rainft.SprotoInitialize() 相当于初始化了,用的是SprotoRpc.py改的
输出:
'''
PS D:\Sproto> & C:\Users\Administrator\AppData\Local\Programs\Python\Python36\python.exe d:/Sproto/getfullinfo.py
Unpack: 0100722801000000480000000e0000000200ec0300000400000066d20d000e0000000200ee0300000400000072fe07000e0000000200f003000004000000f02814000e0000000200f20300000400000078fe150000000000
{'type': 5176} 4
Content: 01000000480000000e0000000200ec0300000400000066d20d000e0000000200ee0300000400000072fe07000e0000000200f003000004000000f02814000e0000000200f20300000400000078fe150000000000
notify_alliance_resource_update <capsule object NULL at 0x00000280701EED20> None
set string:map key type not support
set string:sproto c lib error
Traceback (most recent call last):
File "d:/Sproto/getfullinfo.py", line 23, in
print(rainft.S2Cspb.decode(req,content))
File "d:\Sproto\rainft.py", line 44, in decode
return core.sproto_decode(st, chunk)
pysproto.error: sproto c lib error
'''
代码:
'''
from asyncio import sleep
import rainft
rainft.SprotoInitialize()
key = bytes.fromhex("3e8507c9")
raw = bytes.fromhex("1d0172280111480e4d02ec03045c66d20d0e3402ee03710472fe07d10e02f003c404f02845140e0213f203040778fe15")
rainft.SpbRpc.dispatch(raw)
raw = bytes.fromhex("1d011e370111e3df0d14582140011d0cec03cc1101257d17ac1fac1f34c404c2be472b0e06021ffa044c03067d0244055a03047cbee3056a047ceae4056a047ca71f36181c5405cc17741fac1f0c4401045c66dd6d5504054120045c66dd6d2dfc04c2be2b0e3dff04de9f0fdf65160e2a19a60f032b160ef425700fdb161a0e19d4160e1f16160ef7a2180e43ea150e04b848b00704b848b00704783ba21201")
unpacked = bytes.fromhex("01001e3701000000e3000000df000000140058210000000000000000000001000c00ec03cc00000001000000250000001700ac1fac1f3400000004000000c2be2b0e060000000200fa044c0306000000020044055a0304000000bee3056a04000000eae4056a04000000a71f36181c0000000500cc00170000001f00ac1f0c000000010000000400000066dd6d00550000000500000000002000000000000400000066dd6d002d00000004c2be2b0e3dde9f0fdf65160e2a19a60f032b160ef425700fdb161a0e19d4160e1f16160ef7a2180e43ea150e0400000048b007000400000048b00700040000003ba2120100")
#unpack
print("Unpack: " + rainft.S2Cspb.unpack(raw).hex() + "\n====================\n")
unpacked = rainft.S2Cspb.unpack(raw)
#decodeheader set content
header, size = rainft.S2Cspb.decode("package",unpacked)
print(header, size)
content = unpacked[size:]
print("Content: " + content.hex() + "\n====================\n")
#protocol
protoname, req, resp = rainft.S2Cspb.protocol(header['type'])
print(protoname, req, resp)
#decodecontent
print(rainft.S2Cspb.decode(req,content))
'''
rainft.SprotoInitialize() 相当于初始化了,用的是SprotoRpc.py改的