Closed ybsi closed 5 years ago
Hi. Not really. I've only used the one I have. Maybe you could log the response buffer. And you could also try with TCP
Hi, wireshark data:
Frame 149: 50 bytes on wire (400 bits), 50 bytes captured (400 bits) on interface 0
Interface id: 0 (en0)
Interface name: en0
Encapsulation type: Ethernet (1)
Arrival Time: Jul 25, 2018 08:34:12.400455000 AEST
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1532471652.400455000 seconds
[Time delta from previous captured frame: 0.004628000 seconds]
[Time delta from previous displayed frame: 0.010706000 seconds]
[Time since reference or first frame: 31.014424000 seconds]
Frame Number: 149
Frame Length: 50 bytes (400 bits)
Capture Length: 50 bytes (400 bits)
[Frame is marked: False]
[Frame is ignored: False]
[Protocols in frame: eth:ethertype:ip:udp:data]
[Coloring Rule Name: UDP]
[Coloring Rule String: udp]
Ethernet II, Src: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2), Dst: Apple_xx:xx:xx (xx:xx:xx:xx:xx:xx)
Destination: Apple_29:d5:d2 (xx:xx:xx:xx:xx:xx)
Address: Apple_29:d5:d2 (xx:xx:xx:xx:xx:xx)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Source: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2)
Address: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.0.187, Dst: 192.168.0.194
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
0000 00.. = Differentiated Services Codepoint: Default (0)
.... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
Total Length: 36
Identification: 0x0000 (0)
Flags: 0x4000, Don't fragment
0... .... .... .... = Reserved bit: Not set
.1.. .... .... .... = Don't fragment: Set
..0. .... .... .... = More fragments: Not set
...0 0000 0000 0000 = Fragment offset: 0
Time to live: 64
Protocol: UDP (17)
Header checksum: 0xb7fb [validation disabled]
[Header checksum status: Unverified]
Source: 192.168.0.187
Destination: 192.168.0.194
User Datagram Protocol, Src Port: 4370, Dst Port: 5200
Source Port: 4370
Destination Port: 5200
Length: 16
Checksum: 0x579e [unverified]
[Checksum Status: Unverified]
[Stream index: 9]
Data (8 bytes)
Data: d507c798625f0100
[Length: 8]
Unfortunately no luck with TCP:
/Users/cam/nodeJS/xletime/index.js:13
if (err) throw err;
^
Error: Invalid request
at Socket.handleOnData (/Users/cam/nodeJS/xletime/node_modules/zklib/zklib/zklib.js:93:45)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:121:20)
at Socket.emit (events.js:211:7)
at addChunk (_stream_readable.js:263:12)
at readableAddChunk (_stream_readable.js:250:11)
at Socket.Readable.push (_stream_readable.js:208:10)
at TCP.onread (net.js:607:20)
Cheers, Cameron
Do you have a ZK software thats connecting to your device?
you could sniff that with wireshark, and we could see how they communicate and what are the differences
But next time only paste the data field, the other part its not necessary
On Tue, Jul 24, 2018 at 7:56 PM CameronBevan notifications@github.com wrote:
Hi, wireshark data:
Frame 149: 50 bytes on wire (400 bits), 50 bytes captured (400 bits) on interface 0 Interface id: 0 (en0) Interface name: en0 Encapsulation type: Ethernet (1) Arrival Time: Jul 25, 2018 08:34:12.400455000 AEST [Time shift for this packet: 0.000000000 seconds] Epoch Time: 1532471652.400455000 seconds [Time delta from previous captured frame: 0.004628000 seconds] [Time delta from previous displayed frame: 0.010706000 seconds] [Time since reference or first frame: 31.014424000 seconds] Frame Number: 149 Frame Length: 50 bytes (400 bits) Capture Length: 50 bytes (400 bits) [Frame is marked: False] [Frame is ignored: False] [Protocols in frame: eth:ethertype:ip:udp:data] [Coloring Rule Name: UDP] [Coloring Rule String: udp]
Ethernet II, Src: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2), Dst: Apple_xx:xx:xx (xx:xx:xx:xx:xx:xx) Destination: Apple_29:d5:d2 (xx:xx:xx:xx:xx:xx) Address: Apple_29:d5:d2 (xx:xx:xx:xx:xx:xx) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Source: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2) Address: 00:c1:62:01:3c:a2 (00:c1:62:01:3c:a2) .... ..0. .... .... .... .... = LG bit: Globally unique address (factory default) .... ...0 .... .... .... .... = IG bit: Individual address (unicast) Type: IPv4 (0x0800)
Internet Protocol Version 4, Src: 192.168.0.187, Dst: 192.168.0.194 0100 .... = Version: 4 .... 0101 = Header Length: 20 bytes (5) Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT) 0000 00.. = Differentiated Services Codepoint: Default (0) .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0) Total Length: 36 Identification: 0x0000 (0) Flags: 0x4000, Don't fragment 0... .... .... .... = Reserved bit: Not set .1.. .... .... .... = Don't fragment: Set ..0. .... .... .... = More fragments: Not set ...0 0000 0000 0000 = Fragment offset: 0 Time to live: 64 Protocol: UDP (17) Header checksum: 0xb7fb [validation disabled] [Header checksum status: Unverified] Source: 192.168.0.187 Destination: 192.168.0.194
User Datagram Protocol, Src Port: 4370, Dst Port: 5200 Source Port: 4370 Destination Port: 5200 Length: 16 Checksum: 0x579e [unverified] [Checksum Status: Unverified] [Stream index: 9]
Data (8 bytes) Data: d507c798625f0100 [Length: 8]
Unfortunately no luck with TCP:
/Users/cam/nodeJS/xletime/index.js:13 if (err) throw err; ^
Error: Invalid request at Socket.handleOnData (/Users/cam/nodeJS/xletime/node_modules/zklib/zklib/zklib.js:93:45) at Object.onceWrapper (events.js:315:30) at emitOne (events.js:121:20) at Socket.emit (events.js:211:7) at addChunk (_stream_readable.js:263:12) at readableAddChunk (_stream_readable.js:250:11) at Socket.Readable.push (_stream_readable.js:208:10) at TCP.onread (net.js:607:20)
Cheers, Cameron
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bulentv/js_zklib/issues/43#issuecomment-407578225, or mute the thread https://github.com/notifications/unsubscribe-auth/AFe3Sh8nK_-ffa7zD-PA-j1vEMmnfXLcks5uJ6YbgaJpZM4VAMap .
Yes (ZKTimeNet3.0), it only connects with TCP. There were a lot of transmissions, as this software pulls all device information upon connection. Here is the first req & res when adding the device:
req.data: 5050827d08000000e80317fc00000000 res.data: 5050827d08000000d0077b70b4870000
Then a second connection when reading comms info from another tab:
req.data: 5050827d08000000e80317fc00000000 res.data: 5050827d08000000d007866ba98c0000
Running the same function again:
req.data: 5050827d08000000e80317fc00000000 res.data: 5050827d08000000d007a86a878d0000
@CameronBevan I think I found the problem. I'm actually merging it right now.
Could you try again?
If it doesn't work, please uncomment the 86
line on zklib.js
and send me the result
There is no npm new version with this, so please replace the content of the file to check it
Ok thanks, sure thing, I will test this today.
Ok, props:
zklib@0.2.10 files updated manually as per commit: https://github.com/bulentv/js_zklib/commit/9b0ed9061c497541365d5fa9e4813bc80a3aaef2
index.js:
const ZKLib = require('zklib');
ZK = new ZKLib({
ip: '192.168.130.175',
port: 4370,
inport: 5200,
timeout: 5000
});
// connect to access control device
ZK.connect(function(err) {
if (err) throw err;
// read the time info from th device
ZK.getTime(function(err, t) {
// disconnect from the device
ZK.disconnect();
if (err) throw err;
console.log("Device clock's time is " + t.toString());
});
});
Looking good now, just a cb error but the connection worked, terminal result:
$ node index.js
Device clock's time is Tue Aug 21 2018 08:39:51 GMT+1000 (AEST)
/Users/cam/zk-app/node_modules/zklib/zklib/zkconnect.js:40
cb(err);
^
TypeError: cb is not a function
at executeCmd.err (/Users/cam/zk-app/node_modules/zklib/zklib/zkconnect.js:40:7)
at Socket.handleOnData (/Users/cam/zk-app/node_modules/zklib/zklib/zklib.js:95:15)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:131:20)
at Socket.emit (events.js:214:7)
at UDP.onMessage [as onmessage] (dgram.js:659:8)
I think that's enough to close this issue - I'll continue trying everything I can for the U160 this week, cheers
Thats because you didn't provide a cb. either way it should be optional. but I think if you provide a cb , it should be ok then
On Mon, Aug 20, 2018 at 8:00 PM CameronBevan notifications@github.com wrote:
Ok, props:
zklib@0.2.10 files updated manually as per commit: 9b0ed90 https://github.com/bulentv/js_zklib/commit/9b0ed9061c497541365d5fa9e4813bc80a3aaef2
Looking good now, just a cb error but the connection worked, terminal result:
$ node index.js Device clock's time is Tue Aug 21 2018 08:39:51 GMT+1000 (AEST) /Users/cam/zk-app/node_modules/zklib/zklib/zkconnect.js:40 cb(err); ^
TypeError: cb is not a function at executeCmd.err (/Users/cam/zk-app/node_modules/zklib/zklib/zkconnect.js:40:7) at Socket.handleOnData (/Users/cam/zk-app/node_modules/zklib/zklib/zklib.js:95:15) at Object.onceWrapper (events.js:317:30) at emitTwo (events.js:131:20) at Socket.emit (events.js:214:7) at UDP.onMessage [as onmessage] (dgram.js:659:8)
I think that's enough to close this issue - I'll continue trying everything I can for the U160 this week, cheers
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bulentv/js_zklib/issues/43#issuecomment-414491023, or mute the thread https://github.com/notifications/unsubscribe-auth/AFe3SqmWElS18VWY-YESaOv-LzeCGLpNks5uSz9_gaJpZM4VAMap .
@mribichich Hello sir, I have the same this problem. Could you tell me how to provide a cb?
const ZKLib = require('zklib');
ZK = new ZKLib({
ip: '192.168.0.187', // address tested and correct
port: 4370,
inport: 5200,
timeout: 5000
});
// connect to access control device
ZK.connect(function(err) {
if (err) throw err;
// read the time info from th device
ZK.getTime(function(err, t) {
// disconnect from the device
ZK.disconnect();
if (err) throw err;
console.log("Device clock's time is " + t.toString());
});
});
sorry add to the example a callback to the disconnect function:
ZK.disconnect((err) => console.log(err));
One more think, I want to download, upload, restart and enroll fingerPrint templates from fingerprint. The ZKLib can do this and how to do? thank you @mribichich .
no it doesnt do it sorry
On Thu, Sep 20, 2018 at 12:34 AM MessalSV notifications@github.com wrote:
One more think, I want to download templates from fingerprint. The ZKLib can do this and how to do? thank you @mribichich https://github.com/mribichich .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bulentv/js_zklib/issues/43#issuecomment-423029204, or mute the thread https://github.com/notifications/unsubscribe-auth/AFe3SiF76weIdN8vbO7mLNCFt9fgRbNUks5ucwyngaJpZM4VAMap .
Fixed with v0.2.11
Hi, I am unsuccessfully trying to connect a ZKTECO U160, not sure if you have tried this model, maybe you can assist?
Device Info:
Make: ZKTECO Model: U160 Firmware Version: 8.0.1.2-20160414 Bio Service: 2.1.12-20150917 Standalone Service: 2.1.0-20160408 Fingerprint Algorithm: Finger VX10.0 Platform Information: ZMM200_TFT MCU Version: 24
index.js (same as readme):
output:
If we can get it working, let's add it to the list of tested devices :)
Many thanks, Cameron