-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attendance parser v6.60 returning incorrect values [BUG] #50
Comments
Hi, the only way to do that is with the buffer data to check the parsing. Insert a console.log(reply.toString('hex')) at the beginning of the handle function, and post the result please something like this:
|
5050827d10000000dc05b56ff08102008c040000f0030000 |
@Ali-Shaikh There seems to be a different type of buffer here. It's not the same as the ones that are in the library, so we need to create a new parser for this one. Please re do the download, and send me the buffer again, and algo use a ZKAccess software and send me the attendances data so that I can try to match it to the buffer and find a pattern |
I've a got very similar problem. Sometimes I get buffer index out of range exceptions, sometimes it manages to get data without errors but dates/ids are all messed up. I have a correctly working implementation of this version of attendance parser but it's in PHP and I don't understand it well enough to write it in JS. @mribichich Maybe you want to take a look? |
Yes please send it. And also if you can try to send me a couple of attendances and the buffer, that way it will help me understand the structure a create a new parser. Also could you send all the info from the device: Model, Firmware version with date too, etc. because I have two devices with same 6.60 but different dates |
ZKLibrary.php. If checked correctly it's almost the same as original PHP implementation of ZKLibrary but with changed getAttendance function. I'll send you some example attendances and device info when I get back to work at monday. |
Ok, I'm not sure whether I'm doing this correctly but it seems our device needs ATTDATA_SIZE (zkattendance.js) of size 64 and datetime to be hex-reversed before decoding. I wrote a custom, working parser as an example: const timeParser = require('./timestamp_parser');
module.exports.name = 'custom';
const revHex = inp => {
let o = '';
for (let i = inp.length; i>=0; i-=2) o += inp.substr(i, 2)
return o;
}
module.exports.parse = attdata => {
const raw = attdata.toString('hex').substr(4, 32);
const uid = parseInt(raw.substr(0, 2), 16);
const cid = parseInt(raw.substr(16, 2), 16);
const time = timeParser.decode(parseInt(revHex(raw.substr(8, 8)), 16));
return {uid, cid, time}
} When it comes to the device model... looks like some Chinese no-name. Version method returns incredibly helpful "9". |
Could you use any of the ZK softwares to download that data?
that way is much easier to check the parsing of attendances. both having
the buffer and attendances
And with the ZK soft you can get the model and firmware, so that we can
link them to the new parser
…On Tue, Aug 21, 2018 at 6:24 AM MikuPL ***@***.***> wrote:
Ok, I'm not sure whether I'm doing this correctly but it seems our device
needs ATTDATA_SIZE (zkattendance.js) of size 64 and datetime to be
hex-reversed before decoding. I wrote a custom, working parser as an
example:
const timeParser = require('./timestamp_parser');
module.exports.name = 'custom';
const revHex = inp => {
let o = '';
for (let i = inp.length; i>=0; i-=2) o += inp.substr(i, 2)
return o;
}
module.exports.parse = attdata => {
const raw = attdata.toString('hex').substr(4, 32);
const uid = parseInt(raw.substr(0, 2), 16);
const cid = parseInt(raw.substr(16, 2), 16);
const time = timeParser.decode(parseInt(revHex(raw.substr(8, 8)), 16));
return {uid, cid, time}
}
When it comes to the device model... looks like some Chinese no-name.
Version method returns incredibly helpful "9".
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFe3SoIZ2SMbdFxvfV4lRs13P_Lq-9pZks5uS9HTgaJpZM4VziZu>
.
|
using ZkAccess soft you could get something like this on the Device tab:
[image: image.png]
Something like this on the reports tab:
[image: image.png]
And something like this on the AccessControl tab:
[image: image.png]
With that info and the buffer from our lib, I can check everything, create
tests and add the new parser
You could also use the ZkAccess soft to download attendances, and use
wireshark to sniff the transaction and export the whole data. You could
filter the stream like this:
`ip.addr == 192.168.2.60 && data.len > 0`
and then export it going to: `Analyze -> Follow -> TCP Stream`
show and saved data as: `Raw`
`Right-Click` on data and `Select All` and `Copy`
…On Wed, Aug 22, 2018 at 8:00 PM Matias Ribichich ***@***.***> wrote:
Could you use any of the ZK softwares to download that data?
that way is much easier to check the parsing of attendances. both having
the buffer and attendances
And with the ZK soft you can get the model and firmware, so that we can
link them to the new parser
On Tue, Aug 21, 2018 at 6:24 AM MikuPL ***@***.***> wrote:
> Ok, I'm not sure whether I'm doing this correctly but it seems our device
> needs ATTDATA_SIZE (zkattendance.js) of size 64 and datetime to be
> hex-reversed before decoding. I wrote a custom, working parser as an
> example:
>
> const timeParser = require('./timestamp_parser');
> module.exports.name = 'custom';
> const revHex = inp => {
> let o = '';
> for (let i = inp.length; i>=0; i-=2) o += inp.substr(i, 2)
> return o;
> }
> module.exports.parse = attdata => {
> const raw = attdata.toString('hex').substr(4, 32);
> const uid = parseInt(raw.substr(0, 2), 16);
> const cid = parseInt(raw.substr(16, 2), 16);
> const time = timeParser.decode(parseInt(revHex(raw.substr(8, 8)), 16));
>
> return {uid, cid, time}
> }
>
> When it comes to the device model... looks like some Chinese no-name.
> Version method returns incredibly helpful "9".
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <#50 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/AFe3SoIZ2SMbdFxvfV4lRs13P_Lq-9pZks5uS9HTgaJpZM4VziZu>
> .
>
|
Firmware version: 6.60 Aug 17 2015 Some random buffers:
|
For Reports to work you have to download the Logs from `Devices -> Get
Logs`, that way we can get the real data from attendances, without that I
can't do much, I cant test it. I need buffer data and real attendace data
to much both
And for `AccesControl -> Realtime Monitoring` you have to leave it open so
when someone uses it, it will show up there
…On Thu, Aug 23, 2018 at 9:38 AM MikuPL ***@***.***> wrote:
Firmware version: 6.60 Aug 17 2015
Access control / reports are empty.
Some random buffers:
dd05b4e67b0002000000000015000000ec154f2300000000000000001000000095164f2300000000000000000b000000c1194f2300000000000000000d000000521b4f2300000000000000000d000000521b4f2300000000000000000c0000005c1b4f2300000000000000000c0000005d1b4f2300000000000000001d000000611c4f23000000000000000008000000661c4f23000000000000000009000000051d4f230000000000000000040000007e1e4f230000000000000000040000007f1e4f230000000000000000140000002b1f4f2300000000000000001300000067214f2300000000000000000e0000003c234f23000000000000000020000000be254f2300000000000000000a0000001e294f23000000000000000002000000fb294f230000000000000000170000002f2b4f23000000000000000007000000832d4f2300000000000000001b000000f92d4f2300000000000000001b000000fa2d4f2300000000000000001a00000064394f2300000000000000001a00000066394f23000000000000000006000000064f4f23000000000000000006000000074f4f2300000000000000001600000082824f2300000000000000001600000085824f2301000000000000001600000086824f2301000000000000000b0000007c844f2301000000000000000800000032864f2301000000000000001500000025874f2301000000000000000d0000009e8b4f2301000000000000000d0000009f8b4f2301000000000000000d000000a08b4f2301000000000000000c000000168c4f23010000000000000009000000a08d4f23010000000000000014000000f4914f2301000000000000001e00000049924f2301000000000000000400000062924f2301000000000000000400000063924f2301000000000000001d000000a7924f2301000000000000001d000000a8924f23010000000000000002000000df924f2301000000000000001300000011944f2301000000000000001300000012944f2301000000000000000700000059944f230100000000000000100000006b944f230100000000000000170000006f944f23010000000000000020000000f4954f2301000000000000001b0000000f974f2301000000000000000a000000ec994f2301000000000000001a00000010a74f2301000000000000000e00000025a84f23010000000000000006000000ecd64f23010000000000000016000000856250230000000000000000160000008662502300000000000000001e00000042675023000000000000000015000000446750230000000000000000100000001a69502300000000000000000c000000126a502300000000000000000c000000136a502300000000000000000b000000316b502300000000000000000d000000c96c502300000000
dd057f257c0002000000000014000000406d502300000000000000000a000000816d5023000000000000000009000000176e5023000000000000000004000000117050230000000000000000040000001370502300000000000000001d0000007e70502300000000000000001d0000007f705023000000000000000008000000837050230000000000000000130000002d715023000000000000000020000000e371502300000000000000000e0000009973502300000000000000001b0000007c765023000000000000000017000000527c5023000000000000000007000000bb83502300000000000000001a000000388b50230000000000000000060000008c935023000000000000000002000000c894502300000000000000001a00000005c1502301000000000000001700000009d0502301000000000000000b0000002dd650230100000000000000160000001ad750230100000000000000160000001bd7502301000000000000001500000017d8502301000000000000000c00000092da502301000000000000000d00000031dd502301000000000000000d00000031dd502301000000000000001b000000d5dd502301000000000000000a00000097de50230100000000000000090000009dde5023010000000000000010000000bfde5023010000000000000010000000c0de502301000000000000000e0000004ee2502301000000000000000e0000004fe2502301000000000000002000000098e25023010000000000000004000000e3e25023010000000000000004000000e4e2502301000000000000001300000056e4502301000000000000001e00000067e5502301000000000000001d00000027e750230100000000000000030000005aeb50230000000000000000030000005beb50230000000000000000070000009bec502301000000000000000800000015f0502301000000000000001400000026f4502301000000000000001400000028f4502301000000000000001400000029f45023010000000000000003000000a00d5123010000000000000006000000ea245123010000000000000002000000ec245123010000000000000016000000f7b0512300000000000000001e000000b0b85123000000000000000015000000ceb8512300000000000000001000000021b95123000000000000000009000000dbbc512300000000000000000b00000047bd512300000000000000000b00000048bd512300000000000000000d000000f0be512300000000000000001400000050bf512300000000000000000c0000006fbf512300000000000000000400000056c2512300000000000000001d000000c9c25123000000000000000008000000cec25123000000000000000002000000ebc35123000000000000000020000000eec3512300000000
dd05754d7d0002000000000020000000eec3512300000000000000001b0000006dc8512300000000000000000e00000050ca512300000000000000000e00000051ca5123000000000000000013000000c3cb512300000000000000001700000012cd5123000000000000000007000000e6d1512300000000000000000600000008eb51230000000000000000020000000b0a5223010000000000000016000000ab225223010000000000000016000000ac2252230100000000000000090000004f25522301000000000000001e0000005d275223010000000000000015000000ec2a522301000000000000000e000000ff2e522301000000000000001b0000004e2f522301000000000000000c000000de2f522301000000000000000d000000ec2f52230100000000000000170000004330522301000000000000001700000044305223010000000000000007000000643052230100000000000000070000008030522301000000000000001d000000bd3452230100000000000000140000008e3552230100000000000000140000008f355223010000000000000014000000903552230100000000000000200000009335522301000000000000000b0000006f36522301000000000000000b0000007036522301000000000000001000000092385223010000000000000013000000133b5223010000000000000013000000143b52230100000000000000060000000059522301000000000000000300000009165323000000000000000003000000a7475323010000000000000016000000a5a65523000000000000000016000000a8a6552300000000000000001500000091ac552300000000000000000b00000011b15523000000000000000010000000e2b1552300000000000000002000000054b3552300000000000000000d000000b1b3552300000000000000001d0000002bb455230000000000000000080000002db4552300000000000000001e00000070b45523000000000000000009000000bdb555230000000000000000170000006bb7552300000000000000001a00000021bc552300000000000000001a00000022bc552300000000000000000a00000038c0552300000000000000000a00000039c0552300000000000000000c000000f3c1552300000000000000000e0000006fc2552300000000000000001b00000078c35523000000000000000007000000bec45523000000000000000006000000adda55230000000000000000160000002219562301000000000000001600000022195623010000000000000015000000811e562301000000000000000b0000000020562301000000000000000d000000f42356230100000000000000100000003925562301000000000000001d0000003c2856230100000000000000200000003f28562301000000
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#50 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFe3SoTKIgk3WlqxM2o5OztT_Xry0Hqqks5uTqJPgaJpZM4VziZu>
.
|
same issue i need my firmeware is 4.2 |
RAW TCP Stream: 5050827d08000000e80316fc00000100 Attendance Data:
|
Check my repo , I've already fixed many bugs included these bugs : |
Device Z40
Firmware 6.60
Protocol TCP
I am getting the attendance data but the data is incorrect. Could you please look into this.
[{"id":25356,"uid":null,"state":105,"timestamp":"2054-12-17T05:04:58.000Z","verificationType":105,"inOutStatus":74}
The text was updated successfully, but these errors were encountered: