logger 自用

日志user

.................
packets.py CommandFactory __new__ mcs: , name: InviteToLocation, bases: (,), attrs: {'__module__': 'idarling.shared.commands', '__command__': 'invite_to_location', '__init__': }
packets.py CommandFactory __new__ cls: 
plugin.py C:\Users\zhangji\AppData\Roaming\Hex-Rays\IDA Pro\plugins\idarling\logs\idarling.48040.log_zj_debug
level: 20 
zj_debug
start log to console
end log to console
core.py super(Core, self).__init__(plugin)
interface.py super(Interface, self).__init__(plugin)
interface.py self._open_action
actions.py class ActionHandler __init__
actions.py Action __init__  plugin:  , menu:   File/Open
actions.py OpenAction super(....)
actions.py class ActionHandler __init__
actions.py Action __init__  plugin:  , menu:   File/Save
widget.py self.customContextMenuRequested.connect(self._context_menu) start
widget.py self.customContextMenuRequested.connect(self._context_menu) end
network.py super(Network, self).__init__(plugin) self._plugin: 
discovery.py class ServersDiscovery __init__  self._servers---> []
network.py self._discovery = ServersDiscovery(plugin.logger)
plugin.py Plugin __init__ self._network: , self: , self._network._plugin: 
plugin.py  init
[DEBUG] Loaded config: {'level': 10, 'keep': {u'cnt': 4, u'intvl': 15, u'idle': 240}, 'user': {u'color': 0, u'notifications': True, u'name': u'unnamed'}, 'cursors': {u'navbar': True, u'funcs': True, u'disasm': True}, 'servers': [{u'host': u'127.0.0.1', u'no_ssl': False, u'port': 31013}]}
module.py install
module.py------> 
interface.py  _install
actions.py install just a test

�PNG


actions.py self._icon_id-------> 1001
actions.py install self._ACTION_ID:  idarling:open
[DEBUG] Installed action OpenAction
interface.py self._open_action.install()
actions.py install just a test

�PNG


actions.py self._icon_id-------> 1002
actions.py install self._ACTION_ID:  idarling:save
[DEBUG] Installed action SaveAction
interface.py self._filter.install() start
[DEBUG] Installing the event filter
interface.py self._filter.install() end
[DEBUG] Installing the status bar widget
widget.py install(self, window)
widget.py window.statusBar().addPermanentWidget(self)
interface.py self._widget.install() end
plugin.py self._interface.install()
module.py install
module.py------> 
network.py _install self._discovery.start() start
[DEBUG] Starting servers discovery
discovery.py start platform.system()----> Windows
network.py _install self._discovery.start() end
plugin.py self._network.install()
module.py install
module.py------> 
core.py Core _install
[DEBUG] Installing core hooks
core.py class UIHooksCore(ida_kernwin.UI_Hooks) self._ui_hooks_core.hook() before
core.py class UIHooksCore(ida_kernwin.UI_Hooks) self._ui_hooks_core.hook() end
plugin.py self._core.install()
[INFO] ---------------------------------------------------------------------------
[INFO] IDArling v0.0.1 - (c) The IDArling Team
[INFO] ---------------------------------------------------------------------------
[INFO] Initialized properly
actions.py class ActionHandler update self._plugin.network.connected: False
widget.py integrated.setCheckable(True)---->
False
widget.py _servers_context_menu self._plugin.network.discovery.servers start user_servers: [{u'host': u'127.0.0.1', u'no_ssl': False, u'port': 31013}]
network.py discovery self._discovery: 
widget.py _servers_context_menu self._plugin.network.discovery.servers end disc_servers: [({'host': u'0.0.0.0', 'no_ssl': True, 'port': 60370}, 1551079563.401)]
sockets.py ClientSocket __init__ self._server: None
network.py Network connect self._client: , self._plugin: 
network.py Network connect self._server: {'host': u'0.0.0.0', 'no_ssl': True, 'port': 60370}, server: {'host': u'0.0.0.0', 'no_ssl': True, 'port': 60370}
network.py Network connect self._plugin.interface.update() start
interface.py Interface update
sockets.py ClientSocket connected check self._connected: False
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._open_action.update()
sockets.py ClientSocket connected check self._connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._save_action.update()
interface.py Interface update self._widget.refresh() start
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._widget.refresh() end
network.py Network connect self._plugin.interface.update() end
network.py Network connect Connecting to 127.0.0.1:60370...
[INFO] Connecting to 127.0.0.1:60370...
network.py Network connect sock: 
network.py Network connect self._client.wrap_socket(sock) start
sockets.py ClientSocket wrap_socket sock.fileno(): 2116
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket set_keep_alive self._socket: 
network.py Network connect ret = sock.connect_ex((host, port)) start
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _check_socket ret: 0
sockets.py ClientSocket _check_socket self._connected: True
[DEBUG] Connected
interface.py Interface update
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._open_action.update()
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._save_action.update()
interface.py Interface update self._widget.refresh() start
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._widget.refresh() end
[DEBUG] Joining session
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
。。。。。
###
actions.py class ActionHandler activate
[DEBUG] Showing dialog OpenDialog
packets.py Packet __init__ self: ListProjects.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 0
network.py send_packet --->packet:    ListProjects.Query()
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: ListProjects.Query()
sockets.py ClientSocket send_packet packet: ListProjects.Query()
[DEBUG] Sending packet: ListProjects.Query()
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): True
sockets.py ClientSocket send_packet start register_callback d: 
packets.py Query register_callback self.__parent__: 
packets.py Query register_callback self.__parent__.__callbacks__: {0: }
packets.py Query register_callback d: 
packets.py PacketDeferred(object) add_callback callback: >
packets.py PacketDeferred(object) add_callback self._called??: False
packets.py PacketDeferred(object) add_errback errback: >
actions.py ActionHandler activate self:   , dialog:   
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([ListProjects.Query()])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListProjects.Query()
packets.py Default(Serializable) build_default dct:  defaultdict(, {'command_type': 'list_projects_query', 'type': 'command'})
packets.py Command dct: defaultdict(, {'command_type': 'list_projects_query', 'type': 'command'})
packets.py Query __init__ build self._id: 0, dct: defaultdict(, {'command_type': 'list_projects_query', 'type': 'command', '__id__': 0})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 71
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "list_projects_reply", "type": "command", "__id__": 0, "projects": [{"date": "2019/01/19 20:13", "type": "ELF64 for x86-64 (Shared object)", "hash": "a32edf672e948f6c459c297bce0942f6", "name": "zhangjitest1", "file": "hypervisor.elf"}, {"date": "2019/01/19 20:27", "type": "ELF64 for x86-64 (Shared object)", "hash": "a32edf672e948f6c459c297bce0942f6", "name": "zhangjitest2", "file": "hypervisor.elf"}, {"date": "2019/01/28 10:07", "type": "ELF64 for x86-64 (Executable)", "hash": "f5104295e734c815a92a457de55b656d", "name": "20190128prj", "file": "equ"}, {"date": "2019/02/19 15:22", "type": "Portable executable for 80386 (PE)", "hash": "5c999921c54888260dea033d07c58cd1", "name": "20190219", "file": "TheFirstProject.exe"}]}
, len(data): 746
sockets.py ClientSocket _notify_read len(self._read_buffer): 746
sockets.py ClientSocket _notify_read len(line): 745
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"command_type": "list_projects_reply", "type": "command", "__id__": 0, "projects": [{"date": "2019/01/19 20:13", "type": "ELF64 for x86-64 (Shared object)", "hash": "a32edf672e948f6c459c297bce0942f6", "name": "zhangjitest1", "file": "hypervisor.elf"}, {"date": "2019/01/19 20:27", "type": "ELF64 for x86-64 (Shared object)", "hash": "a32edf672e948f6c459c297bce0942f6", "name": "zhangjitest2", "file": "hypervisor.elf"}, {"date": "2019/01/28 10:07", "type": "ELF64 for x86-64 (Executable)", "hash": "f5104295e734c815a92a457de55b656d", "name": "20190128prj", "file": "equ"}, {"date": "2019/02/19 15:22", "type": "Portable executable for 80386 (PE)", "hash": "5c999921c54888260dea033d07c58cd1", "name": "20190219", "file": "TheFirstProject.exe"}]}
sockets.py dct = json.loads~line {u'command_type': u'list_projects_reply', u'type': u'command', u'__id__': 0, u'projects': [{u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}, {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}]}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'list_projects_reply', u'type': u'command', u'__id__': 0, u'projects': [{u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}, {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}]}
packets.py Serializable new obj: ListProjects.Reply()
packets.py Serializable new cls: , dct: {u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}
packets.py Serializable new obj: Project()
packets.py Default(Serializable) parse_default self.__dict__:  {u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}
packets.py Serializable new cls: , dct: {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}
packets.py Serializable new obj: Project()
packets.py Default(Serializable) parse_default self.__dict__:  {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}
packets.py Serializable new cls: , dct: {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}
packets.py Serializable new obj: Project()
packets.py Default(Serializable) parse_default self.__dict__:  {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}
packets.py Serializable new cls: , dct: {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}
packets.py Serializable new obj: Project()
packets.py Default(Serializable) parse_default self.__dict__:  {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}
packets.py Reply  parse  dct: {u'command_type': u'list_projects_reply', u'type': u'command', u'__id__': 0, u'projects': [{u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}, {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}]}
packets.py Reply  parse self._id: 0, dct: {u'command_type': u'list_projects_reply', u'type': u'command', u'__id__': 0, u'projects': [{u'date': u'2019/01/19 20:13', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest1', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/19 20:27', u'hash': u'a32edf672e948f6c459c297bce0942f6', u'type': u'ELF64 for x86-64 (Shared object)', u'name': u'zhangjitest2', u'file': u'hypervisor.elf'}, {u'date': u'2019/01/28 10:07', u'hash': u'f5104295e734c815a92a457de55b656d', u'type': u'ELF64 for x86-64 (Executable)', u'name': u'20190128prj', u'file': u'equ'}, {u'date': u'2019/02/19 15:22', u'hash': u'5c999921c54888260dea033d07c58cd1', u'type': u'Portable executable for 80386 (PE)', u'name': u'20190219', u'file': u'TheFirstProject.exe'}]}
packets.py Packet parse_packet packet isinstance Reply : cls: , packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: {0: }
packets.py Reply(Packet) trigger_initback d: , self: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
packets.py PacketDeferred(object) initback result: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
sockets.py ClientSocket _notify_read self._read_packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])])
sockets.py ClientSocket _dispatch packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)]), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start
packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: {0: }
packets.py Reply(Packet) trigger_callback d: 
packets.py PacketDeferred(object) callback result: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
packets.py PacketDeferred(object) _run_callback self: 
packets.py PacketDeferred(object) _run_callback self._callback: >,self._callresult: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, type=ELF64 for x86-64 (Shared object), hash=a32edf672e948f6c459c297bce0942f6, name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ), Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket connected check self._connected: True
packets.py Packet __init__ self: ListDatabases.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 1
network.py send_packet --->packet:    ListDatabases.Query(project=20190219)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet packet: ListDatabases.Query(project=20190219)
[DEBUG] Sending packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
sockets.py ClientSocket send_packet start register_callback d: 
packets.py Query register_callback self.__parent__: 
packets.py Query register_callback self.__parent__.__callbacks__: {1: }
packets.py Query register_callback d: 
dialogs.py OpenDialog(QDialog) _project_clicked d.add_callback before d: 
dialogs.py OpenDialog(QDialog) _project_clicked partial(self._databases_listed): 
packets.py PacketDeferred(object) add_callback callback: 
packets.py PacketDeferred(object) add_callback self._called??: False
dialogs.py OpenDialog(QDialog) _project_clicked d.add_callback after self._databases_listed: >
packets.py PacketDeferred(object) add_errback errback: >
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 72
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Query(project=20190219)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Query(project=20190219)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'project': u'20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Command dct: defaultdict(, {'project': u'20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Query __init__ build self._id: 1, dct: defaultdict(, {'project': u'20190219', 'command_type': 'list_databases_query', 'type': 'command', '__id__': 1})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 95
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "list_databases_reply", "type": "command", "__id__": 1, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"command_type": "list_databases_reply", "type": "command", "__id__": 1, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
sockets.py dct = json.loads~line {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Serializable new obj: ListDatabases.Reply()
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Serializable new obj: Database()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Reply  parse  dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Reply  parse self._id: 1, dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Packet parse_packet packet isinstance Reply : cls: , packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: {1: }
packets.py Reply(Packet) trigger_initback d: , self: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) initback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _dispatch packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)]), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start
packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: {1: }
packets.py Reply(Packet) trigger_callback d: 
packets.py PacketDeferred(object) callback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) _run_callback self: 
packets.py PacketDeferred(object) _run_callback self._callback: ,self._callresult: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
actions.py OpenActionHandler _dialog_accepted project:  Project(date=2019/02/19 15:22, type=Portable executable for 80386 (PE), hash=5c999921c54888260dea033d07c58cd1, name=20190219, file=TheFirstProject.exe), database: Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data) 
packets.py Packet __init__ self: DownloadFile.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 2
actions.py OpenActionHandler _dialog_accepted packet:  DownloadFile.Query(project=20190219, database=20190219data)
actions.py OpenActionHandler _dialog_accepted  self._plugin:  , self._plugin.network: 
network.py send_packet --->packet:    DownloadFile.Query(project=20190219, database=20190219data)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: DownloadFile.Query(project=20190219, database=20190219data)
sockets.py ClientSocket send_packet packet: DownloadFile.Query(project=20190219, database=20190219data)
[DEBUG] Sending packet: DownloadFile.Query(project=20190219, database=20190219data)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
sockets.py ClientSocket send_packet start register_callback d: 
packets.py Query register_callback self.__parent__: 
packets.py Query register_callback self.__parent__.__callbacks__: {2: }
packets.py Query register_callback d: 
actions.py OpenActionHandler _dialog_accepted d=self._plugin.network.send_packet(packet): 
packets.py PacketDeferred(object) add_initback initback: 
packets.py PacketDeferred(object) add_initback self._inited?: False
packets.py PacketDeferred(object) add_callback callback: 
packets.py PacketDeferred(object) add_callback self._called??: False
actions.py OpenActionHandler _dialog_accepted database: Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data), progress: 
packets.py PacketDeferred(object) add_errback errback: >
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 96
sockets.py ClientSocket _notify_write self._outgoing: deque([DownloadFile.Query(project=20190219, database=20190219data)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): DownloadFile.Query(project=20190219, database=20190219data)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'project': u'20190219', 'command_type': 'download_file_query', 'type': 'command', 'database': u'20190219data'})
packets.py Command dct: defaultdict(, {'project': u'20190219', 'command_type': 'download_file_query', 'type': 'command', 'database': u'20190219data'})
packets.py Query __init__ build self._id: 2, dct: defaultdict(, {'project': u'20190219', 'command_type': 'download_file_query', 'type': 'command', '__id__': 2, 'database': u'20190219data'})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 122
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "download_file_reply", "type": "command", "__id__": 2, "__size__": 776282}
IDA2
sockets.py ClientSocket _notify_read len(self._read_buffer): 65535
sockets.py ClientSocket _notify_read len(line): 91
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 65443
sockets.py line---> {"command_type": "download_file_reply", "type": "command", "__id__": 2, "__size__": 776282}
sockets.py dct = json.loads~line {u'command_type': u'download_file_reply', u'type': u'command', u'__id__': 2, u'__size__': 776282}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'download_file_reply', u'type': u'command', u'__id__': 2, u'__size__': 776282}
packets.py Container(Command) __new__ cls: 
packets.py Container(Command) __new__ cls.mro(): [, , , , , , ]
packets.py Container(Command) __new__ super end self: DownloadFile.Reply()
packets.py Serializable new obj: DownloadFile.Reply()
packets.py Container(Command) parse start self: DownloadFile.Reply(), self.__dict__: {'_upback': None, '_downback': None}
packets.py Container(Command) parse self.__class__.mro(): [, , , , , , ]
packets.py Container(Command) parse end self: DownloadFile.Reply(), self.__dict__: {'_size': 776282, '_upback': None, '_downback': None}
packets.py Reply  parse  dct: {u'command_type': u'download_file_reply', u'type': u'command', u'__id__': 2, u'__size__': 776282}
packets.py Reply  parse self._id: 2, dct: {u'command_type': u'download_file_reply', u'type': u'command', u'__id__': 2, u'__size__': 776282}
packets.py Packet parse_packet packet isinstance Reply : cls: , packet: DownloadFile.Reply()
packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: {2: }
packets.py Reply(Packet) trigger_initback d: , self: DownloadFile.Reply()
packets.py PacketDeferred(object) initback result: DownloadFile.Reply()
packets.py PacketDeferred(object) _run_initback self: 
packets.py PacketDeferred(object) _run_initback self._initback: ,self._initresult: DownloadFile.Reply()
actions.py OpenActionHandler set_download_callback _dialog_accepted reply: DownloadFile.Reply()
packets.py Container(Command) downback self: DownloadFile.Reply(), downback: 
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 65443
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 65443, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 130978
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 130978
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 130978, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 411E60._Ostr

