fananimi / pyzk

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

'get_attendance' always 0 with machine ZKteco SpeedSpace-H5L[P] firmware Ver 6.60 May 13 2020 #170

Open duong77476-viindoo opened 1 year ago

duong77476-viindoo commented 1 year ago

Describe the bug get_attendance return [], although have data on the machine SpeedSpace-H5L[P] with firmware version Ver 6.60 May 13 2020

To Reproduce 'get_users' work and finger print too, but can not get the attendance data using get_attendance

Capture Data verbose : verbose.txt pcap: https://drive.google.com/file/d/1soVru8IB8ndvgjlly6gUH-csMrJpoFgX/view?usp=share_link

System (please complete the following information):

Additional context The weird thing is with another version of SpeedSpace-H5L[P] with the firmware version Ver 6.60 Sep 7 2020 is working very good

kurenai-ryu commented 1 year ago

I assume the pcap file is from a zktime communcation example, I see that to the Command: CMD_GET_FREE_SIZES (50) the response is:

0000   5c ea 1d b6 af ed 04 33 89 f3 f9 ce 08 00 45 00   \......3......E.
0010   00 a8 b0 7c 40 00 2c 06 7d 58 bb 8b a2 91 c0 a8   ...|@.,.}X......
0020   01 b6 11 12 c2 18 f0 f0 ac 6b 62 dd 70 a9 50 18   .........kb.p.P.
0030   03 91 fc 63 00 00 50 50 82 7d 78 00 00 00 d0 07   ...c..PP.}x.....
0040   e8 3c f4 f1 14 00 00 00 00 00 00 00 00 00 00 00   .<..............
0050   00 00 00 00 00 00 61 00 00 00 00 00 00 00 5f 00   ......a......._.
0060   00 00 00 00 00 00 00 00 00 00 00 00 00 00 d6 02   ................
0070   00 00 00 00 00 00 00 00 00 00 02 00 00 00 70 17   ..............p.
0080   00 00 10 27 00 00 40 0d 03 00 11 17 00 00 af 26   ...'..@........&
0090   00 00 40 0d 03 00 02 00 00 00 6e 17 00 00 70 17   ..@.......n...p.
00a0   00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00   ................
00b0   00 00 00 00 00 00                                 ......

the response part starts at 0x003E and I parsed it as:

        Command: CMD_ACK_OK (2000)
        CheckSum: 0x3ce8
        ID session: 0xf1f4
        ID Reply: 20
        null #1: 0
        null #2: 0
        null #3: 0
        null #4: 0
        users: 97
        null #5: 0
        fingers: 95
        null #6: 0
        records: 0
        null #7: 0
        null 4096: 726
        null #8: 0
        cards: 0
        null #9: 2
        finger capacity: 6000
        user capacity: 10000
        record capacity: 200000
        finger available: 5905
        user available: 9903
        record available: 200000
        face: 2
        nul #10: 5998
        face capacity: 6000

the ninth position, where the number of attendance records should be stored is currently 0 (00 00 00 00). so, unless you can recognize the actual value inside the rest of the data packet (because you didn't specified any and I'm not a fortune teller) and of course make some tests, (add more records and re-read the data)

also it helps a lot to include more information, or filter the pcap to the IP of the device.

reopen this ticket if needed.

duong77476-viindoo commented 1 year ago

@kurenai-ryu thanks for the further information, yes the pcap file is from the test_machine.py file

i'm just follow the video and not quite understand this very much. The reason i open the issue is my company developed an app in odoo platform using this library and i have this issue with one of my customer.
One again, i appreciate your help, i will try add more info asap.

duong77476-viindoo commented 1 year ago

@kurenai-ryu Hi, you know what, turn out the root cause is my client have set the wrong device type, you see the device SpeedSpace-H5L[P] have 2 mode call Time Attendance and Access Control, if set to Access Control the Attendance data can not be retrive because the data structure of that type is not match so can not get the data, only when set to Time Attendance then we can get the data normally. Anyway thanks for the great assistant for my issue.

kurenai-ryu commented 1 year ago

Really? that sounds interesting, could you describe the process to change modes?

A lot of people has this bug and it could be related to the type of device! if it can be interchangeable it can help them!

duong77476-viindoo commented 1 year ago

@kurenai-ryu Ok first watch this video https://drive.google.com/file/d/1jUmdBLss6SSH5ookZUDvmdzBbYIvdaqN/view?usp=share_link where you can see the two setting option for Device Type with the machine SpeedSpace-H5L[P] (sorry for the poor video quality but still ok right), anyway i dont know exactly which kind of device and version have these setting but i'm petty sure that many new devices have. -When device is set to type Access Control the machine now understand your purpose of using it is to manage control access through some door or gate, etc and now each time user timekeeping then the device will store that as an event which mean the data structure now will not match and not suitable for pyzk to take (if only i can screenshot for you the different but i must return the device to the IT Department) -When device is set to type Time Attendance, then woa la this is the one the appropriate for pyzk to take because now it is the actual attendance record in the machine not event anymore P/S: Some old device may not have the setting that i have said, only some advance and new device, in my case the device is SpeedSpace-H5L[P] which is a touch screen device

