Skip to content

Commit

Permalink
fix for api update
Browse files Browse the repository at this point in the history
  • Loading branch information
BUnipendix committed Mar 7, 2023
1 parent c822f3d commit 0e615f1
Show file tree
Hide file tree
Showing 5 changed files with 7,215 additions and 7,208 deletions.
14,384 changes: 7,191 additions & 7,193 deletions MihoyoNetSniffer/genshin_pb2.py

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions MihoyoNetSniffer/sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,11 @@ def _message_global_process(
else:
# 处理普通message
if (message_id not in self._filter_list) ^ self._whitelist_mode:
if need_handle_callback and isinstance(message, bytes) is False:
if need_handle_callback and (isinstance(message, bytes) is False):
handles = self.handles.get(message_id, None)
if handles:
for handle in handles:
ret = handle(time_stamp, message) # 到底要不要多线程呢
if ret:
message = ret
handle(time_stamp, message) # 到底要不要多线程呢
return message

def _packet_process_loop(self, override_func=None):
Expand Down
17 changes: 10 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ KCP packet sniffer of a certain animal game used with Akebi or other versions(bk

## TODO

- [ ] Packet process handle
- [ ] Packet filter
- [ ] UnionCmdNotify parse
- [x] GUI
- [x] More complete API
- [x] Modify packet
- [x] Inner common packet process handles
- [x] Packet process handle
- [x] Packet filter
- [x] UnionCmdNotify parse
- [ ] GUI
- [ ] More complete API
- [ ] Modify packet
- [ ] Inner common packet process handles


最近又开始忙起来了,再加上为了速度重构一半的代码太麻烦,暂时搁置
4 changes: 2 additions & 2 deletions dump_packets.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


if __name__ == '__main__':
output_path = Path(r'')
output_name = ''
output_path = Path(r'D:\yuanshen2\3.5.0\sniffer_log')
output_name = '风花节'
output_file_path = output_path / (output_name + strftime("-%Y-%m-%d-%H-%M-%S.dump", localtime()))
a = PipePacketStream(dump_file=output_file_path)
a.start()
Expand Down
12 changes: 10 additions & 2 deletions video_key_sniff.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
from MihoyoNetSniffer.sniffer import Sniffer
from MihoyoNetSniffer.constant import COMMON_UNIMPORTENT_PACKETS, AI_RELATED_UNIMPORTANT_PACKETS, PLAYER_RELATED_PACKETS
from time import sleep
from traceback import print_exc


def test(_, packet):
try:
for i in packet.content.parent_quest_list:
for i in packet.parent_quest_list:
if i.video_key:
print(f'{i.parent_quest_id}: {i.video_key}')
except Exception:
except Exception as e:
print_exc()
print(e)
pass


def test2(_, packet):
print(f'{packet.parent_quest_id}: {packet.video_key}')


a = Sniffer(dump_path=r'D:\yuanshen2\3.5.0\sniffer_log', cache_packet=False, enable_data_output=True)
print('Initial success')
a.add_to_list(*COMMON_UNIMPORTENT_PACKETS)
a.add_to_list(*PLAYER_RELATED_PACKETS)
a.add_to_list(*AI_RELATED_UNIMPORTANT_PACKETS)
a.add_handle('FinishedParentQuestNotify', test)
a.add_handle('FinishedParentQuestUpdateNotify', test)
a.add_handle('GetParentQuestVideoKeyRsp', test2)
a.start()
try:
sleep(9999)
Expand Down

0 comments on commit 0e615f1

Please sign in to comment.