sockets.py ClientSocket _notify_read len(self._read_buffer): 196513
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 196513
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 196513, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: �S
sockets.py ClientSocket _notify_read len(self._read_buffer): 262048
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 262048
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 262048, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: mplement

sockets.py ClientSocket _notify_read len(self._read_buffer): 327583
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 327583
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 327583, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 393118
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 393118
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 393118, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 458653
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 458653
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 458653, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: A
sockets.py ClientSocket _notify_read len(self._read_buffer): 524188
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 524188
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 524188, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 589723
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 589723
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 589723, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 655258
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 655258
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 655258, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: 
sockets.py ClientSocket _notify_read len(self._read_buffer): 720793
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 720793
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 720793, total: 776282
sockets.py ClientSocket _notify_read break while
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: �'
=#�N
2
sockets.py ClientSocket _notify_read len(self._read_buffer): 776282
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Reply()
sockets.py ClientSocket _notify_read avail== len(self._read_buffer): 776282
sockets.py ClientSocket _notify_read total=self._read_packet.size: 776282
sockets.py ClientSocket _notify_read self._read_packet.downback: 
actions.py class ActionHandler _on_progress---> progress----> 
actions.py class ActionHandler _on_progress count: 776282, total: 776282
packets.py Container(Command) content self._size: 776282
packets.py Container(Command) content content: IDA2
sockets.py ClientSocket _notify_read len(self._read_packet.content): 776282
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([DownloadFile.Reply()])
sockets.py ClientSocket _dispatch packet: DownloadFile.Reply(), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: DownloadFile.Reply()
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start
packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: {2: }
packets.py Reply(Packet) trigger_callback d: 
packets.py PacketDeferred(object) callback result: DownloadFile.Reply()
packets.py PacketDeferred(object) _run_callback self: 
packets.py PacketDeferred(object) _run_callback self._callback: ,self._callresult: DownloadFile.Reply()
actions.py OpenActionHandler _file_downloaded app_path: D:/IDA 7.0/ida64.exe, app_name: ida64.exe
actions.py OpenActionHandler _file_downloaded file_path: C:\Users\zhangji\AppData\Roaming\Hex-Rays\IDA Pro\plugins\idarling\files\20190219_20190219data.i64
actions.py OpenActionHandler _file_downloaded database: Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)
actions.py OpenActionHandler _file_downloaded progress: 
actions.py OpenActionHandler _file_downloaded reply: DownloadFile.Reply()
[INFO] Saved file 20190219_20190219data.i64
actions.py OpenActionHandler _file_downloaded ida_loader.get_path database: 
actions.py OpenActionHandler _file_downloaded id(database): 2408337686856
actions.py OpenActionHandler _file_downloaded args: [u'ida64.exe', u'C:\\Users\\zhangji\\AppData\\Roaming\\Hex-Rays\\IDA Pro\\plugins\\idarling\\files\\20190219_20190219data.i64']
actions.py OpenActionHandler _file_downloaded argv: 

  bytes   pages size description
--------- ----- ---- --------------------------------------------
   270336    33 8192 allocating memory for b-tree...
   131072    16 8192 allocating memory for virtual array...
   262144    32 8192 allocating memory for name pointers...
-----------------------------------------------------------------
   663552            total memory allocated

Loading processor module D:\IDA 7.0\procs\pc64.dll for metapc...OK
Loading type libraries...
Autoanalysis subsystem has been initialized.
Database for file 'TheFirstProject.exe' has been loaded.
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
core.py  when close the task
[DEBUG] Leaving session
[DEBUG] Saved netnode: project=None, database=None, tick=0
[DEBUG] Saved netnode: project=None, database=None, tick=0
[DEBUG] Saved netnode: project=None, database=None, tick=0
Unloading IDP module D:\IDA 7.0\procs\pc64.dll...
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True

  bytes   pages size description
--------- ----- ---- --------------------------------------------
   270336    33 8192 allocating memory for b-tree...
   131072    16 8192 allocating memory for virtual array...
   262144    32 8192 allocating memory for name pointers...
-----------------------------------------------------------------
   663552            total memory allocated