duong77476-viindoo commented 1 year ago

To change the mode you will have to be a super admin user in the machine, here is the guide video to change that i have recorded a week ago https://drive.google.com/file/d/1ZoBEAVWHNIESW1NvrvBgW6W8DXNFreg8/view?usp=share_link (Only apply for SpeedSpace-H5L[P], other devices if have that then maybe it is in the setting configuration of the device )

kurenai-ryu commented 1 year ago

thank you very much

duong77476-viindoo commented 1 year ago

thank you very much

You are welcome

kurenai-ryu commented 1 year ago

I'll keep this one open for information only

max3903 commented 3 months ago

Hello,

We have a SpeedFace H5L with firmware ZAM180-NF50VD-Vers-3.3.2.

20240604_134332

There is no Device Type Setting option in the role.

We used the latest version of pyzk from Pypi (version 0.9). We can get the users but not the attendance records.

We tried:

>>> conn = zk.connect()
try auth
>>> fct = 0
>>> ext = 0
>>> command = const.CMD_ATTLOG_RRQ
>>> command_string = pack('<bhii', 1, command, fct, ext)
>>> response_size = 1024
>>> conn._ZK__send_command(1503, command_string, response_size)
{'status': False, 'code': 4989}

We also tried to get the sizes, register an attendance on the device and get the sizes again but nothing changes:

>>> command = const.CMD_GET_FREE_SIZES
>>> response_size = 1024
>>> conn._ZK__send_command(command,b'', response_size)
>>> fields = unpack('20i', conn._ZK__data[:80])
>>> fields
(0, 0, 0, 0, 567, 0, 2, 0, 0, 0, 373, 0, 1, 1, 6000, 10000, 200000, 5998, 9433, 200000)

Can you help us?

duong77476-viindoo commented 3 months ago

Hello,

We have a SpeedFace H5L with firmware ZAM180-NF50VD-Vers-3.3.2.

20240604_134332

There is no Device Type Setting option in the role.

We used the latest version of pyzk from Pypi (version 0.9). We can get the users but not the attendance records.

We tried:

>>> conn = zk.connect()
try auth
>>> fct = 0
>>> ext = 0
>>> command = const.CMD_ATTLOG_RRQ
>>> command_string = pack('<bhii', 1, command, fct, ext)
>>> response_size = 1024
>>> conn._ZK__send_command(1503, command_string, response_size)
{'status': False, 'code': 4989}

We also tried to get the sizes, register an attendance on the device and get the sizes again but nothing changes:

>>> command = const.CMD_GET_FREE_SIZES
>>> response_size = 1024
>>> conn._ZK__send_command(command,b'', response_size)
>>> fields = unpack('20i', conn._ZK__data[:80])
>>> fields
(0, 0, 0, 0, 567, 0, 2, 0, 0, 0, 373, 0, 1, 1, 6000, 10000, 200000, 5998, 9433, 200000)

Can you help us?

Hello does your device display either check in or check out on the screen ? Few month ago one of my client face the same issue and his device doesn't have the option check in or check out. if it not then maybe we should discuss further through my email daiduongnguyen2709@gmai.com

duong77476-viindoo commented 2 months ago

@max3903 Hello maybe you miss our company email asking about machine serial number , can you reply to that ?

max3903 commented 2 months ago

@max3903 Hello maybe you miss our company email asking about machine serial number , can you reply to that ?

We talked to your support. Apparently the speed face H5L is not supported as it is missing an option compared to the H5L [P].

CC: @smaciasosi

duong77476-viindoo commented 2 months ago

@max3903 Hello maybe you miss our company email asking about machine serial number , can you reply to that ?

We talked to your support. Apparently the speed face H5L is not supported as it is missing an option compared to the H5L [P].

CC: @SMaciasOSI

Okay, i ask support to contact because 2 days ago i have contacted with zkteco and they need serial number to confirm that problem, so if you say so then ok to me. Thank you

duong77476-viindoo commented 2 months ago

@max3903 I'm working on it, i will ask my support to mail you if we have information from this . And please remove the serial number message above because it is a top secret information

duong77476-viindoo commented 2 months ago

@max3903 Hello maybe you miss our company email asking about machine serial number , can you reply to that ?

ZHM2234800003

I mean you should delete this message