fananimi / pyzk

Unofficial library of zkteco fingerprint attendance machine
GNU General Public License v2.0
489 stars 319 forks source link

Connection Failure with ZKTeco F16 Device Across All Protocols #204

Closed yassine-fy94 closed 7 months ago

yassine-fy94 commented 7 months ago

The script basic_test.py is unable to establish a connection with the ZKTeco F16 biometric device. Despite successful ping responses and the standard port being open, no script is able to connect to the device or retrieve information using any protocol, including both UDP and TCP. This issue persists across various connection attempts and scripts, pointing towards a potential bug in the connection handling or device recognition process.

ip : 192.168.1.201 port : 4370 timeout : 20

To Reproduce Steps to reproduce the behavior:

  1. Ensure the device is correctly powered and connected to the network and is reachable by both ping and using the zkaccess software 3.5 security system.
  2. Confirm network accessibility by pinging the device's IP address. The device responds to ping commands, indicating network visibility.
  3. Attempt to connect to the device using a standard script (e.g., a get-info script) over TCP/UDP.
  4. Observe that the script fails to connect to the device. No data is retrieved, and the connection is not established, despite the standard port being open and accessible.

Expected behavior The expected behavior is for the script to successfully connect to the ZKTeco F16 device over the specified protocol (TCP/UDP) when the device is online, the port is open, and the network is configured correctly. Data retrieval or command execution should proceed without errors.

Capture Data

System (please complete the following information):

Additional context

Please provide any further insights or observations that might help us in the resolution of this connection failure issue with the ZKTeco F16 device.

Verbose while executing basic_test.py by adding this code to get more information :

except : exc_info = sys.exc_info() print(json.dumps({'connexion':'no' ,'erreur':'except','message':''.join(traceback.format_exception(*exc_info))}))

Connecting to device ...

{"connexion": "no", "erreur": "except", "message": "Traceback (most recent call last):\n File \"C:\pyzk\zk\base.py\", line 257, in send_command\n self.__data_recv = self.sock.recv(response_size)\n \nTimeoutError: timed out\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"C:\FAR\pyzk\basic_test.py\", line 14, in \n conn = zk.connect()\n \n File \"C:\pyzk\zk\base.py\", line 373, in connect\n cmd_response = self.send_command(const.CMD_CONNECT)\n
\n File \"C:\pyzk\zk\base.py\", line 260, in
send_command\n raise ZKNetworkError(str(e))\nzk.exception.ZKNetworkError: timed out\n"} Capture d'écran 2024-01-22 103437

yassine-fy94 commented 7 months ago

Firmware Version : Ver 6.64.0013 Oct 16 2018

kurenai-ryu commented 7 months ago

uh oh, I gave an answer on my fork... but try posting the results here for visibility

yassine-fy94 commented 7 months ago

Thank you for your response i did exactly as you asked, by using ZK access 3.5 and capturing a comminication with wireshark : My Ip : 10.2.1.222 F16 IP : 10.2.1.160 F16 PORT : 4370 Attached are the wireshark capture file while getting attendance data, and a video that shows what we did. get_attendance.zip

Uploading zkaccess35-security-system-2024-01-22-13-46-29_OcLTAaeE.mp4…

yassine-fy94 commented 7 months ago

Capture d'écran 2024-01-22 135539 Capture d'écran 2024-01-22 135556

yassine-fy94 commented 7 months ago

The images complete the video. Thank you.