Loading processor module D:\IDA 7.0\procs\pc64.dll for metapc...OK
Loading type libraries...
Autoanalysis subsystem has been initialized.
Database for file 'TheFirstProject.exe' has been loaded.
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
[DEBUG] Ready to run hook zj_debug
[DEBUG] Loaded netnode: project=20190219, database=20190219data, tick=0
core.py class UIHooksCore(ida_kernwin.UI_Hooks) join_session before
[DEBUG] Joining session
packets.py Packet __init__ self: ListDatabases.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 3
network.py send_packet --->packet:    ListDatabases.Query(project=20190219)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet packet: ListDatabases.Query(project=20190219)
[DEBUG] Sending packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
sockets.py ClientSocket send_packet start register_callback d: 
packets.py Query register_callback self.__parent__: 
packets.py Query register_callback self.__parent__.__callbacks__: {3: }
packets.py Query register_callback d: 
packets.py PacketDeferred(object) add_callback callback: 
packets.py PacketDeferred(object) add_callback self._called??: False
packets.py PacketDeferred(object) add_errback errback: >
core.py class UIHooksCore(ida_kernwin.UI_Hooks) join_session end
painter.py refresh
---------------------------------------------------------------------------------------------
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] 
IDAPython 64-bit v1.7.0 final (serial 0) (c) The IDAPython Team 
---------------------------------------------------------------------------------------------
Database snapshot restored successfully: 
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 123
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Query(project=20190219)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Query(project=20190219)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Command dct: defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Query __init__ build self._id: 3, dct: defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command', '__id__': 3})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 95
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "list_databases_reply", "type": "command", "__id__": 3, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"command_type": "list_databases_reply", "type": "command", "__id__": 3, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
sockets.py dct = json.loads~line {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 3, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 3, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Serializable new obj: ListDatabases.Reply()
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Serializable new obj: Database()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Reply  parse  dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 3, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Reply  parse self._id: 3, dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 3, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Packet parse_packet packet isinstance Reply : cls: , packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: {3: }
packets.py Reply(Packet) trigger_initback d: , self: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) initback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _dispatch packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)]), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start
packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: {3: }
packets.py Reply(Packet) trigger_callback d: 
packets.py PacketDeferred(object) callback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) _run_callback self: 
packets.py PacketDeferred(object) _run_callback self._callback: ,self._callresult: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
[DEBUG] Database is on the server
packets.py Packet __init__ self: JoinSession()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
network.py send_packet --->packet:    JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
sockets.py ClientSocket send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
[DEBUG] Sending packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
[DEBUG] Installing hooks
[INFO] Hex-Rays SDK is not available
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 96
sockets.py ClientSocket _notify_write self._outgoing: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'name': u'unnamed', 'database': '20190219data', 'color': 0, 'ea': 4264336L, 'project': '20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
packets.py Command dct: defaultdict(, {'name': u'unnamed', 'database': '20190219data', 'color': 0, 'ea': 4264336L, 'project': '20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
sockets.py dct = json.loads~line {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
packets.py Serializable new obj: JoinSession()
packets.py Default(Serializable) parse_default self.__dict__:  {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._read_packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)])
sockets.py ClientSocket _dispatch packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
core.py add_users self._user--->
{u'unnamed': {'color': 0, 'ea': 4264336}}
painter.py refresh
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True

日志服务端

packets.py CommandFactory __new__ mcs: , name: InviteToLocation, bases: (,), attrs: {'__module__': 'idarling.shared.commands', '__command__': 'invite_to_location', '__init__': }
packets.py CommandFactory __new__ cls: 
plugin.py C:\Users\zhangji\AppData\Roaming\Hex-Rays\IDA Pro\plugins\idarling\logs\idarling.7960.log_zj_debug
level: 20 
zj_debug
start log to console
end log to console
core.py super(Core, self).__init__(plugin)
interface.py super(Interface, self).__init__(plugin)
interface.py self._open_action
actions.py class ActionHandler __init__
actions.py Action __init__  plugin:  , menu:   File/Open
actions.py OpenAction super(....)
actions.py class ActionHandler __init__
actions.py Action __init__  plugin:  , menu:   File/Save
widget.py self.customContextMenuRequested.connect(self._context_menu) start
widget.py self.customContextMenuRequested.connect(self._context_menu) end
network.py super(Network, self).__init__(plugin) self._plugin: 
discovery.py class ServersDiscovery __init__  self._servers---> []
network.py self._discovery = ServersDiscovery(plugin.logger)
plugin.py Plugin __init__ self._network: , self: , self._network._plugin: 
plugin.py  init
[DEBUG] Loaded config: {'level': 10, 'keep': {u'cnt': 4, u'intvl': 15, u'idle': 240}, 'user': {u'color': 0, u'notifications': True, u'name': u'unnamed'}, 'cursors': {u'navbar': True, u'funcs': True, u'disasm': True}, 'servers': [{u'host': u'127.0.0.1', u'no_ssl': False, u'port': 31013}]}
module.py install
module.py------> 
interface.py  _install
actions.py install just a test

�PNG


actions.py self._icon_id-------> 1001
actions.py install self._ACTION_ID:  idarling:open
[DEBUG] Installed action OpenAction
interface.py self._open_action.install()
actions.py install just a test

�PNG


actions.py self._icon_id-------> 1002
actions.py install self._ACTION_ID:  idarling:save
[DEBUG] Installed action SaveAction
interface.py self._filter.install() start
[DEBUG] Installing the event filter
interface.py self._filter.install() end
[DEBUG] Installing the status bar widget
widget.py install(self, window)
widget.py window.statusBar().addPermanentWidget(self)
interface.py self._widget.install() end
plugin.py self._interface.install()
module.py install
module.py------> 
network.py _install self._discovery.start() start
[DEBUG] Starting servers discovery
discovery.py start platform.system()----> Windows
network.py _install self._discovery.start() end
plugin.py self._network.install()
module.py install
module.py------> 
core.py Core _install
[DEBUG] Installing core hooks
core.py class UIHooksCore(ida_kernwin.UI_Hooks) self._ui_hooks_core.hook() before
core.py class UIHooksCore(ida_kernwin.UI_Hooks) self._ui_hooks_core.hook() end
plugin.py self._core.install()
[INFO] ---------------------------------------------------------------------------
[INFO] IDArling v0.0.1 - (c) The IDArling Team
[INFO] ---------------------------------------------------------------------------
[INFO] Initialized properly
actions.py class ActionHandler update self._plugin.network.connected: False

  bytes   pages size description
--------- ----- ---- --------------------------------------------
   270336    33 8192 allocating memory for b-tree...
   131072    16 8192 allocating memory for virtual array...
   262144    32 8192 allocating memory for name pointers...
-----------------------------------------------------------------
   663552            total memory allocated

Loading processor module D:\IDA 7.0\procs\pc64.dll for metapc...OK
Loading type libraries...
Autoanalysis subsystem has been initialized.
Database for file 'TheFirstProject.exe' has been loaded.
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
。。。。。。
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
[DEBUG] Ready to run hook zj_debug
[DEBUG] Loaded netnode: project=20190219, database=20190219data, tick=0
core.py class UIHooksCore(ida_kernwin.UI_Hooks) join_session before
[DEBUG] Joining session
packets.py Packet __init__ self: ListDatabases.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 0
network.py send_packet --->packet:    ListDatabases.Query(project=20190219)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
core.py class UIHooksCore(ida_kernwin.UI_Hooks) join_session end
painter.py refresh
---------------------------------------------------------------------------------------------
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] 
IDAPython 64-bit v1.7.0 final (serial 0) (c) The IDAPython Team 
---------------------------------------------------------------------------------------------
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
widget.py integrated.setCheckable(True)---->
False
widget.py _servers_context_menu self._plugin.network.discovery.servers start user_servers: [{u'host': u'127.0.0.1', u'no_ssl': False, u'port': 31013}]
network.py discovery self._discovery: 
widget.py _servers_context_menu self._plugin.network.discovery.servers end disc_servers: []
widget.py integrated.isChecked()----> True
widget.py self._plugin--------> 
widget.py self._plugin.network--------> 
widget.py self._plugin.network.start_server() start
network.py start_server(self)
[INFO] Starting the integrated server...
sockets.py ServerSocket __init__ parent: None
storage.py Storage __init__ dbpath: C:\Users\zhangji\AppData\Roaming\Hex-Rays\IDA Pro\plugins\idarling\files\database.db
network.py server 
[INFO] Starting the server on 0.0.0.0:0
server.py Server start ssl_: None
sockets.py ServerSocket connect self: 
sockets.py ServerSocket connect self._accept_notifier.activated.connect(self._notify_accept) start
sockets.py ServerSocket connect sock: 
[DEBUG] Starting clients discovery
network.py send_packet server.port:  60370
network.py Network start_server self.disconnect() start
network.py Network start_server self.disconnect() end and self.connect(integrated_arg) start
sockets.py ClientSocket __init__ self._server: None
network.py Network connect self._client: , self._plugin: 
network.py Network connect self._server: {'host': '0.0.0.0', 'no_ssl': True, 'port': 60370}, server: {'host': '0.0.0.0', 'no_ssl': True, 'port': 60370}
network.py Network connect self._plugin.interface.update() start
interface.py Interface update
sockets.py ClientSocket connected check self._connected: False
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._open_action.update()
sockets.py ClientSocket connected check self._connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._save_action.update()
sockets.py ClientSocket connected check self._connected: False
actions.py class ActionHandler update self._plugin.network.connected: False
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._widget.refresh() start
sockets.py ClientSocket connected check self._connected: False
interface.py Interface update self._widget.refresh() end
network.py Network connect self._plugin.interface.update() end
network.py Network connect Connecting to 127.0.0.1:60370...
[INFO] Connecting to 127.0.0.1:60370...
network.py Network connect sock: 
network.py Network connect self._client.wrap_socket(sock) start
sockets.py ClientSocket wrap_socket sock.fileno(): 2228
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket set_keep_alive self._socket: 
network.py Network connect ret = sock.connect_ex((host, port)) start
network.py Network start_server self.connect(integrated_arg) end
widget.py self._plugin.network.start_server() finish
sockets.py ServerSocket _notify_accept Callback called when a client is connecting.
sockets.py ServerSocket _notify_accept self._socket: 
sockets.py ServerSocket _notify_accept sock: , address: ('127.0.0.1', 60371)
server.py Server _accept Called when an user connects
sockets.py ClientSocket __init__ self._server: True
server.py ServerClient __init__ parent: 
server.py ServerClient wrap_socket sock: 
sockets.py ClientSocket wrap_socket sock.fileno(): 2236
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
server.py wrap_socket prefix: 127.0.0.1:60371
[INFO] (127.0.0.1:60371) Connected
server.py Server _accept Called client: 
server.py Server _accept before self._clients: [], self._ssl: None
server.py Server _accept after self._clients: []
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _check_socket ret: 0
sockets.py ClientSocket _check_socket self._connected: True
[DEBUG] Connected
interface.py Interface update
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._open_action.update()
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._save_action.update()
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._widget.refresh() start
sockets.py ClientSocket connected check self._connected: True
interface.py Interface update self._widget.refresh() end
[DEBUG] Joining session
packets.py Packet __init__ self: ListDatabases.Query()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Query __init__ self._id: 1
network.py send_packet --->packet:    ListDatabases.Query(project=20190219)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet packet: ListDatabases.Query(project=20190219)
[DEBUG] Sending packet: ListDatabases.Query(project=20190219)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): True
sockets.py ClientSocket send_packet start register_callback d: 
packets.py Query register_callback self.__parent__: 
packets.py Query register_callback self.__parent__.__callbacks__: {1: }
packets.py Query register_callback d: 
packets.py PacketDeferred(object) add_callback callback: 
packets.py PacketDeferred(object) add_callback self._called??: False
packets.py PacketDeferred(object) add_errback errback: >
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Query(project=20190219)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Query(project=20190219)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Command dct: defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command'})
packets.py Query __init__ build self._id: 1, dct: defaultdict(, {'project': '20190219', 'command_type': 'list_databases_query', 'type': 'command', '__id__': 1})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 95
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _check_socket ret: 0
sockets.py ClientSocket _check_socket self._connected: True
[DEBUG] (127.0.0.1:60371) Connected
sockets.py ClientSocket _notify_read data_recv: {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 1}
, len(data): 96
sockets.py ClientSocket _notify_read len(self._read_buffer): 96
sockets.py ClientSocket _notify_read len(line): 95
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 1}
sockets.py dct = json.loads~line {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
packets.py Serializable new obj: ListDatabases.Query()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command'}
packets.py Query __init__ parse self._id: 1, dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
packets.py Query __init__ parse self.__dict__: {u'project': u'20190219', u'command_type': u'list_databases_query', '_id': 1, u'type': u'command'}
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)])
sockets.py ClientSocket _dispatch packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60371) Received packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
server.py ServerClient recv_packet handlers packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
packets.py Reply __init__  self: ListDatabases.Reply() ,query: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
packets.py Packet __init__ self: ListDatabases.Reply()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Reply __init__  query.id: 1
sockets.py ClientSocket send_packet packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
[DEBUG] (127.0.0.1:60371) Sending packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): True
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Default(Serializable) build_default dct:  {'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}
packets.py Command dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build  self._id: 1,dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build self._id: 1, dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', '__id__': 1, 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "list_databases_reply", "type": "command", "__id__": 1, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"command_type": "list_databases_reply", "type": "command", "__id__": 1, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}
sockets.py dct = json.loads~line {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Serializable new obj: ListDatabases.Reply()
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Serializable new obj: Database()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}
packets.py Reply  parse  dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Reply  parse self._id: 1, dct: {u'command_type': u'list_databases_reply', u'type': u'command', u'__id__': 1, u'databases': [{u'project': u'20190219', u'date': u'2019/02/19 15:43', u'tick': 0, u'name': u'20190219data'}]}
packets.py Packet parse_packet packet isinstance Reply : cls: , packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: {1: }
packets.py Reply(Packet) trigger_initback d: , self: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) initback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _dispatch packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)]), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start
packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: {1: }
packets.py Reply(Packet) trigger_callback d: 
packets.py PacketDeferred(object) callback result: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py PacketDeferred(object) _run_callback self: 
packets.py PacketDeferred(object) _run_callback self._callback: ,self._callresult: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
[DEBUG] Database is on the server
packets.py Packet __init__ self: JoinSession()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
network.py send_packet --->packet:    JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
network.py send_packet self:  , self._plugin: 
network.py send_packet self.__class__.mro():  [, , ]
sockets.py ClientSocket connected check self._connected: True
client.py send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
sockets.py ClientSocket send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
[DEBUG] Sending packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
[DEBUG] Installing hooks
[INFO] Hex-Rays SDK is not available
sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 96
sockets.py ClientSocket _notify_write self._outgoing: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'name': u'unnamed', 'database': '20190219data', 'color': 0, 'ea': 4264336L, 'project': '20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
packets.py Command dct: defaultdict(, {'name': u'unnamed', 'database': '20190219data', 'color': 0, 'ea': 4264336L, 'project': '20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
sockets.py dct = json.loads~line {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
packets.py Serializable new obj: JoinSession()
packets.py Default(Serializable) parse_default self.__dict__:  {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._read_packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)])
sockets.py ClientSocket _dispatch packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60371) Received packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
server.py ServerClient recv_packet handlers packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True), self: 
[DEBUG] (127.0.0.1:60371) Sending 0 missed events
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket connected check self._connected: True
sockets.py ServerSocket _notify_accept Callback called when a client is connecting.
sockets.py ServerSocket _notify_accept self._socket: 
sockets.py ServerSocket _notify_accept sock: , address: ('127.0.0.1', 60392)
server.py Server _accept Called when an user connects
sockets.py ClientSocket __init__ self._server: True
server.py ServerClient __init__ parent: 
server.py ServerClient wrap_socket sock: 
sockets.py ClientSocket wrap_socket sock.fileno(): 2240
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket event Qt event ignore start
server.py wrap_socket prefix: 127.0.0.1:60392
[INFO] (127.0.0.1:60392) Connected
server.py Server _accept Called client: 
server.py Server _accept before self._clients: [], self._ssl: None
server.py Server _accept after self._clients: [, ]
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _check_socket ret: 0
sockets.py ClientSocket _check_socket self._connected: True
[DEBUG] (127.0.0.1:60392) Connected
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
.............
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"command_type": "list_projects_query", "type": "command", "__id__": 0}
, len(data): 72
sockets.py ClientSocket _notify_read len(self._read_buffer): 72
sockets.py ClientSocket _notify_read len(line): 71
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"command_type": "list_projects_query", "type": "command", "__id__": 0}
sockets.py dct = json.loads~line {u'command_type': u'list_projects_query', u'type': u'command', u'__id__': 0}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'command_type': u'list_projects_query', u'type': u'command', u'__id__': 0}
packets.py Serializable new obj: ListProjects.Query()
packets.py Default(Serializable) parse_default self.__dict__:  {u'command_type': u'list_projects_query', u'type': u'command'}
packets.py Query __init__ parse self._id: 0, dct: {u'command_type': u'list_projects_query', u'type': u'command', u'__id__': 0}
packets.py Query __init__ parse self.__dict__: {u'command_type': u'list_projects_query', '_id': 0, u'type': u'command'}
sockets.py ClientSocket _notify_read self._read_packet: ListProjects.Query(command_type=list_projects_query, type=command)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([])
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListProjects.Query(command_type=list_projects_query, type=command)])
sockets.py ClientSocket _dispatch packet: ListProjects.Query(command_type=list_projects_query, type=command), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60392) Received packet: ListProjects.Query(command_type=list_projects_query, type=command)
server.py ServerClient recv_packet handlers packet: ListProjects.Query(command_type=list_projects_query, type=command), self: 
storage.py Storage select_projects i: 
storage.py Storage select_projects i: 
storage.py Storage select_projects i: 
storage.py Storage select_projects i: 
storage.py Storage select_projects [Project(**result) for result in results]: [Project(date=2019/01/19 20:13, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, hash=f5104295e734c815a92a457de55b656d, type=ELF64 for x86-64 (Executable), name=20190128prj, file=equ), Project(date=2019/02/19 15:22, hash=5c999921c54888260dea033d07c58cd1, type=Portable executable for 80386 (PE), name=20190219, file=TheFirstProject.exe)]
packets.py Reply __init__  self: ListProjects.Reply() ,query: ListProjects.Query(command_type=list_projects_query, type=command)
packets.py Packet __init__ self: ListProjects.Reply()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Reply __init__  query.id: 0
sockets.py ClientSocket send_packet packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, hash=f5104295e734c815a92a457de55b656d, type=ELF64 for x86-64 (Executable), name=20190128prj, file=equ), Project(date=2019/02/19 15:22, hash=5c999921c54888260dea033d07c58cd1, type=Portable executable for 80386 (PE), name=20190219, file=TheFirstProject.exe)])
[DEBUG] (127.0.0.1:60392) Sending packet: ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, hash=f5104295e734c815a92a457de55b656d, type=ELF64 for x86-64 (Executable), name=20190128prj, file=equ), Project(date=2019/02/19 15:22, hash=5c999921c54888260dea033d07c58cd1, type=Portable executable for 80386 (PE), name=20190219, file=TheFirstProject.exe)])
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): True
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 0
sockets.py ClientSocket _notify_write self._outgoing: deque([ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, hash=f5104295e734c815a92a457de55b656d, type=ELF64 for x86-64 (Executable), name=20190128prj, file=equ), Project(date=2019/02/19 15:22, hash=5c999921c54888260dea033d07c58cd1, type=Portable executable for 80386 (PE), name=20190219, file=TheFirstProject.exe)])])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListProjects.Reply(projects=[Project(date=2019/01/19 20:13, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest1, file=hypervisor.elf), Project(date=2019/01/19 20:27, hash=a32edf672e948f6c459c297bce0942f6, type=ELF64 for x86-64 (Shared object), name=zhangjitest2, file=hypervisor.elf), Project(date=2019/01/28 10:07, hash=f5104295e734c815a92a457de55b656d, type=ELF64 for x86-64 (Executable), name=20190128prj, file=equ), Project(date=2019/02/19 15:22, hash=5c999921c54888260dea033d07c58cd1, type=Portable executable for 80386 (PE), name=20190219, file=TheFirstProject.exe)])
packets.py Default(Serializable) build_default dct:  {'date': u'2019/01/19 20:13', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest1', 'file': u'hypervisor.elf'} ### line = json.dumps(self._write_packet.build_packet())
packets.py Default(Serializable) build_default dct:  {'date': u'2019/01/19 20:27', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest2', 'file': u'hypervisor.elf'}
packets.py Default(Serializable) build_default dct:  {'date': u'2019/01/28 10:07', 'type': u'ELF64 for x86-64 (Executable)', 'hash': u'f5104295e734c815a92a457de55b656d', 'name': u'20190128prj', 'file': u'equ'}
packets.py Default(Serializable) build_default dct:  {'date': u'2019/02/19 15:22', 'type': u'Portable executable for 80386 (PE)', 'hash': u'5c999921c54888260dea033d07c58cd1', 'name': u'20190219', 'file': u'TheFirstProject.exe'}
packets.py Command dct: defaultdict(, {'command_type': 'list_projects_reply', 'type': 'command', 'projects': [{'date': u'2019/01/19 20:13', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest1', 'file': u'hypervisor.elf'}, {'date': u'2019/01/19 20:27', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest2', 'file': u'hypervisor.elf'}, {'date': u'2019/01/28 10:07', 'type': u'ELF64 for x86-64 (Executable)', 'hash': u'f5104295e734c815a92a457de55b656d', 'name': u'20190128prj', 'file': u'equ'}, {'date': u'2019/02/19 15:22', 'type': u'Portable executable for 80386 (PE)', 'hash': u'5c999921c54888260dea033d07c58cd1', 'name': u'20190219', 'file': u'TheFirstProject.exe'}]})
packets.py Reply  build  self._id: 0,dct: defaultdict(, {'command_type': 'list_projects_reply', 'type': 'command', 'projects': [{'date': u'2019/01/19 20:13', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest1', 'file': u'hypervisor.elf'}, {'date': u'2019/01/19 20:27', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest2', 'file': u'hypervisor.elf'}, {'date': u'2019/01/28 10:07', 'type': u'ELF64 for x86-64 (Executable)', 'hash': u'f5104295e734c815a92a457de55b656d', 'name': u'20190128prj', 'file': u'equ'}, {'date': u'2019/02/19 15:22', 'type': u'Portable executable for 80386 (PE)', 'hash': u'5c999921c54888260dea033d07c58cd1', 'name': u'20190219', 'file': u'TheFirstProject.exe'}]})
packets.py Reply  build self._id: 0, dct: defaultdict(, {'command_type': 'list_projects_reply', 'type': 'command', '__id__': 0, 'projects': [{'date': u'2019/01/19 20:13', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest1', 'file': u'hypervisor.elf'}, {'date': u'2019/01/19 20:27', 'type': u'ELF64 for x86-64 (Shared object)', 'hash': u'a32edf672e948f6c459c297bce0942f6', 'name': u'zhangjitest2', 'file': u'hypervisor.elf'}, {'date': u'2019/01/28 10:07', 'type': u'ELF64 for x86-64 (Executable)', 'hash': u'f5104295e734c815a92a457de55b656d', 'name': u'20190128prj', 'file': u'equ'}, {'date': u'2019/02/19 15:22', 'type': u'Portable executable for 80386 (PE)', 'hash': u'5c999921c54888260dea033d07c58cd1', 'name': u'20190219', 'file': u'TheFirstProject.exe'}]})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 745
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 1}
, len(data): 96
sockets.py ClientSocket _notify_read len(self._read_buffer): 96
sockets.py ClientSocket _notify_read len(line): 95
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 1}
sockets.py dct = json.loads~line {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
packets.py Serializable new obj: ListDatabases.Query()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command'}
packets.py Query __init__ parse self._id: 1, dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 1}
packets.py Query __init__ parse self.__dict__: {u'project': u'20190219', u'command_type': u'list_databases_query', '_id': 1, u'type': u'command'}
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)])
sockets.py ClientSocket _dispatch packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60392) Received packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
server.py ServerClient recv_packet handlers packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
packets.py Reply __init__  self: ListDatabases.Reply() ,query: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
packets.py Packet __init__ self: ListDatabases.Reply()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Reply __init__  query.id: 1
sockets.py ClientSocket send_packet packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
[DEBUG] (127.0.0.1:60392) Sending packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 746
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Default(Serializable) build_default dct:  {'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}
packets.py Command dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build  self._id: 1,dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build self._id: 1, dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', '__id__': 1, 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"project": "20190219", "command_type": "download_file_query", "type": "command", "__id__": 2, "database": "20190219data"}
, len(data): 123
sockets.py ClientSocket _notify_read len(self._read_buffer): 123
sockets.py ClientSocket _notify_read len(line): 122
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"project": "20190219", "command_type": "download_file_query", "type": "command", "__id__": 2, "database": "20190219data"}
sockets.py dct = json.loads~line {u'project': u'20190219', u'command_type': u'download_file_query', u'type': u'command', u'__id__': 2, u'database': u'20190219data'}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'command_type': u'download_file_query', u'type': u'command', u'__id__': 2, u'database': u'20190219data'}
packets.py Serializable new obj: DownloadFile.Query()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'command_type': u'download_file_query', u'type': u'command', u'database': u'20190219data'}
packets.py Query __init__ parse self._id: 2, dct: {u'project': u'20190219', u'command_type': u'download_file_query', u'type': u'command', u'__id__': 2, u'database': u'20190219data'}
packets.py Query __init__ parse self.__dict__: {u'project': u'20190219', u'command_type': u'download_file_query', '_id': 2, u'type': u'command', u'database': u'20190219data'}
sockets.py ClientSocket _notify_read self._read_packet: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data)])
sockets.py ClientSocket _dispatch packet: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60392) Received packet: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data)
server.py ServerClient recv_packet handlers packet: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data), self: 
server.py ServerClient _handle_download_file self: , query: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data), self.parent(): 
server.py ServerClient _handle_download_file dir(self): ['MAX_DATA_SIZE', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattr__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_check_socket', '_color', '_connected', '_database', '_dispatch', '_ea', '_handle_create_database', '_handle_create_project', '_handle_download_file', '_handle_invite_to_location', '_handle_join_session', '_handle_leave_session', '_handle_list_databases', '_handle_list_projects', '_handle_update_location', '_handle_update_user_color', '_handle_update_user_name', '_handle_upload_file', '_handlers', '_incoming', '_logger', '_name', '_notify_read', '_notify_write', '_outgoing', '_project', '_read_buffer', '_read_notifier', '_read_packet', '_server', '_socket', '_write_buffer', '_write_cursor', '_write_notifier', '_write_packet', 'blockSignals', 'childEvent', 'children', 'color', 'connectNotify', 'connected', 'customEvent', 'database', 'deleteLater', 'destroyed', 'disconnect', 'disconnectNotify', 'dumpObjectInfo', 'dumpObjectTree', 'dynamicPropertyNames', 'ea', 'event', 'eventFilter', 'findChild', 'findChildren', 'inherits', 'installEventFilter', 'isSignalConnected', 'isWidgetType', 'isWindowType', 'killTimer', 'metaObject', 'moveToThread', 'name', 'objectName', 'objectNameChanged', 'parent', 'project', 'property', 'pyqtConfigure', 'receivers', 'recv_packet', 'removeEventFilter', 'send_packet', 'sender', 'senderSignalIndex', 'setObjectName', 'setParent', 'setProperty', 'set_keep_alive', 'signalsBlocked', 'startTimer', 'staticMetaObject', 'thread', 'timerEvent', 'tr', 'wrap_socket']
server.py ServerClient _handle_download_file self.__dict__: {'_write_buffer': bytearray(b'{"command_type": "list_databases_reply", "type": "command", "__id__": 1, "databases": [{"project": "20190219", "date": "2019/02/19 15:43", "tick": 0, "name": "20190219data"}]}\n'), '_handlers': {: >, : >, : >, : >, : >, : >, : >, : >, : >, : >, : >, : >}, '_connected': True, '_read_packet': None, '_logger': , '_ea': None, '_socket': , '_incoming': deque([]), '_read_notifier': , '_name': None, '_write_packet': ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)]), '_write_cursor': 176, '_color': None, '_database': None, '_outgoing': deque([]), '_server': True, '_write_notifier': , '_read_buffer': bytearray(b''), '_project': None}
Help on built-in function parent:

