Open aa-ahmed-aa opened 6 years ago
What's the version of the firmware? Also, did you check the IP address and port? If possible, try to connect the device using official SDK.
i checked the ip and port and they are correct, my firmware version is 4.0.1 when i used the sdk it connect successfully
Ok. Setup wireshark and compare the packet data sent by the official sdk along with this repo(refer to zkconstants). I suspect that there's some difference with the command codes.
This is the packet sent from the official sdk and this is a TCP packet :-
PP.}............PP.}............PP.}....L.......PP.}............Ver 6.60 Jun 16 2015.PP.}............~OS.PP.}............~OS=1.PP.}......-<....~ExtendFmt.PP.}......+.....~ExtendFmt=0.PP.}....../.....ExtendOPLog.PP.}............PP.}......h.....ExtendOPLog.PP.}......d.....PP.}......8.....ExtendOPLog.PP.}......c.....PP.}......7.....ExtendOPLog.PP.}......b.....PP.}......6.....ExtendOPLog.PP.}......a.....PP.}.......... .~Platform.PP.}.......... .~Platform=JZ4725_TFT.PP.}..........
.~ZKFPVersion.PP.}..........
.~ZKFPVersion=10.PP.}
...E.@......(PP.} ........... PP.}.......o....WorkCode.PP.}.......6....WorkCode=1.PP.}
......y..
.~SSR.PP.}......}@..
.~SSR=1.PP.}......x\....~PIN2Width.PP.}......v.....~PIN2Width=9.PP.}............FaceFunOn.PP.}............PP.}.......<....~UserExtFmt.PP.}............~UserExtFmt=0.PP.}....L.......PP.}............Ver 6.60 Jun 16 2015.PP.}............~ZKFPVersion.PP.}............~ZKFPVersion=10.PP.}.......G....~IsOnlyRFMachine.PP.}............~IsOnlyRFMachine=0.PP.}......x.....~OS.PP.}............~OS=1.PP.}......`.........PP.}............PP.}......<.....,...PP.}............PP.}....2. .....PP.}X.....g.............................&.......................................P...............PP.}....2.......PP.}X.....f.............................&.......................................P...............PP.}....2.......PP.}X.....e.............................&.......................................P...............PP.}....2.......PP.}X.....d.............................&.......................................P...............PP.}....2.......PP.}X.....c.............................&.......................................P...............PP.}.......<....~UserExtFmt.PP.}............~UserExtFmt=0.PP.}......b.....PP.}......|.....PP.}......<.....~SerialNumber.PP.}*.....M.....~SerialNumber=OEG6060486051400346.PP.}.......D....~DeviceName.PP.}............~DeviceName=K14.
And the one sent from the zklib package is an empty UDP packet.
I encounter same problem, can't connect to the device though ip and port is correct. I find another repos with zklib -> https://github.com/Codefans-fan/zklib This one can successfully connected, but can't parse anything... Any solution for this? Thank you
So it looks like that Project is using TCP to make connections. A dump of the raw bytes sent over tcp follow:
5050827d08000000e80317fc00000000
5050827d08000000d507f71e33d90000
5050827d080000004c047f2233d90100
5050827d1d000000d0077bce33d9010056657220362e363020417072203236203230313600
5050827d0c0000000b00edd633d902007e4f5300
5050827d0e000000d007f79133d902007e4f533d3100
5050827d130000000b00904333d903007e457874656e64466d7400
5050827d080000008713421333d90300
5050827d140000000b00922433d90400457874656e644f504c6f6700
5050827d080000008713411333d90400
5050827d140000008713151133d90500457874656e644f504c6f6700
5050827d08000000ffffc72633d90500
5050827d14000000ffff9b2433d90600457874656e644f504c6f6700
5050827d08000000ffffc62633d90600
5050827d14000000ffff9a2433d90700457874656e644f504c6f6700
5050827d08000000ffffc52633d90700
5050827d14000000ffff992433d90800457874656e644f504c6f6700
5050827d08000000ffffc42633d90800
5050827d120000000b007c9b33d909007e506c6174666f726d00
5050827d1d000000d00738fe33d909007e506c6174666f726d3d5a4d4d3231305f54465400
5050827d150000000b0054e533d90a007e5a4b465056657273696f6e00
5050827d18000000d00722ac33d90a007e5a4b465056657273696f6e3d313000
5050827d0a0000004500dc1133d90b00a014
5050827d09000000d007e81e33d90b0009
5050827d110000000b00437733d90c00576f726b436f646500
5050827d13000000d007413f33d90c00576f726b436f64653d3000
5050827d0c000000f401cb2433d90d00ffff0000
5050827d08000000d007ef1e33d90d00
The corresponding output from zkMachine is
❯ python zkMachine.py
64535
8831
55021
17296
9362
4373
9371
9370
9369
39804
5050827d120000000b007c9b33d909007e506c6174666f726d00
58708
4572
30531
9419
CMD_ACK_OK
^CTraceback (most recent call last):
File "zkMachine.py", line 24, in <module>
data = zk.zkrecvCurrentAtt() #(uid, time)
File "/Users/xxxx/tmp/zklib/zklib/zklib.py", line 184, in zkrecvCurrentAtt
data = self.zkclient.recv(1024)
KeyboardInterrupt
i have my zk-k14 device accessible via local network and when i tried this code i get false connection