fananimi / pyzk

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

[Q&A] ZKTECO MB20-VL/ID device can ping and telnet port well but can't connect using 'zk.connect()' #169

Closed duong77476-viindoo closed 1 year ago

duong77476-viindoo commented 1 year ago

Hi, i wonder have anyone in my case that my zkteco device (MB20-VL/ID), i can ping it well on cmd and also can telnet the port, i have no firewall. But when zk.connect() it always time out. What can possibly the reason here?, Maybe my internet have problem or something i dont know?

kurenai-ryu commented 1 year ago

probably an incompatible device. if you havw tested with the official software (zktime) include a pcap capture of the communication, also include a pcap and a verbose output for the zk.connect to compare.

reopen if needed.

duong77476-viindoo commented 1 year ago

probably an incompatible device. if you havw tested with the official software (zktime) include a pcap capture of the communication, also include a pcap and a verbose output for the zk.connect to compare.

reopen if needed.

Thank for the advice, does zkteco mb20 vs zkteco mb20-VL different? zkteco mb20 using zk.connect is fine but zkteco mb20-VL does not

kurenai-ryu commented 1 year ago

another thing to check is if the device hss a communication password, by default it tries with password 0. anyway if it has a different firmware version, it could mean that the other device is incompatible

duong77476-viindoo commented 1 year ago

another thing to check is if the device hss a communication password, by default it tries with password 0. anyway if it has a different firmware version, it could mean that the other device is incompatible

Thank you, i appreciate. I just to ask one more thing cause you are one of the contributor to this repo, Can you explain me, i dont understand https://github.com/fananimi/pyzk/blob/66006e7d3f4d61638aab4ce61035823e7f530d7c/zk/base.py#L664-L674 . im debugging another case which relate to this code

kurenai-ryu commented 1 year ago

the read_sizes sends a command that returns a data structure with the sizes of each type of memory. we use this function extensively to determine the data structure and records sizes.

there's an existing bug that newer firmwares seems to have a different command or structure, so this function returns 0s breaking the rest of the code. if you have that issue, please compare the structure with the values reported by zktime, and capture the response with wireshark to determine the new command or the new structure to read the memory sizes

duong77476-viindoo commented 1 year ago

the read_sizes sends a command that returns a data structure with the sizes of each type of memory. we use this function extensively to determine the data structure and records sizes.

there's an existing bug that newer firmwares seems to have a different command or structure, so this function returns 0s breaking the rest of the code. if you have that issue, please compare the structure with the values reported by zktime, and capture the response with wireshark to determine the new command or the new structure to read the memory sizes

Thank, i have an issue here https://github.com/fananimi/pyzk/issues/170 , the thing is in the line self.records = fields[8] always return 0 although it have attendance data on the machine

duong77476-viindoo commented 1 year ago

the read_sizes sends a command that returns a data structure with the sizes of each type of memory. we use this function extensively to determine the data structure and records sizes.

there's an existing bug that newer firmwares seems to have a different command or structure, so this function returns 0s breaking the rest of the code. if you have that issue, please compare the structure with the values reported by zktime, and capture the response with wireshark to determine the new command or the new structure to read the memory sizes

This is output for the read_size() method on SpeedFace H5L[P] with Firmware Ver 6.60 May 13 (0, 0, 0, 0, 97, 0, 95, 0, 0, 0, 726, 0, 0, 2, 6000, 10000, 200000, 5905, 9903, 200000) and this is the one for same machine with Firmware Ver 6.60 Sep 07 (0, 0, 0, 0, 3, 0, 2, 0, 23, 0, 176, 0, 0, 0, 6000, 10000, 200000, 5998, 9997, 199977) . How can i manage to view the structure reported by zktime (i try on test zktime but on the test website seem not working, i can only add device and nothing else on the test enviroment) if not using the zktime, are there anyway to see new structure to determine command and new structure

kurenai-ryu commented 1 year ago

use or get the oldr versions, without an official zk we don't have any way to test

also you didnt mention what is the number of records expected

duong77476-viindoo commented 1 year ago

use or get the oldr versions, without an official zk we don't have any way to test

also you didnt mention what is the number of records expected

The expected record is propably about a few thousand but the user and fingerprint data is correct as i have checked on the machine . Because the machine is from my client i can not know exactly the number of records , wish i could give the credentials of the machine to you to test but it too risky for me. The problem is why the newer firmware version (Sep 7 > May 13) just a few month ahead work well for all the method while the older one is not

kurenai-ryu commented 1 year ago

don't forget that pyzk is an unofficial library, so don't expect to support all devices and firmwares.

try getting the older zkaccess software, again, without a way to get the communication and the correct value, there is nothing else to do.

duong77476-viindoo commented 1 year ago

zkaccess software

I know, if both device of same name won't run, i wouldn't open this kind of issue. Do you have a link to download zkaccess software i can find any, im using ubuntu. thanks a lot for your help.

kurenai-ryu commented 1 year ago

I think this one should be in English link but me too I'm using linux so you'll need a VM to test it

duong77476-viindoo commented 1 year ago

@kurenai-ryu I think maybe the problem is not about the device MB20-VL/ID, it is rather about how you configure the IP-V4 address to be communicated with 2 devices. So here my client did not know to configure Port Forwarding Rule on Modem, so when check port on ping.eu it is always close, so it no way that device can be connected, after my technical team succeeded in configure Port Forwarding Rule on modem, the device connected and work normally

duong77476-viindoo commented 1 year ago

@kurenai-ryu Can i ask you something through email, i wonder is there any method that help me retrieve punch state or punch code like 0 for check-in and 1 for check out

PythonArity commented 1 year ago

Hi, i wonder have anyone in my case that my zkteco device (MB20-VL/ID), i can ping it well on cmd and also can telnet the port, i have no firewall. But when zk.connect() it always time out. What can possibly the reason here?, Maybe my internet have problem or something i dont know?

Hi what is the solution can you explain please

duong77476-viindoo commented 1 year ago

Hi, i wonder have anyone in my case that my zkteco device (MB20-VL/ID), i can ping it well on cmd and also can telnet the port, i have no firewall. But when zk.connect() it always time out. What can possibly the reason here?, Maybe my internet have problem or something i dont know?

Hi what is the solution can you explain please

No the problem always at how you configure port forwarding, just make sure to test on ping,eu

PythonArity commented 1 year ago

yes i get telnet but when i run zk.connect() it always time out

duong77476-viindoo commented 1 year ago

yes i get telnet but when i run zk.connect() it always time out

Have you try nat port, oh i forget in my case the internet using is sim card internet, in that case need to buy a fix sim card in order to have static ipv4 address then you can nat port it

PythonArity commented 1 year ago

Have you try nat port, oh i forget in my case the internet using is sim card internet, in that case need to buy a fix sim card in order to have static ipv4 address then you can nat port it

I am not connecting device from public ip, i have device in same network like 192.168.0.206 and PC is also in same network ip which is 192.168.0.91 so i am getting telnet 192.168.0.206 4370 it goes success, but when i try to fetch users or attendance logs it try for some time and then time out, in this device Zkteco F18/M there are only 3 users registered. can you tell me which ZkTeco Library will work with this device ?

duong77476-viindoo commented 1 year ago

@PythonArity oh i see you in local, please check if your device have password Im positive that this pyzk library work with 90% devices of zkteco platform as my company have test nealy dozen of zkteco device

PythonArity commented 1 year ago

@PythonArity oh i see you in local, please check if your device have password Im positive that this pyzk library work with 90% devices of zkteco platform as my company have test nealy dozen of zkteco device

Let me try, will you please tell what should be password most probably by default ? because we haven't set any password for now, when we press & hold M/OK button it take me into menus.

duong77476-viindoo commented 1 year ago

@PythonArity password is to communicate with the library so you will find it on 'setting'. You can see that in the zk.connect have a parameter call password.