parent(...)
    parent(self) -> QObject

server.py ServerClient _handle_download_file reply = DownloadFile.Reply(query) start
packets.py Container(Command) __new__ cls: 
packets.py Container(Command) __new__ cls.mro(): [, , , , , , ]
packets.py Container(Command) __new__ super end self: DownloadFile.Reply()
packets.py Reply __init__  self: DownloadFile.Reply() ,query: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data)
packets.py Packet __init__ self: DownloadFile.Reply()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Reply __init__  query.id: 2
packets.py Container(Command) content self._size: 776282
packets.py Container(Command) content content: IDA2
[INFO] (127.0.0.1:60392) Loaded file 20190219_20190219data.idb
server.py ServerClient _handle_download_file self.send_packet(reply) start
sockets.py ClientSocket send_packet packet: DownloadFile.Reply()
[DEBUG] (127.0.0.1:60392) Sending packet: DownloadFile.Reply()
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
server.py ServerClient _handle_download_file self.send_packet(reply) end
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 176
sockets.py ClientSocket _notify_write self._outgoing: deque([DownloadFile.Reply()])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): DownloadFile.Reply()
packets.py Container(Command) build self: DownloadFile.Reply(), len(self._content): 776282
packets.py Command dct: defaultdict(, {'command_type': 'download_file_reply', 'type': 'command'})
packets.py Reply  build  self._id: 2,dct: defaultdict(, {'command_type': 'download_file_reply', 'type': 'command', '__size__': 776282})
packets.py Reply  build self._id: 2, dct: defaultdict(, {'command_type': 'download_file_reply', 'type': 'command', '__id__': 2, '__size__': 776282})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 91
sockets.py ClientSocket _notify_write self._write_packet.size: 776374
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 65535
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 131070
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 196605
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 262140
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 327675
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 393210
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 458745
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 524280
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 589815
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 655350
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 720885
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 3}
, len(data): 96
sockets.py ClientSocket _notify_read len(self._read_buffer): 96
sockets.py ClientSocket _notify_read len(line): 95
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"project": "20190219", "command_type": "list_databases_query", "type": "command", "__id__": 3}
sockets.py dct = json.loads~line {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 3}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 3}
packets.py Serializable new obj: ListDatabases.Query()
packets.py Default(Serializable) parse_default self.__dict__:  {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command'}
packets.py Query __init__ parse self._id: 3, dct: {u'project': u'20190219', u'command_type': u'list_databases_query', u'type': u'command', u'__id__': 3}
packets.py Query __init__ parse self.__dict__: {u'project': u'20190219', u'command_type': u'list_databases_query', '_id': 3, u'type': u'command'}
sockets.py ClientSocket _notify_read self._read_packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)])
sockets.py ClientSocket _dispatch packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60392) Received packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
server.py ServerClient recv_packet handlers packet: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command), self: 
packets.py Reply __init__  self: ListDatabases.Reply() ,query: ListDatabases.Query(project=20190219, command_type=list_databases_query, type=command)
packets.py Packet __init__ self: ListDatabases.Reply()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
packets.py Reply __init__  query.id: 3
sockets.py ClientSocket send_packet packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
[DEBUG] (127.0.0.1:60392) Sending packet: ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 776374
sockets.py ClientSocket _notify_write self._outgoing: deque([ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): ListDatabases.Reply(databases=[Database(project=20190219, date=2019/02/19 15:43, tick=0, name=20190219data)])
packets.py Default(Serializable) build_default dct:  {'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}
packets.py Command dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build  self._id: 3,dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
packets.py Reply  build self._id: 3, dct: defaultdict(, {'command_type': 'list_databases_reply', 'type': 'command', '__id__': 3, 'databases': [{'project': u'20190219', 'date': u'2019/02/19 15:43', 'tick': 0, 'name': u'20190219data'}]})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
, len(data): 176
sockets.py ClientSocket _notify_read len(self._read_buffer): 176
sockets.py ClientSocket _notify_read len(line): 175
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": true}
sockets.py dct = json.loads~line {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._server: True
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
packets.py Serializable new obj: JoinSession()
packets.py Default(Serializable) parse_default self.__dict__:  {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': True}
sockets.py ClientSocket _notify_read self._read_packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)])
sockets.py ClientSocket _dispatch packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] (127.0.0.1:60392) Received packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True)
server.py ServerClient recv_packet handlers packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=True), self: 
sockets.py ClientSocket send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)
[DEBUG] (127.0.0.1:60371) Sending packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
packets.py Packet __init__ self: JoinSession()
packets.py Packet __init__ super(Packet, self).__init__() start
packets.py Packet __init__ super(Packet, self).__init__() end
sockets.py ClientSocket send_packet packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
[DEBUG] (127.0.0.1:60392) Sending packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): False
sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False
[DEBUG] (127.0.0.1:60392) Sending 0 missed events
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 176
sockets.py ClientSocket _notify_write self._outgoing: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)
packets.py Default(Serializable) build_default dct:  defaultdict(, {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', 'command_type': u'join_session', u'tick': 0, 'type': u'command', u'silent': False})
packets.py Command dct: defaultdict(, {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', 'command_type': u'join_session', u'tick': 0, 'type': u'command', u'silent': False})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 176
sockets.py ClientSocket _notify_write now
sockets.py ClientSocket _notify_write self._write_cursor: 176
sockets.py ClientSocket _notify_write self._outgoing: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)])
sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, tick=0, silent=True)
packets.py Default(Serializable) build_default dct:  defaultdict(, {'name': u'unnamed', 'database': u'20190219data', 'color': 0, 'ea': 4264336, 'project': u'20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
packets.py Command dct: defaultdict(, {'name': u'unnamed', 'database': u'20190219data', 'color': 0, 'ea': 4264336, 'project': u'20190219', 'command_type': 'join_session', 'tick': 0, 'type': 'command', 'silent': True})
sockets.py ClientSocket _notify_write line=json.dumps len(line): 175
sockets.py ClientSocket _notify_read now
sockets.py ClientSocket _notify_read data_recv: {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": false}
, len(data): 177
sockets.py ClientSocket _notify_read len(self._read_buffer): 177
sockets.py ClientSocket _notify_read len(line): 176
sockets.py ClientSocket _notify_read pos after len(self._read_buffer): 0
sockets.py line---> {"name": "unnamed", "database": "20190219data", "color": 0, "ea": 4264336, "project": "20190219", "command_type": "join_session", "tick": 0, "type": "command", "silent": false}
sockets.py dct = json.loads~line {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': False}
sockets.py ClientSocket _notify_read self._server: None
packets.py PacketFactory(type) get_class mcs: , cls: , dct['type']: command
packets.py Serializable new cls: , dct: {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': False}
packets.py Serializable new obj: JoinSession()
packets.py Default(Serializable) parse_default self.__dict__:  {u'name': u'unnamed', u'database': u'20190219data', u'color': 0, u'ea': 4264336, u'project': u'20190219', u'command_type': u'join_session', u'tick': 0, u'type': u'command', u'silent': False}
sockets.py ClientSocket _notify_read self._read_packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start
sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end
sockets.py ClientSocket event Qt event is fired event: 
sockets.py ClientSocket _dispatch self._incoming: deque([JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)])
sockets.py ClientSocket _dispatch packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False), self: 
sockets.py ClientSocket _dispatch self.__class__.mro()
[DEBUG] Received packet: JoinSession(name=unnamed, database=20190219data, color=0, ea=4264336, project=20190219, command_type=join_session, tick=0, type=command, silent=False)
core.py add_users self._user--->
{u'unnamed': {'color': 0, 'ea': 4264336}}
painter.py refresh
sockets.py ClientSocket connected check self._connected: True
interface.py show_invite invite: 
interface.py show_invite text: unnamed joined the session
[DEBUG] Showing invite unnamed joined the session
sockets.py ClientSocket event Qt event accept start
sockets.py ClientSocket event Qt event accept end return Ture
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True
sockets.py ClientSocket connected check self._connected: True
actions.py class ActionHandler update self._plugin.network.connected: True
sockets.py ClientSocket connected check self._connected: True

server.py

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
import logging
import os
import socket
import ssl

from .commands import (
    CreateDatabase,
    CreateProject,
    DownloadFile,
    InviteToLocation,
    JoinSession,
    LeaveSession,
    ListDatabases,
    ListProjects,
    UpdateFile,
    UpdateLocation,
    UpdateUserColor,
    UpdateUserName,
)
from .discovery import ClientsDiscovery
from .packets import Command, Event
from .sockets import ClientSocket, ServerSocket
from .storage import Storage


class ServerClient(ClientSocket):
    """
    This class represents a client socket for the server. It implements all the
    handlers for the packet the client is susceptible to send.
    """

    def __init__(self, logger, parent=None):
        ClientSocket.__init__(self, logger, parent)
        print("server.py ServerClient __init__ parent: %s"%parent)#zj_debug
        #case:parent: 
        self._project = None
        self._database = None
        self._name = None
        self._color = None
        self._ea = None
        self._handlers = {}

    @property
    def project(self):
        return self._project

    @property
    def database(self):
        return self._database

    @property
    def name(self):
        return self._name

    @property
    def color(self):
        return self._color

    @property
    def ea(self):
        return self._ea

    def wrap_socket(self, sock):
    	print("server.py ServerClient wrap_socket sock: %s"%sock)#zj_debug
        ClientSocket.wrap_socket(self, sock)

        # Setup command handlers
        self._handlers = {
            ListProjects.Query: self._handle_list_projects,
            ListDatabases.Query: self._handle_list_databases,
            CreateProject.Query: self._handle_create_project,
            CreateDatabase.Query: self._handle_create_database,
            UpdateFile.Query: self._handle_upload_file,
            DownloadFile.Query: self._handle_download_file,
            JoinSession: self._handle_join_session,
            LeaveSession: self._handle_leave_session,
            UpdateLocation: self._handle_update_location,
            InviteToLocation: self._handle_invite_to_location,
            UpdateUserName: self._handle_update_user_name,
            UpdateUserColor: self._handle_update_user_color,
        }

        # Add host and port as a prefix to our logger
        prefix = "%s:%d" % sock.getpeername()
        print("server.py wrap_socket prefix: %s"%prefix)#zj_debug

        class CustomAdapter(logging.LoggerAdapter):
            def process(self, msg, kwargs):
                return "(%s) %s" % (prefix, msg), kwargs

        self._logger = CustomAdapter(self._logger, {})
        self._logger.info("Connected")

    def disconnect(self, err=None, notify=True):
        # Notify other users that we disconnected
        self.parent().reject(self)
        print("server.py ServerClient disconnect self.parent(): %s"%self.parent())#zj_debug
        if self._project and self._database and notify:
            self.parent().forward_users(self, LeaveSession(self.name, False))
        ClientSocket.disconnect(self, err)
        self._logger.info("Disconnected")

    def recv_packet(self, packet):
        if isinstance(packet, Command):
            # Call the corresponding handler
            print("server.py ServerClient recv_packet handlers packet: %s, self: %s"%(packet, self))#zj_debug
            self._handlers[packet.__class__](packet)

        elif isinstance(packet, Event):
            if not self._project or not self._database:
                self._logger.warning(
                    "Received a packet from an unsubscribed client"
                )
                return True

            # Check for de-synchronization
            tick = self.parent().storage.last_tick(
                self._project, self._database
            )
            if tick >= packet.tick:
                self._logger.warning("De-synchronization detected!")
                packet.tick = tick + 1

            # Save the event into the database
            self.parent().storage.insert_event(self, packet)
            # Forward the event to the other users
            self.parent().forward_users(self, packet)

            # Ask for a snapshot of the database if needed
            interval = self.parent().SNAPSHOT_INTERVAL  # /IDArling/idarling/server.py:    server.SNAPSHOT_INTERVAL = args.interval
            if packet.tick and interval and packet.tick % interval == 0:

                def file_downloaded(reply):
                    file_name = "%s_%s.idb" % (self._project, self._database)
                    file_path = self.parent().server_file(file_name)

                    # Write the file to disk
                    with open(file_path, "wb") as output_file:
                        output_file.write(reply.content)
                    self._logger.info("Auto-saved file %s" % file_name)

                d = self.send_packet(
                    DownloadFile.Query(self._project, self._database)
                )
                d.add_callback(file_downloaded)
                d.add_errback(self._logger.exception)
        else:
            return False
        return True

    def _handle_list_projects(self, query):
        projects = self.parent().storage.select_projects()
        self.send_packet(ListProjects.Reply(query, projects))

    def _handle_list_databases(self, query):
        databases = self.parent().storage.select_databases(query.project)
        for database in databases:
            database_info = database.project, database.name
            file_name = "%s_%s.idb" % database_info
            file_path = self.parent().server_file(file_name)
            if os.path.isfile(file_path):
                database.tick = self.parent().storage.last_tick(*database_info)
            else:
                database.tick = -1
        self.send_packet(ListDatabases.Reply(query, databases))

    def _handle_create_project(self, query):
        self.parent().storage.insert_project(query.project)
        self.send_packet(CreateProject.Reply(query))

    def _handle_create_database(self, query):
        self.parent().storage.insert_database(query.database)
        self.send_packet(CreateDatabase.Reply(query))

    def _handle_upload_file(self, query):
        database = self.parent().storage.select_database(
            query.project, query.database
        )
        file_name = "%s_%s.idb" % (database.project, database.name)
        file_path = self.parent().server_file(file_name)

        # Write the file received to disk
        with open(file_path, "wb") as output_file:
            output_file.write(query.content)
        self._logger.info("Saved file %s" % file_name)
        self.send_packet(UpdateFile.Reply(query))

    def _handle_download_file(self, query):
    	print("server.py ServerClient _handle_download_file self: %s, query: %s, self.parent(): %s"%(self, query, self.parent()))#zj_debug
        #self: , query: DownloadFile.Query(project=20190219, command_type=download_file_query, type=command, database=20190219data), self.parent(): 
        print("server.py ServerClient _handle_download_file dir(self): %s"%(dir(self)))#zj_debug
        print("server.py ServerClient _handle_download_file self.__dict__: %s"%(self.__dict__))#zj_debug
        help(self.parent)#zj_debug
        database = self.parent().storage.select_database(
            query.project, query.database
        )
        file_name = "%s_%s.idb" % (database.project, database.name)
        file_path = self.parent().server_file(file_name)

        # Read file from disk and sent it
        print("server.py ServerClient _handle_download_file reply = DownloadFile.Reply(query) start")#zj_debug
        reply = DownloadFile.Reply(query)
        with open(file_path, "rb") as input_file:
            reply.content = input_file.read()
        self._logger.info("Loaded file %s" % file_name)
        print("server.py ServerClient _handle_download_file self.send_packet(reply) start")#zj_debug
        self.send_packet(reply)
        print("server.py ServerClient _handle_download_file self.send_packet(reply) end")#zj_debug

    def _handle_join_session(self, packet):
        self._project = packet.project
        self._database = packet.database
        self._name = packet.name
        self._color = packet.color
        self._ea = packet.ea

        # Inform the other users that we joined
        packet.silent = False
        self.parent().forward_users(self, packet)

        # Inform ourselves about the other users
        for user in self.parent().get_users(self):
            self.send_packet(
                JoinSession(
                    packet.project,
                    packet.database,
                    packet.tick,
                    user.name,
                    user.color,
                    user.ea,
                )
            )

        # Send all missed events
        events = self.parent().storage.select_events(
            self._project, self._database, packet.tick
        )
        self._logger.debug("Sending %d missed events" % len(events))
        for event in events:
            self.send_packet(event)

    def _handle_leave_session(self, packet):
        # Inform others users that we are leaving
        packet.silent = False
        self.parent().forward_users(self, packet)

        # Inform ourselves that the other users leaved
        for user in self.parent().get_users(self):
            self.send_packet(LeaveSession(user.name))

        self._project = None
        self._database = None
        self._name = None
        self._color = None

    def _handle_update_location(self, packet):
        self.parent().forward_users(self, packet)

    def _handle_invite_to_location(self, packet):
        def matches(other):
            return other.name == packet.name or packet.name == "everyone"

        packet.name = self._name
        self.parent().forward_users(self, packet, matches)

    def _handle_update_user_name(self, packet):
        # FXIME: ensure the name isn't already taken
        self._name = packet.new_name
        self.parent().forward_users(self, packet)

    def _handle_update_user_color(self, packet):
        self.parent().forward_users(self, packet)


class Server(ServerSocket):
    """
    This class represents a server socket for the server. It is used by both
    the integrated and dedicated server implementations. It doesn't do much.
    """

    SNAPSHOT_INTERVAL = 0  # ticks

    def __init__(self, logger, parent=None):
        print("server.py Server __init__ parent: %s"%parent)#zj_debug
        ServerSocket.__init__(self, logger, parent)
        self._ssl = None
        self._clients = []

        # Initialize the storage
        self._storage = Storage(self.server_file("database.db"))
        self._storage.initialize()
        print("server.py Server __init__ self._discovery = ClientsDiscovery(logger) start to discover users")#zj_debug
        self._discovery = ClientsDiscovery(logger)

    @property
    def storage(self):
        return self._storage

    @property
    def host(self):
        return self._socket.getsockname()[0]

    @property
    def port(self):
        return self._socket.getsockname()[1]

    def start(self, host, port=0, ssl_=None):
        """Starts the server on the specified host and port."""
        self._logger.info("Starting the server on %s:%d" % (host, port))

        # Load the system certificate chain
        print("server.py Server start ssl_: %s"%ssl_)#zj_debug
        self._ssl = ssl_
        if self._ssl:
            cert, key = self._ssl
            self._ssl = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH)
            self._ssl.load_cert_chain(certfile=cert, keyfile=key)

        # Create, bind and set the socket options
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
        try:
            print("server.py Server start host: %s, port: %s"%(host, port))#zj_debug
            sock.bind((host, port))
        except socket.error as e:
            self._logger.warning("Could not start the server")
            self._logger.exception(e)
            return False
        sock.settimeout(0)  # No timeout
        sock.setblocking(0)  # No blocking
        sock.listen(5)
        self.connect(sock)

        # Start discovering clients
        host, port = sock.getsockname()
        self._discovery.start(host, port, self._ssl)
        return True

    def stop(self):
        """Terminates all the connections and stops the server."""
        self._logger.info("Stopping the server")
        print("server.py Server stop self._discovery.stop() start self._discovery: %s"%self._discovery)#zj_debug
        self._discovery.stop()
        print("server.py Server stop self._discovery.stop() end")#zj_debug
        # Disconnect all clients
        for client in list(self._clients):
            client.disconnect(notify=False)
        self.disconnect()
        return True

    def _accept(self, sock):
        """Called when an user connects."""
        print("server.py Server _accept Called when an user connects")#zj_debug
        client = ServerClient(self._logger, self)  #parent = self "object of Server" , so client.parent() is self

        if self._ssl:
            # Wrap the socket in an SSL tunnel
            sock = self._ssl.wrap_socket(
                sock, server_side=True, do_handshake_on_connect=False
            )

        sock.settimeout(0)  # No timeout
        sock.setblocking(0)  # No blocking
        client.wrap_socket(sock)
        print("server.py Server _accept Called client: %s"%client)#zj_debug
        print("server.py Server _accept before self._clients: %s, self._ssl: %s"%(self._clients, self._ssl))#zj_debug
        self._clients.append(client)
        print("server.py Server _accept after self._clients: %s"%self._clients)#zj_debug

    def reject(self, client):
        """Called when a user disconnects."""
        print("server.py Server reject remove client: %s"%client)#zj_debug
        self._clients.remove(client)

    def get_users(self, client, matches=None):
        """Get the other users on the same database."""
        users = []
        for user in self._clients:
            if (
                user.project != client.project
                or user.database != client.database
            ):
                continue
            if user == client or (matches and not matches(user)):
                continue
            users.append(user)
        return users

    def forward_users(self, client, packet, matches=None):
        """Sends the packet to the other users on the same database."""
        for user in self.get_users(client, matches):
            user.send_packet(packet)

    def server_file(self, filename):
        """Get the absolute path of a local resource."""
        raise NotImplementedError("server_file() not implemented")

active.py

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
import ctypes
from functools import partial
import os
import shutil
import tempfile

import ida_auto
import ida_idaapi
import ida_kernwin
import ida_loader

from PyQt5.QtCore import QCoreApplication, QFileInfo, Qt  # noqa: I202
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QMessageBox, QProgressDialog

from .dialogs import OpenDialog, SaveDialog
from ..shared.commands import DownloadFile, UpdateFile


class Action(object):
    """
    An action is attached to a specific menu, has a custom text, icon, tooltip
    and finally a handler that is called when it is clicked by the user.
    """

    _ACTION_ID = None

    def __init__(self, plugin, menu, text, tooltip, icon, handler):
        super(Action, self).__init__()
        self._plugin = plugin
       
        self._menu = menu
        print("actions.py Action __init__  plugin:  %s, menu:   %s"%(plugin, menu))#zj_debug
        self._text = text
        self._tooltip = tooltip
        self._icon = icon
        self._icon_id = ida_idaapi.BADADDR
        self._handler = handler

    @property
    def handler(self):
        return self._handler

    def install(self):
        action_name = self.__class__.__name__

        # Read and load the icon file
        icon_data = str(open(self._icon, "rb").read())
        print("actions.py install just a test") #zj_debug
        print(self) #zj_debug
        print((icon_data)) #zj_debug
        self._icon_id = ida_kernwin.load_custom_icon(data=icon_data)
        print("actions.py self._icon_id------->"), #zj_debug
        print(self._icon_id) #zj_debug

        # Create the action descriptor
        action_desc = ida_kernwin.action_desc_t(
            self._ACTION_ID,
            self._text,
            self._handler,
            None,
            self._tooltip,
            self._icon_id,
        )

        # Register the action using its descriptor
        result = ida_kernwin.register_action(action_desc)
        if not result:
            raise RuntimeError("Failed to register action %s" % action_name)
        #input("actions.py wait me") #zj_debug
        # Attach the action to the chosen menu
        print("actions.py install self._ACTION_ID:  %s"%self._ACTION_ID)#zj_debug
        result = ida_kernwin.attach_action_to_menu(
            self._menu, self._ACTION_ID, ida_kernwin.SETMENU_APP
        )
        if not result:
            action_name = self.__class__.__name__
            raise RuntimeError("Failed to install action %s" % action_name)

        self._plugin.logger.debug("Installed action %s" % action_name)
        #input("actions.py check the icon is installed in FILE menu") #zj_debug:can not finish the icon install 
        return True

    def uninstall(self):
        action_name = self.__class__.__name__

        # Detach the action from the chosen menu
        result = ida_kernwin.detach_action_from_menu(
            self._menu, self._ACTION_ID
        )
        if not result:
            return False

        # Un-register the action using its id
        result = ida_kernwin.unregister_action(self._ACTION_ID)
        if not result:
            return False

        # Free the custom icon using its id
        ida_kernwin.free_custom_icon(self._icon_id)
        self._icon_id = ida_idaapi.BADADDR

        self._plugin.logger.debug("Uninstalled action %s" % action_name)
        return True

    def update(self):
        """Check if the action should be enabled or not."""
        ida_kernwin.update_action_state(
            self._ACTION_ID, self._handler.update(None)
        )


class ActionHandler(ida_kernwin.action_handler_t):
    """An action handler will display one of the dialogs to the user."""

    _DIALOG = None

    @staticmethod
    def _on_progress(progress, count, total):
        """Called when some progress has been made."""
        print("actions.py class ActionHandler _on_progress---> progress---->"), #zj_debug
        print(progress) #zj_debug
        # progress: 
        progress.setRange(0, total)
        print("actions.py class ActionHandler _on_progress count: %s, total: %s"%(count, total)) #zj_debug
        # _on_progress count: 40788, total: 776282; 40788/776282 * 100 [>>>>>....]
        progress.setValue(count)

    def __init__(self, plugin):
        super(ActionHandler, self).__init__()
        print("actions.py class ActionHandler __init__") #zj_debug
        self._plugin = plugin

    def update(self, ctx):
        """Update the state of the associated action."""
        print("actions.py class ActionHandler update self._plugin.network.connected: %s"%(self._plugin.network.connected)) #zj_debug
        # number? seconds check ? 10s
        if self._plugin.network.connected:
            return ida_kernwin.AST_ENABLE #1
        return ida_kernwin.AST_DISABLE #7

    def activate(self, ctx):
        """Called when the action is clicked by the user."""
        dialog_name = self._DIALOG.__name__
        print("actions.py class ActionHandler activate") #zj_debug
        self._plugin.logger.debug("Showing dialog %s" % dialog_name)
        dialog = self._DIALOG(self._plugin) 
        #dialog:   
        print("actions.py ActionHandler activate self: %s  , dialog:   %s"%(self, dialog))#zj_debug
        dialog.accepted.connect(partial(self._dialog_accepted, dialog))
        dialog.exec_()
        return 1

    def _dialog_accepted(self, dialog):
        """Called when the dialog is accepted by the user."""
        raise NotImplementedError("dialog_accepted() not implemented")


class OpenAction(Action):
    """The "Open from server..." action installed in the "File" menu."""

    _ACTION_ID = "idarling:open"

    def __init__(self, plugin):
        super(OpenAction, self).__init__(
            plugin,
            "File/Open",
            "Open from server...",
            "Load a database from server",
            plugin.plugin_resource("download.png"),
            OpenActionHandler(plugin),
        )
        print("actions.py OpenAction super(....)") #zj_debug


class OpenActionHandler(ActionHandler):
    """The action handler for the "Open from server..." action."""

    _DIALOG = OpenDialog

    def _dialog_accepted(self, dialog):
        project, database = dialog.get_result()
        print("actions.py OpenActionHandler _dialog_accepted project:  %s, database: %s "%(project, database))#zj_debug

        #project:  Project(date=2019/01/28 10:07, type=ELF64 for x86-64 (Executable), hash=f5104295e734c815a92a457de55b656d, name=20190128prj, file=equ)
        #database: Database(project=20190128prj, date=2019/01/28 10:07, tick=6, name=20190128data)
        # Create the download progress dialog
        text = "Downloading database from server, please wait..."
        progress = QProgressDialog(text, "Cancel", 0, 1)
        progress.setCancelButton(None)  # Remove cancel button
        progress.setModal(True)  # Set as a modal dialog
        window_flags = progress.windowFlags()  # Disable close button
        progress.setWindowFlags(window_flags & ~Qt.WindowCloseButtonHint)
        progress.setWindowTitle("Open from server")
        icon_path = self._plugin.plugin_resource("download.png")
        progress.setWindowIcon(QIcon(icon_path))

        # Send a packet to download the file
        packet = DownloadFile.Query(project.name, database.name)
        print("actions.py OpenActionHandler _dialog_accepted packet:  %s"%packet)#zj_debug
        #packet:  DownloadFile.Query(project=20190128prj, database=20190128data)
        callback = partial(self._on_progress, progress)

        def set_download_callback(reply):
        	print("actions.py OpenActionHandler set_download_callback _dialog_accepted reply: %s"%reply)#zj_debug
        	# reply: DownloadFile.Reply() ##class Reply(IReply, Container, Command)
        	reply.downback = callback

        print("actions.py OpenActionHandler _dialog_accepted  self._plugin:%s  , self._plugin.network: %s"%(self._plugin, self._plugin.network))#zj_debug
        d = self._plugin.network.send_packet(packet)
        print("actions.py OpenActionHandler _dialog_accepted d=self._plugin.network.send_packet(packet): %s"%d)#zj_debug
        #d : 
        d.add_initback(set_download_callback)
        d.add_callback(partial(self._file_downloaded, database, progress))
        print("actions.py OpenActionHandler _dialog_accepted database: %s, progress: %s"%(database, progress))#zj_debug
        #progress: 
        d.add_errback(self._plugin.logger.exception)
        progress.show()

    def _file_downloaded(self, database, progress, reply):
        """Called when the file has been downloaded."""
        #print("actions.py OpenActionHandler _file_downloaded reply.content: %s"%reply.content)#zj_debug
        #with open('.tmp', 'wb') as tmp_fd:#zj_debug
        #	tmp_fd.write(reply.content) #zj_debug
        progress.close()

        # Get the absolute path of the file
        app_path = QCoreApplication.applicationFilePath()
        app_name = QFileInfo(app_path).fileName()
        print("actions.py OpenActionHandler _file_downloaded app_path: %s, app_name: %s"%(app_path, app_name))#zj_debug
        file_ext = "i64" if "64" in app_name else "idb"
        file_name = "%s_%s.%s" % (database.project, database.name, file_ext)
        file_path = self._plugin.user_resource("files", file_name)
        print("actions.py OpenActionHandler _file_downloaded file_path: %s"%file_path)#zj_debug

        # Write the file to disk
        print("actions.py OpenActionHandler _file_downloaded database: %s"%database)#zj_debug
        print("actions.py OpenActionHandler _file_downloaded progress: %s"%progress)#zj_debug
        print("actions.py OpenActionHandler _file_downloaded reply: %s"%reply)#zj_debug
        #reply: DownloadFile.Reply()
        with open(file_path, "wb") as output_file:
            output_file.write(reply.content)
        self._plugin.logger.info("Saved file %s" % file_name)

        # Save the old database
        database = ida_loader.get_path(ida_loader.PATH_TYPE_IDB)
        print("actions.py OpenActionHandler _file_downloaded ida_loader.get_path database: %s"%database)#zj_debug
        print("actions.py OpenActionHandler _file_downloaded id(database): %d"%id(database))#zj_debug
        if database:
        	print("actions.py OpenActionHandler _file_downloaded check (database): %s"%(database)) #zj_debug '' kong
        	ida_loader.save_database(database, ida_loader.DBFL_TEMP)

        # This is a very ugly hack used to open a database into IDA. We don't
        # have any function for this in the SDK, so I sorta hijacked the
        # snapshot functionality in this effect.

        # Get the library to call functions not present in the bindings
        dll = self._plugin.core.get_ida_dll(app_name)
        #dll : 

        # Close the old database using the term_database library function
        old_path = ida_loader.get_path(ida_loader.PATH_TYPE_IDB)
        if old_path:
        	print("actions.py OpenActionHandler _file_downloaded check (old_path): %s"%(old_path)) #zj_debug ''
        	dll.term_database()

        # Open the new database using the init_database library function
        # This call only won't be enough because the user interface won't
        # be initialized, this is why the snapshot functionality is used for
        args = [app_name, file_path]
        print("actions.py OpenActionHandler _file_downloaded args: %s"%args)#zj_debug
        argc = len(args)
        argv = (ctypes.POINTER(ctypes.c_char) * (argc + 1))()
        print("actions.py OpenActionHandler _file_downloaded argv: %s"%argv)#zj_debug
        for i, arg in enumerate(args):
            arg = arg.encode("utf-8")
            argv[i] = ctypes.create_string_buffer(arg)

        v = ctypes.c_int(0)
        av = ctypes.addressof(v)
        pv = ctypes.cast(av, ctypes.POINTER(ctypes.c_int))
        dll.init_database(argc, argv, pv)

        # Create a temporary copy of the new database because we cannot use
        # the snapshot functionality to restore the currently opened database
        file_ext = ".i64" if "64" in app_name else ".idb"
        tmp_file, tmp_path = tempfile.mkstemp(suffix=file_ext)
        shutil.copyfile(file_path, tmp_path) #copyfile(src, dst)

        # This hook is used to delete the temporary database when all done
        class UIHooks(ida_kernwin.UI_Hooks):
            def database_inited(self, is_new_database, idc_script):
                self.unhook()

                os.close(tmp_file)
                if os.path.exists(tmp_path):
                    os.remove(tmp_path)

        hooks = UIHooks()
        hooks.hook()

        # Call the restore_database_snapshot library function
        # This will initialize the user interface, completing the process
        s = ida_loader.snapshot_t()
        s.filename = tmp_path  # Use the temporary database
        ida_kernwin.restore_database_snapshot(s, None, None)


class SaveAction(Action):
    """The "Save to server..." action installed in the "File" menu."""

    _ACTION_ID = "idarling:save"

    def __init__(self, plugin):
        super(SaveAction, self).__init__(
            plugin,
            "File/Save",
            "Save to server...",
            "Save a database to server",
            plugin.plugin_resource("upload.png"),
            SaveActionHandler(plugin),
        )


class SaveActionHandler(ActionHandler):
    """The action handler for the "Save to server..." action."""

    _DIALOG = SaveDialog

    @staticmethod
    def upload_file(plugin, packet):
        # Save the current database
        plugin.core.save_netnode()
        input_path = ida_loader.get_path(ida_loader.PATH_TYPE_IDB)
        ida_loader.save_database(input_path, 0)

        with open(input_path, "rb") as input_file:
            packet.content = input_file.read()
            print("actions.py SaveActionHandler upload_file packet.content[:100]: %s"%packet.content[:100])#zj_debug

        # Create the upload progress dialog
        text = "Uploading database to server, please wait..."
        progress = QProgressDialog(text, "Cancel", 0, 1)
        progress.setCancelButton(None)  # Remove cancel button
        progress.setModal(True)  # Set as a modal dialog
        window_flags = progress.windowFlags()  # Disable close button
        progress.setWindowFlags(window_flags & ~Qt.WindowCloseButtonHint)
        progress.setWindowTitle("Save to server")
        icon_path = plugin.plugin_resource("upload.png")
        progress.setWindowIcon(QIcon(icon_path))

        # Send the packet to upload the file
        packet.upback = partial(SaveActionHandler._on_progress, progress)
        d = plugin.network.send_packet(packet)
        if d:
            d.add_callback(
                partial(SaveActionHandler.file_uploaded, plugin, progress)
            )
            d.add_errback(plugin.logger.exception)
        progress.show()

    @staticmethod
    def file_uploaded(plugin, progress, _):
        progress.close()

        # Show a success dialog
        success = QMessageBox()
        success.setIcon(QMessageBox.Information)
        success.setStandardButtons(QMessageBox.Ok)
        success.setText("Database successfully uploaded!")
        success.setWindowTitle("Save to server")
        icon_path = plugin.plugin_resource("upload.png")
        success.setWindowIcon(QIcon(icon_path))
        success.exec_()

        # Subscribe to the event stream
        plugin.core.join_session()

    def update(self, ctx):
        if not ida_loader.get_path(ida_loader.PATH_TYPE_IDB):
            return ida_kernwin.AST_DISABLE
        if not ida_auto.auto_is_ok():
            return ida_kernwin.AST_DISABLE
        return super(SaveActionHandler, self).update(ctx)

    def _dialog_accepted(self, dialog):
        project, database = dialog.get_result()
        self._plugin.core.project = project.name
        self._plugin.core.database = database.name

        # Create the packet that will hold the file
        packet = UpdateFile.Query(project.name, database.name)
        SaveActionHandler.upload_file(self._plugin, packet)

sockets.py

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
import collections
import errno
import json
import os
import socket
import ssl
import sys

from PyQt5.QtCore import QCoreApplication, QEvent, QObject, QSocketNotifier

from .packets import Container, Packet, PacketDeferred, Query, Reply


class PacketEvent(QEvent):
    """
    This Qt event is fired when a new packet is received by the client,
    urging it to go check the incoming messages queue.
    """

    EVENT_TYPE = QEvent.Type(QEvent.registerEventType())

    def __init__(self):
        super(PacketEvent, self).__init__(PacketEvent.EVENT_TYPE)


class ClientSocket(QObject):
    """
    This class is acts a bridge between a client socket and the Qt event loop.
    By using a QSocketNotifier, we can be notified when some data is ready to
    be read or written on the socket, not requiring an extra thread.
    """

    MAX_DATA_SIZE = 65535

    def __init__(self, logger, parent=None):
        QObject.__init__(self, parent)
        self._logger = logger
        self._socket = None
        self._server = parent and isinstance(parent, ServerSocket)
        print("sockets.py ClientSocket __init__ self._server: %s"%(self._server))#zj_debug

        self._read_buffer = bytearray()
        self._read_notifier = None
        self._read_packet = None

        self._write_buffer = bytearray()
        self._write_cursor = 0
        self._write_notifier = None
        self._write_packet = None

        self._connected = False
        self._outgoing = collections.deque()
        self._incoming = collections.deque()

    @property
    def connected(self):
        """Is the underlying socket connected?"""
        print("sockets.py ClientSocket connected check self._connected: %s"%self._connected)#zj_debug
        return self._connected

    def wrap_socket(self, sock):
        """Sets the underlying socket to use."""
        print("sockets.py ClientSocket wrap_socket sock.fileno(): %s"%(sock.fileno()))#zj_debug
        self._read_notifier = QSocketNotifier(
            sock.fileno(), QSocketNotifier.Read, self
        )
        self._read_notifier.activated.connect(self._notify_read)
        self._read_notifier.setEnabled(True)

        self._write_notifier = QSocketNotifier(
            sock.fileno(), QSocketNotifier.Write, self
        )
        self._write_notifier.activated.connect(self._notify_write)
        self._write_notifier.setEnabled(True)

        self._socket = sock

    def disconnect(self, err=None):
        """Terminates the current connection."""
        if not self._socket:
            return

        self._logger.debug("Disconnected")
        if err:
            self._logger.exception(err)
        self._read_notifier.setEnabled(False)
        self._write_notifier.setEnabled(False)
        try:
            self._socket.shutdown(socket.SHUT_RDWR)
            self._socket.close()
        except socket.error:
            pass
        self._socket = None
        self._connected = False
        print("sockets.py ClientSocket disconnected check self._connected: %s"%self._connected)#zj_debug

    def set_keep_alive(self, cnt, intvl, idle):
        """
        Set the TCP keep-alive of the underlying socket.

        It activates after idle seconds of idleness, sends a keep-alive ping
        once every intvl seconds, and disconnects after `cnt`failed pings.
        """
        # Taken from https://github.com/markokr/skytools/
        print("sockets.py ClientSocket set_keep_alive self._socket: %s"%self._socket)#zj_debug
        tcp_keepcnt = getattr(socket, "TCP_KEEPCNT", None)
        tcp_keepintvl = getattr(socket, "TCP_KEEPINTVL", None)
        tcp_keepidle = getattr(socket, "TCP_KEEPIDLE", None)
        tcp_keepalive = getattr(socket, "TCP_KEEPALIVE", None)
        sio_keeplive_vals = getattr(socket, "SIO_KEEPALIVE_VALS", None)
        if (
            tcp_keepidle is None
            and tcp_keepalive is None
            and sys.platform == "darwin"
        ):
            tcp_keepalive = 0x10

        self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
        if tcp_keepcnt is not None:
            self._socket.setsockopt(socket.IPPROTO_TCP, tcp_keepcnt, cnt)
        if tcp_keepintvl is not None:
            self._socket.setsockopt(socket.IPPROTO_TCP, tcp_keepintvl, intvl)
        if tcp_keepidle is not None:
            self._socket.setsockopt(socket.IPPROTO_TCP, tcp_keepidle, idle)
        elif tcp_keepalive is not None:
            self._socket.setsockopt(socket.IPPROTO_TCP, tcp_keepalive, idle)
        elif sio_keeplive_vals is not None:
            self._socket.ioctl(
                sio_keeplive_vals, (1, idle * 1000, intvl * 1000)
            )

    def _check_socket(self):
        """Check if the connection has been established yet."""
        # Ignore if you're already connected
        if self._connected:
            return True

        # Check if the connection was successful
        ret = self._socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
        print("sockets.py ClientSocket _check_socket ret: %s"%ret)#zj_debug
        if ret != 0 and ret != errno.EINPROGRESS and ret != errno.EWOULDBLOCK:
            self.disconnect(socket.error(ret, os.strerror(ret)))
            return False
        else:
            # Do SSL handshake if needed
            if isinstance(self._socket, ssl.SSLSocket):
                try:
                    self._socket.do_handshake()
                except socket.error as e:
                    if not isinstance(
                        e, ssl.SSLWantReadError
                    ) and not isinstance(e, ssl.SSLWantReadError):
                        self.disconnect(e)
                    return False

            self._connected = True
            print("sockets.py ClientSocket _check_socket self._connected: %s"%self._connected)#zj_debug
            self._logger.debug("Connected")
            return True

    def _notify_read(self):
        """Callback called when some data is ready to be read on the socket."""
        print("sockets.py ClientSocket _notify_read now")#zj_debug
        if not self._check_socket():
            return

        # Read as many bytes as possible
        try:
            data = self._socket.recv(ClientSocket.MAX_DATA_SIZE)
            print("sockets.py ClientSocket _notify_read data_recv: %s, len(data): %s"%(data, len(data)))#zj_debug
            if not data:
                self.disconnect()
                return
        except socket.error as e:
            if (
                e.errno not in (errno.EAGAIN, errno.EWOULDBLOCK)
                and not isinstance(e, ssl.SSLWantReadError)
                and not isinstance(e, ssl.SSLWantWriteError)
            ):
                self.disconnect(e)
            return  # No more data available
        self._read_buffer.extend(data)
        print("sockets.py ClientSocket _notify_read len(self._read_buffer): %s"%len(self._read_buffer))#zj_debug

        # Split the received data on new lines (= packets)
        while True:
            if self._read_packet is None:
                if b"\n" in self._read_buffer:
                    pos = self._read_buffer.index(b"\n")
                    line = self._read_buffer[:pos]
                    print("sockets.py ClientSocket _notify_read len(line): %s"%len(line))#zj_debug
                    self._read_buffer = self._read_buffer[
                        pos + 1 :  # noqa: E203
                    ]

                    print("sockets.py ClientSocket _notify_read pos after len(self._read_buffer): %s"%len(self._read_buffer))#zj_debug
                    # Try to parse the line (= packet)
                    try:
                        print("sockets.py line--->"),#zj_debug
                        print(line) #zj_debug
                        print("sockets.py dct = json.loads~line"),#zj_debug
                        dct = json.loads(line.decode("utf-8"))
                        print(dct) #zj_debug
                        print("sockets.py ClientSocket _notify_read self._server: %s"%(self._server))#zj_debug
                        self._read_packet = Packet.parse_packet(
                            dct, self._server
                        )
                    except Exception as e:
                        msg = "Invalid packet received: %s" % line
                        self._logger.warning(msg)
                        self._logger.exception(e)
                        continue
                else:
                    break  # Not enough data for a packet

            else:
                print("sockets.py ClientSocket _notify_read self._read_packet: %s"%self._read_packet)#zj_debug
                if isinstance(self._read_packet, Container):
                    avail = len(self._read_buffer)
                    print("sockets.py ClientSocket _notify_read avail== len(self._read_buffer): %s"%avail)#zj_debug
                    total = self._read_packet.size
                    print("sockets.py ClientSocket _notify_read total=self._read_packet.size: %s"%total)#zj_debug

                    # Trigger the downback
                    if self._read_packet.downback:
                        print("sockets.py ClientSocket _notify_read self._read_packet.downback: %s"%self._read_packet.downback)#zj_debug
                        self._read_packet.downback(min(avail, total), total)

                    # Read the container's content
                    if avail >= total:
                        self._read_packet.content = self._read_buffer[:total] #$$ when avail=total then we get content
                        print("sockets.py ClientSocket _notify_read len(self._read_packet.content): %s"%len(self._read_packet.content))#zj_debug
                        self._read_buffer = self._read_buffer[total:]
                    else:
                        print("sockets.py ClientSocket _notify_read break while")#zj_debug
                        break  # Not enough data for a packet

                self._incoming.append(self._read_packet) #$$ finish then exec
                self._read_packet = None  #$$ finish then exec

        if self._incoming: ##$$ finish then exec
            print("sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent start")#zj_debug
            QCoreApplication.instance().postEvent(self, PacketEvent())
            print("sockets.py ClientSocket _notify_read QCoreApplication.instance().postEvent end")#zj_debug

    def _notify_write(self):
        """Callback called when some data is ready to written on the socket."""
        print("sockets.py ClientSocket _notify_write now")#zj_debug
        print("sockets.py ClientSocket _notify_write self._write_cursor: %s"%self._write_cursor)#zj_debug
        if not self._check_socket():
            return

        if self._write_cursor >= len(self._write_buffer):
            print("sockets.py ClientSocket _notify_write self._outgoing: %s"%self._outgoing)#zj_debug
            if not self._outgoing:
                return  # No more packets to send
            self._write_packet = self._outgoing.popleft()
            print("sockets.py ClientSocket _notify_write self._write_packet = self._outgoing.popleft(): %s"%self._write_packet)#zj_debug

            # Dump the packet as a line
        #if 1:
            try:
                line = json.dumps(self._write_packet.build_packet())
                print("sockets.py ClientSocket _notify_write line=json.dumps len(line): %s"%len(line))#zj_debug
                line = line.encode("utf-8") + b"\n"
            except Exception as e:
                msg = "Invalid packet being sent: %s" % self._write_packet
                self._logger.warning(msg)
                self._logger.exception(e)
                return

            # Write the container's content
            self._write_buffer = bytearray(line)
            self._write_cursor = 0
            if isinstance(self._write_packet, Container): #upload and download can into
                print("sockets.py ClientSocket self._write_packet.content start")#zj_debug
                data = self._write_packet.content
                self._write_buffer.extend(bytearray(data))
                self._write_packet.size += len(line)
                print("sockets.py ClientSocket _notify_write self._write_packet.size: %s"%self._write_packet.size)#zj_debug

        # Send as many bytes as possible
        try:
            pos = self._write_cursor
            avail = len(self._write_buffer) - pos
            count = min(avail, ClientSocket.MAX_DATA_SIZE)
            data = self._write_buffer[pos : pos + count]  # noqa: E203
            self._write_cursor += self._socket.send(data)
        except socket.error as e:
            if (
                e.errno not in (errno.EAGAIN, errno.EWOULDBLOCK)
                and not isinstance(e, ssl.SSLWantReadError)
                and not isinstance(e, ssl.SSLWantWriteError)
            ):
                self.disconnect(e)
            return  # Can't write anything

        # Trigger the upback
        if (
            isinstance(self._write_packet, Container)
            and self._write_packet.upback
        ):
            self._write_packet.size -= count
            total = len(self._write_packet.content)
            sent = max(total - self._write_packet.size, 0)
            self._write_packet.upback(sent, total)

        if (
            self._write_cursor >= len(self._write_buffer)
            and not self._outgoing
        ):
            self._write_notifier.setEnabled(False)

    def event(self, event):
        """Callback called when a Qt event is fired."""
        print("sockets.py ClientSocket event Qt event is fired event: %s"%event)#zj_debug
        if isinstance(event, PacketEvent):
            self._dispatch()
            print("sockets.py ClientSocket event Qt event accept start")#zj_debug
            event.accept()
            print("sockets.py ClientSocket event Qt event accept end return Ture")#zj_debug
            return True
        else:
            print("sockets.py ClientSocket event Qt event ignore start")#zj_debug
            event.ignore()
            return False

    def _dispatch(self):
        """Callback called when a PacketEvent is received."""
        print("sockets.py ClientSocket _dispatch self._incoming: %s"%self._incoming)#zj_debug
        while self._incoming:
            packet = self._incoming.popleft()
            print("sockets.py ClientSocket _dispatch packet: %s, self: %s"%(packet, self))#zj_debug
            print("sockets.py ClientSocket _dispatch self.__class__.mro() : %s"%(self.__class__.mro()))#zj_debug
            self._logger.debug("Received packet: %s" % packet)

            # Notify for replies
            if isinstance(packet, Reply):
                print("sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback start")#zj_debug
                packet.trigger_callback()
                print("sockets.py ClientSocket _dispatch packet is Reply and packet.trigger_callback end")#zj_debug

            # Otherwise forward to the subclass
            elif not self.recv_packet(packet):
                self._logger.warning("Unhandled packet received: %s" % packet)

    def send_packet(self, packet):
        """Sends a packet the other party."""
        print("sockets.py ClientSocket send_packet packet: %s"%packet)#zj_debug
        if not self._connected:
            self._logger.warning("Sending packet while disconnected")
            return None

        self._logger.debug("Sending packet: %s" % packet)

        # Enqueue the packet
        self._outgoing.append(packet)
        print("sockets.py ClientSocket send_packet self._write_notifier.isEnabled(): %s"%(self._write_notifier.isEnabled()))#zj_debug
        if not self._write_notifier.isEnabled():
            print("sockets.py ClientSocket send_packet self._write_notifier.isEnabled() is False")#zj_debug
            self._write_notifier.setEnabled(True)

        # Queries return a packet deferred
        if isinstance(packet, Query):
            d = PacketDeferred()
            print("sockets.py ClientSocket send_packet start register_callback d: %s"%(d))#zj_debug
            packet.register_callback(d)
            return d
        return None

    def recv_packet(self, packet):
        """Receives a packet from the other party."""
        raise NotImplementedError("recv_packet() not implemented")


class ServerSocket(QObject):
    """
    This class is acts a bridge between a server socket and the Qt event loop.
    See the ClientSocket class for a more detailed explanation.
    """

    def __init__(self, logger, parent=None):
        QObject.__init__(self, parent)
        print("sockets.py ServerSocket __init__ parent: %s"%parent)#zj_debug
        self._logger = logger
        self._socket = None
        self._connected = False
        self._accept_notifier = None

    @property
    def connected(self):
        """Is the underlying socket connected?"""
        print("sockets.py ServerSocket connected check self._connected: %s"%self._connected)#zj_debug
        return self._connected

    def connect(self, sock):
        """Sets the underlying socket to utilize."""
        print("sockets.py ServerSocket connect self: %s"%self)#zj_debug
        self._accept_notifier = QSocketNotifier(
            sock.fileno(), QSocketNotifier.Read, self
        )
        print("sockets.py ServerSocket connect self._accept_notifier.activated.connect(self._notify_accept) start")#zj_debug
        self._accept_notifier.activated.connect(self._notify_accept)
        self._accept_notifier.setEnabled(True)

        print("sockets.py ServerSocket connect sock: %s"%sock)#zj_debug
        self._socket = sock
        self._connected = True

    def disconnect(self, err=None):
        """Terminates the current connection."""
        if not self._socket:
            return
        if err:
            self._logger.warning("Connection lost")
            self._logger.exception(err)
        self._accept_notifier.setEnabled(False)
        try:
            self._socket.close()
        except socket.error:
            pass
        self._socket = None
        self._connected = False

    def _notify_accept(self):
        """Callback called when a client is connecting."""
        print("sockets.py ServerSocket _notify_accept Callback called when a client is connecting.")#zj_debug
        print("sockets.py ServerSocket _notify_accept self._socket: %s"%self._socket)#zj_debug
        while True:
            try:
                sock, address = self._socket.accept()
                print("sockets.py ServerSocket _notify_accept sock: %s, address: %s"%(sock, address))#zj_debug
            except socket.error as e:
                if e.errno in (errno.EAGAIN, errno.EWOULDBLOCK):
                    break
                self.disconnect(e)
                break
            self._accept(sock)

    def _accept(self, socket):
        """Handles the client who newly connected."""
        raise NotImplementedError("accept() is not implemented")


packets.py

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
import collections
import itertools


def with_metaclass(meta, *bases):
    """Python 2 and 3 compatible way to add a meta-class."""

    class Metaclass(type):
        def __new__(cls, name, this_bases, d):
            return meta(name, bases, d)

        @classmethod
        def __prepare__(cls, name, _):
            return meta.__prepare__(name, bases)

    return type.__new__(Metaclass, "temporary_class", (), {})


class Serializable(object):
    """
    This base class for an object than can be serialized. More specifically,
    such objects can be read from and written into a Python dictionary.
    """

    @classmethod
    def new(cls, dct):
        """Creates a new instance of the object."""
        print("packets.py Serializable new cls: %s, dct: %s"%(cls, dct))#zj_debug
        obj = cls.__new__(cls)
        print("packets.py Serializable new obj: %s"%obj)#zj_debug
        object.__init__(obj)
        obj.parse(dct)
        return obj

    def build(self, dct):
        """Writes the object into the dictionary."""
        pass

    def parse(self, dct):
        """Reads the object from the dictionary."""
        pass


class Default(Serializable):
    """This object will be serialized using its attributes dictionary."""

    @staticmethod
    def attrs(dct):
        """
        Get a filtered version of an attributes dictionary. This method
        currently simply removes the private attributes of the object.
        """
        return {
            key: val for key, val in dct.items() if not key.startswith("_")
        }

    def build_default(self, dct):
        """Write the object to the dictionary."""
        dct.update(Default.attrs(self.__dict__))
        print("packets.py Default(Serializable) build_default dct:  %s"%dct)#zj_debug

    def parse_default(self, dct):
        """Read the object from the dictionary."""
        self.__dict__.update(Default.attrs(dct))
        print("packets.py Default(Serializable) parse_default self.__dict__:  %s"%self.__dict__)#zj_debug


class PacketFactory(type):
    """
    A metaclass that is used to register new packet classes as they are being
    defined, and instantiate new packets from their name when necessary.
    """

    _PACKETS = {}

    @staticmethod
    def __new__(mcs, name, bases, attrs):
        """Register a new packet class into the factory."""
        cls = super(PacketFactory, mcs).__new__(mcs, name, bases, attrs)
        print("packets.py PacketFactory __new__ mcs: %s, name: %s, bases: %s, attrs: %s"%(mcs, name, bases, attrs))#zj_debug
        print("packets.py PacketFactory __new__ cls: %s"%cls)#zj_debug
        print("packets.py PacketFactory __new__ type(cls): %s"%type(cls))#zj_debug
        print("packets.py PacketFactory __new__ cls.__type__: %s"%cls.__type__)#zj_debug
        if (
            cls.__type__ is not None
            and cls.__type__ not in PacketFactory._PACKETS
        ):
            PacketFactory._PACKETS[cls.__type__] = cls
            print("packets.py PacketFactory._PACKETS--->"),#zj_debug
            print(PacketFactory._PACKETS)#zj_debug
        return cls

    @classmethod
    def get_class(mcs, dct, server=False):  # noqa: N804
        """
        Instantiate the packet corresponding to the serialized dictionary. It
        will check if the packet type is registered, the deferred the
        request to the specialized packet factory.
        """
        cls = PacketFactory._PACKETS[dct["type"]]
        print("packets.py PacketFactory(type) get_class mcs: %s, cls: %s, dct['type']: %s"%(mcs ,cls, dct["type"]))#zj_debug
        if type(cls) != mcs:
            cls = type(cls).get_class(dct, server)
        return cls


class Packet(with_metaclass(PacketFactory, Serializable)):
    """
    The base class for every packet received. Currently, the packet can
    only be of two kinds: either it is an event or a command.
    """

    __type__ = None

    def __init__(self):
    	print("packets.py Packet __init__ self: %s"%self)#zj_debug
    	print("packets.py Packet __init__ super(Packet, self).__init__() start")#zj_debug
        super(Packet, self).__init__()
        print("packets.py Packet __init__ super(Packet, self).__init__() end")#zj_debug
        assert self.__type__ is not None, "__type__ not implemented"

    @staticmethod
    def parse_packet(dct, server=False):
        """Parse the packet from a dictionary."""
        cls = PacketFactory.get_class(dct, server)
        packet = cls.new(dct)
        if isinstance(packet, Reply):
        	print("packets.py Packet parse_packet packet isinstance Reply : cls: %s, packet: %s"%(cls, packet))#zj_debug
        	packet.trigger_initback()
        return packet

    def build_packet(self):
        """Build the packet into a dictionary."""
        print("packets.py Packet build_packet self: %s"%self)#zj_debug
        dct = collections.defaultdict(collections.defaultdict)
        print("packets.py Packet build_packet self.build start dct: %s"%dct)#zj_debug
        self.build(dct)
        return dct

    def __repr__(self):
        """
        Return a textual representation of a packet. Currently, it is only
        used to pretty-print the packet contents into the console.
        """
        name = self.__class__.__name__
        if isinstance(self, Query) or isinstance(self, Reply):
            name = self.__parent__.__name__ + "." + name
        attrs = [
            u"{}={}".format(k, v)
            for k, v in Default.attrs(self.__dict__).items()
        ]
        return u"{}({})".format(name, u", ".join(attrs))


class PacketDeferred(object):
    """
    An Twisted-like deferred object that supports a standard callback, as well
    as a new callback triggered when the expected packet is being instantiated.
    """

    def __init__(self):
        print("packets.py PacketDeferred(object) __init__ self: %s"%self)#zj_debug
        super(PacketDeferred, self).__init__()
        self._errback = None

        self._callback = None
        self._callresult = None
        self._called = False

        self._initback = None
        self._initresult = None
        self._inited = False

    def add_callback(self, callback):
        """Register a callback for this deferred."""
        self._callback = callback
        print("packets.py PacketDeferred(object) add_callback callback: %s"%callback)#zj_debug
        print("packets.py PacketDeferred(object) add_callback self._called??: %s"%self._called)#zj_debug
        if self._called:
            self._run_callback()
        return self

    def add_errback(self, errback):
        """Register an errback for this deferred."""
        print("packets.py PacketDeferred(object) add_errback errback: %s"%errback)#zj_debug
        self._errback = errback
        return self

    def add_initback(self, initback):
        """Register an initback for this deferred."""
        print("packets.py PacketDeferred(object) add_initback initback: %s"%initback)#zj_debug
        self._initback = initback
        print("packets.py PacketDeferred(object) add_initback self._inited?: %s"%self._inited)#zj_debug
        if self._inited:
        	print("packets.py PacketDeferred(object) add_initback self._inited True here")#zj_debug
        	self._run_initback()
        return self

    def callback(self, result):
        """Trigger the callback function."""
        print("packets.py PacketDeferred(object) callback result: %s"%result)#zj_debug
        if self._called:
            raise RuntimeError("Callback already triggered")
        self._called = True
        self._callresult = result
        self._run_callback()

    def initback(self, result):
        """Trigger the initback function."""
        print("packets.py PacketDeferred(object) initback result: %s"%result)#zj_debug
        if self._inited:
            raise RuntimeError("Initback already triggered")
        self._inited = True
        self._initresult = result
        self._run_initback()

    def _run_callback(self):
        """Internal method that calls the callback/errback function."""
        if self._callback:
            try:
            	print("packets.py PacketDeferred(object) _run_callback self: %s"%self)#zj_debug
            	print("packets.py PacketDeferred(object) _run_callback self._callback: %s,self._callresult: %s"%(self._callback, self._callresult))#zj_debug
                self._callback(self._callresult)
            except Exception as e:
                self._errback(e)

    def _run_initback(self):
        """Internal method that call the initback/errback function."""
        if self._initback:
            try:
            	print("packets.py PacketDeferred(object) _run_initback self: %s"%self)#zj_debug
            	print("packets.py PacketDeferred(object) _run_initback self._initback: %s,self._initresult: %s"%(self._initback,self._initresult))#zj_debug
            	#self._initback: ,self._initresult: DownloadFile.Reply() $$
                self._initback(self._initresult) #$$==> reply.downback=callback~~on_progress
            except Exception as e:
                self._errback(e)


class EventFactory(PacketFactory):
    """A packet factory specialized for event packets."""

    _EVENTS = {}

    @staticmethod
    def __new__(mcs, name, bases, attrs):
        cls = super(EventFactory, mcs).__new__(mcs, name, bases, attrs)
        print("packets.py EventFactory __new__ mcs: %s, name: %s, bases: %s, attrs: %s"%(mcs, name, bases, attrs))#zj_debug
        if (
            cls.__event__ is not None
            and cls.__event__ not in EventFactory._EVENTS
        ):
            EventFactory._EVENTS[cls.__event__] = cls
            print("packets.py EventFactory __new__ EventFactory._EVENTS: %s"%EventFactory._EVENTS)#zj_debug
        return cls

    @classmethod
    def get_class(mcs, dct, server=False):  # noqa: N804
        if server:  # Server only knows about DefaultEvent
            return DefaultEvent

        cls = EventFactory._EVENTS[dct["event_type"]]
        if type(cls) != mcs:
            cls = type(cls).get_class(dct, server)
        return cls


class Event(with_metaclass(EventFactory, Packet)):
    """Base class for all events. They have a subtype and a tick count."""

    __type__ = "event"
    __event__ = None

    def __init__(self):
        super(Event, self).__init__()
        print("packets.py Event self.__event__: %s"%self.__event__)#zj_debug
        assert self.__event__ is not None, "__event__ not implemented"
        self._tick = 0

    @property
    def tick(self):
        """Get the tick count."""
        return self._tick

    @tick.setter
    def tick(self, tick):
        """Set the tick count."""
        self._tick = tick

    def build(self, dct):
        dct["type"] = self.__type__
        dct["event_type"] = self.__event__
        dct["tick"] = self._tick
        print("packets.py Event build before dct: %s"%dct)#zj_debug
        self.build_event(dct)
        print("packets.py Event build after dct: %s"%dct)#zj_debug
        return dct

    def parse(self, dct):
        self._tick = dct.pop("tick")
        self.parse_event(dct)
        return self

    def build_event(self, dct):
        """Build the event into a dictionary."""
        pass

    def parse_event(self, dct):
        """Parse the event from a dictionary."""
        pass


class DefaultEvent(Default, Event):
    """
    This is a class that should be subclassed for events that can be serialized
    from their attributes (which should be almost all of them).
    """

    def build_event(self, dct):
    	print("packets.py DefaultEvent build_event before dct: %s"%dct)#zj_debug
        self.build_default(dct)
        print("packets.py DefaultEvent build_event after dct: %s"%dct)#zj_debug

    def parse_event(self, dct):
    	print("packets.py DefaultEvent parse_event before dct: %s"%dct)#zj_debug
    	print("packets.py DefaultEvent parse_event before self.__dict__: %s"%self.__dict__)#zj_debug
        self.parse_default(dct)
        print("packets.py DefaultEvent parse_event after dct: %s"%dct)#zj_debug
        print("packets.py DefaultEvent parse_event after self.__dict__: %s"%self.__dict__)#zj_debug


class CommandFactory(PacketFactory):
    """A packet factory specialized for commands packets."""

    _COMMANDS = {}

    @staticmethod
    def __new__(mcs, name, bases, attrs):
        cls = super(CommandFactory, mcs).__new__(mcs, name, bases, attrs)
        print("packets.py CommandFactory __new__ mcs: %s, name: %s, bases: %s, attrs: %s"%(mcs, name, bases, attrs))#zj_debug
        print("packets.py CommandFactory __new__ cls: %s"%cls)#zj_debug
        if (
            cls.__command__ is not None
            and cls.__command__ not in CommandFactory._COMMANDS
        ):
            # Does this command have a query and a reply
            if issubclass(cls, ParentCommand):
                # Register the query
                cls.Query.__parent__ = cls
                cls.Query.__command__ = cls.__command__ + "_query"
                print("packets.py CommandFactory __new__ cls.Query.__command__ : %s"%cls.Query.__command__)#zj_debug
                CommandFactory._COMMANDS[cls.Query.__command__] = cls.Query
                print("packets.py CommandFactory __new__ cls.Query : %s"%cls.Query)#zj_debug

                # Register the reply
                cls.Reply.__parent__ = cls
                cls.Reply.__command__ = cls.__command__ + "_reply"
                CommandFactory._COMMANDS[cls.Reply.__command__] = cls.Reply
            else:
                CommandFactory._COMMANDS[cls.__command__] = cls
        return cls

    @classmethod
    def get_class(mcs, dct, server=False):  # noqa: N804
        cls = CommandFactory._COMMANDS[dct["command_type"]]
        if type(cls) != mcs:
            cls = type(cls).get_class(dct, server)
        return cls


class Command(with_metaclass(CommandFactory, Packet)):
    """Base class for all commands. Commands have a subtype."""

    __type__ = "command"
    __command__ = None

    def __init__(self):
        super(Command, self).__init__()
        assert self.__command__ is not None, "__command__ not implemented"

    def build(self, dct):
        dct["type"] = self.__type__
        dct["command_type"] = self.__command__
        self.build_command(dct)
        print("packets.py Command dct: %s"%dct)#zj_debug
        return dct

    def parse(self, dct):
        self.parse_command(dct)
        return self

    def build_command(self, dct):
        """Build a command into a dictionary."""
        pass

    def parse_command(self, dct):
        """Parse a command from a dictionary."""
        pass


class DefaultCommand(Default, Command):
    """
    This is a class that should be subclassed for events that can be serialized
    from their attributes (which is way rarer than for events).
    """

    def build_command(self, dct):
        self.build_default(dct)

    def parse_command(self, dct):
        self.parse_default(dct)


class ParentCommand(Command):
    """
    This class is used to define a command that expects an answer. Basically,
    it should subclass this class, and define two instance attributes Query and
    Reply that should themselves subclass packets.Query and packets.Reply.
    """

    __callbacks__ = {}
    Query, Reply = None, None


class Query(Packet):
    """A query is a packet sent that will expect to received a reply."""

    __parent__ = None

    _NEXT_ID = itertools.count()

    def __init__(self):
        super(Query, self).__init__()
        self._id = next(Query._NEXT_ID)
        print("packets.py Query __init__ self._id: %s"%self._id)#zj_debug

    @property
    def id(self):
        """Get the query identifier."""
        return self._id

    def build(self, dct):
        super(Query, self).build(dct)
        dct["__id__"] = self._id
        print("packets.py Query __init__ build self._id: %s, dct: %s"%(self._id, dct))#zj_debug
        return dct

    def parse(self, dct):
        super(Query, self).parse(dct)
        self._id = dct["__id__"]
        print("packets.py Query __init__ parse self._id: %s, dct: %s"%(self._id, dct))#zj_debug
        print("packets.py Query __init__ parse self.__dict__: %s"%(self.__dict__))#zj_debug
        return self

    def register_callback(self, d):
        """Register a callback triggered when the answer is received."""
        self.__parent__.__callbacks__[self._id] = d
        print("packets.py Query register_callback self.__parent__: %s"%self.__parent__)#zj_debug
        # self.__parent__:  for Downfile other maybe different
        print("packets.py Query register_callback self.__parent__.__callbacks__: %s"%self.__parent__.__callbacks__)#zj_debug
        # self.__parent__.__callbacks__: {2: }
        print("packets.py Query register_callback d: %s"%d)#zj_debug


class Reply(Packet):
    """A reply is a packet sent when a query packet is received."""

    __parent__ = None

    def __init__(self, query):
    	print("packets.py Reply __init__  self: %s ,query: %s"%(self, query))#zj_debug
        super(Reply, self).__init__()
        print("packets.py Reply __init__  query.id: %s"%(query.id))#zj_debug
        self._id = query.id

    @property
    def id(self):
        """Get the query identifier."""
        return self._id

    def build(self, dct):
        super(Reply, self).build(dct)
        print("packets.py Reply  build  self._id: %s,dct: %s"%(self._id, dct))#zj_debug
        dct["__id__"] = self._id
        print("packets.py Reply  build self._id: %s, dct: %s"%(self._id, dct))#zj_debug
        return dct

    def parse(self, dct):
        super(Reply, self).parse(dct)
        print("packets.py Reply  parse  dct: %s"%(dct))#zj_debug
        self._id = dct["__id__"]
        print("packets.py Reply  parse self._id: %s, dct: %s"%(self._id, dct))#zj_debug
        return self

    def trigger_callback(self):
        """Trigger the finalization callback of the query."""
        print("packets.py Reply(Packet) trigger_callback self.__parent__.__callbacks__: %s"%self.__parent__.__callbacks__)#zj_debug
        d = self.__parent__.__callbacks__[self._id]
        print("packets.py Reply(Packet) trigger_callback d: %s"%d)#zj_debug
        d.callback(self)
        del self.__parent__.__callbacks__[self._id]

    def trigger_initback(self):
        """Trigger the initialization callback of the query."""
        print("packets.py Reply(Packet) trigger_initback self.__parent__.__callbacks__: %s"%self.__parent__.__callbacks__)#zj_debug
        d = self.__parent__.__callbacks__[self._id]
        print("packets.py Reply(Packet) trigger_initback d: %s, self: %s"%(d, self))#zj_debug
        d.initback(self)


class Container(Command):
    """
    Containers are a special kind of commands that will contain some raw data.
    This is useful for exchanging files as they don't have to be encoded.
    """

    @staticmethod
    def __new__(cls, *args, **kwargs):
    	print("packets.py Container(Command) __new__ cls: %s"%cls)#zj_debug
    	print("packets.py Container(Command) __new__ cls.mro(): %s"%cls.mro())#zj_debug
        self = super(Container, cls).__new__(cls)
        print("packets.py Container(Command) __new__ super end self: %s"%self)#zj_debug
        self._upback = None
        self._downback = None
        return self

    def __init__(self):
        super(Container, self).__init__()
        self._size = 0
        self._content = None
        self._upback = None
        self._downback = None

    @property
    def content(self):
        """Get the raw content."""
        return self._content

    @content.setter
    def content(self, content):
        """Set the raw content."""
        self._content = content
        self._size = len(content)
        print("packets.py Container(Command) content self._size: %s"%self._size)#zj_debug
        print("packets.py Container(Command) content content: %s"%content)#zj_debug

    @property
    def size(self):
        """Get the content size."""
        return self._size

    @size.setter
    def size(self, size):
        """Set the content size."""
        self._size = size

    @property
    def upback(self):
        """Get the upload callback triggered when some data is sent."""
        return self._upback

    @upback.setter
    def upback(self, upback):
        """Set the upload callback triggered when some data is sent."""
        print("packets.py Container(Command) upback upback: %s"%upback)#zj_debug
        self._upback = upback

    @property
    def downback(self):
        """Get the download callback triggered when some data is received."""
        return self._downback

    @downback.setter
    def downback(self, downback):
        """Set the download callback triggered when some data is received."""
        print("packets.py Container(Command) downback self: %s, downback: %s"%(self,downback))#zj_debug
        self._downback = downback

    def build(self, dct):
    	print("packets.py Container(Command) build self: %s, len(self._content): %s"%(self, len(self._content)))#zj_debug
        super(Container, self).build(dct)
        dct["__size__"] = len(self._content)
        return dct

    def parse(self, dct):
    	print("packets.py Container(Command) parse start self: %s, self.__dict__: %s"%(self, self.__dict__))#zj_debug
        self._size = dct["__size__"]
        super(Container, self).parse(dct)
        print("packets.py Container(Command) parse self.__class__.mro(): %s"%self.__class__.mro())#zj_debug
        print("packets.py Container(Command) parse end self: %s, self.__dict__: %s"%(self, self.__dict__))#zj_debug
        return self

你可能感兴趣的:(logger 自用)