agregado funciones adicionales de prueba
y fix diesctor
This commit is contained in:
parent
26d75abd92
commit
cb1177f61a
@ -47,10 +47,19 @@ zk = ZK(args.address, port=args.port, timeout=args.timeout, password=args.passwo
|
|||||||
try:
|
try:
|
||||||
print 'Connecting to device ...'
|
print 'Connecting to device ...'
|
||||||
conn = zk.connect()
|
conn = zk.connect()
|
||||||
|
print 'SDK build=1 :', conn.set_sdk_build_1() # why?
|
||||||
print 'Disabling device ...'
|
print 'Disabling device ...'
|
||||||
conn.disable_device()
|
conn.disable_device()
|
||||||
fmt = conn.get_extend_fmt()
|
fmt = conn.get_extend_fmt()
|
||||||
print 'ExtendFmt : {}'.format(fmt)
|
print 'ExtendFmt : {}'.format(fmt)
|
||||||
|
fmt = conn.get_user_extend_fmt()
|
||||||
|
print 'UsrExtFmt : {}'.format(fmt)
|
||||||
|
print 'Face FunOn : {}'.format(conn.get_face_fun_on())
|
||||||
|
print 'Face Version : {}'.format(conn.get_face_version())
|
||||||
|
print 'Finger Version : {}'.format(conn.get_fp_version())
|
||||||
|
print 'Old Firm compat : {}'.format(conn.get_compat_old_firmware())
|
||||||
|
net = conn.get_network_params()
|
||||||
|
print 'IP:{} mask:{} gateway:{}'.format(net['ip'],net['mask'], net['gateway'])
|
||||||
now = datetime.datetime.today().replace(microsecond=0)
|
now = datetime.datetime.today().replace(microsecond=0)
|
||||||
if args.updatetime:
|
if args.updatetime:
|
||||||
print '--- Updating Time---'
|
print '--- Updating Time---'
|
||||||
@ -59,7 +68,7 @@ try:
|
|||||||
dif = abs(zk_time - now).total_seconds()
|
dif = abs(zk_time - now).total_seconds()
|
||||||
print 'Time : {}'.format(zk_time)
|
print 'Time : {}'.format(zk_time)
|
||||||
if dif > 120:
|
if dif > 120:
|
||||||
print("WRN: TIME IS NOT SYNC!!!!!! (local: %s)" % now)
|
print("WRN: TIME IS NOT SYNC!!!!!! (local: %s) use command -u to update" % now)
|
||||||
print 'Firmware Version : {}'.format(conn.get_firmware_version())
|
print 'Firmware Version : {}'.format(conn.get_firmware_version())
|
||||||
print 'Platform : %s' % conn.get_platform()
|
print 'Platform : %s' % conn.get_platform()
|
||||||
print 'DeviceName : %s' % conn.get_device_name()
|
print 'DeviceName : %s' % conn.get_device_name()
|
||||||
|
25
zk/base.py
25
zk/base.py
@ -442,9 +442,9 @@ class ZK(object):
|
|||||||
|
|
||||||
cmd_response = self.__send_command(command, command_string, response_size)
|
cmd_response = self.__send_command(command, command_string, response_size)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
fmt = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
fmt = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
#definitivo? seleccionar firmware aqui?
|
#definitivo? seleccionar firmware aqui?
|
||||||
return fmt
|
return int(fmt)
|
||||||
else:
|
else:
|
||||||
raise ZKErrorResponse("can't read extend fmt")
|
raise ZKErrorResponse("can't read extend fmt")
|
||||||
|
|
||||||
@ -458,9 +458,9 @@ class ZK(object):
|
|||||||
|
|
||||||
cmd_response = self.__send_command(command, command_string, response_size)
|
cmd_response = self.__send_command(command, command_string, response_size)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
fmt = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
fmt = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
#definitivo? seleccionar firmware aqui?
|
#definitivo? seleccionar firmware aqui?
|
||||||
return fmt
|
return (fmt)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -474,9 +474,9 @@ class ZK(object):
|
|||||||
|
|
||||||
cmd_response = self.__send_command(command, command_string, response_size)
|
cmd_response = self.__send_command(command, command_string, response_size)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
response = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
response = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
#definitivo? seleccionar firmware aqui?
|
#definitivo? seleccionar firmware aqui?
|
||||||
return response
|
return (response)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -490,25 +490,27 @@ class ZK(object):
|
|||||||
|
|
||||||
cmd_response = self.__send_command(command, command_string, response_size)
|
cmd_response = self.__send_command(command, command_string, response_size)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
response = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
response = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
#definitivo? seleccionar firmware aqui?
|
#definitivo? seleccionar firmware aqui?
|
||||||
return response
|
return response
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_network_params(self):
|
def get_network_params(self):
|
||||||
ip = self.__address[0]
|
ip = self.__address[0]
|
||||||
mask = ''
|
mask = ''
|
||||||
gate = ''
|
gate = ''
|
||||||
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'IPAddress', 1024)
|
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'IPAddress', 1024)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
ip = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
ip = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'NetMask', 1024)
|
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'NetMask', 1024)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
mask = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
mask = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'GATEIPAddress', 1024)
|
cmd_response = self.__send_command(const.CMD_OPTIONS_RRQ, 'GATEIPAddress', 1024)
|
||||||
if cmd_response.get('status'):
|
if cmd_response.get('status'):
|
||||||
gate = int(self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
gate = (self.__data_recv[8:].split('=')[-1].split('\x00')[0])
|
||||||
return {'ip': ip, 'mask': mask, 'gateway': gate}
|
return {'ip': ip, 'mask': mask, 'gateway': gate}
|
||||||
|
|
||||||
def get_pin_width(self):
|
def get_pin_width(self):
|
||||||
'''
|
'''
|
||||||
return the serial number
|
return the serial number
|
||||||
@ -964,7 +966,8 @@ class ZK(object):
|
|||||||
command_string = "SDKBuild=1"
|
command_string = "SDKBuild=1"
|
||||||
cmd_response = self.__send_command(command, command_string)
|
cmd_response = self.__send_command(command, command_string)
|
||||||
if not cmd_response.get('status'):
|
if not cmd_response.get('status'):
|
||||||
raise ZKErrorResponse("can't set sdk build ")
|
return False #raise ZKErrorResponse("can't set sdk build ")
|
||||||
|
return True
|
||||||
def enroll_user(self, uid=0, temp_id=0, user_id=''):
|
def enroll_user(self, uid=0, temp_id=0, user_id=''):
|
||||||
'''
|
'''
|
||||||
start enroll user
|
start enroll user
|
||||||
|
5
zk6.lua
5
zk6.lua
@ -512,6 +512,11 @@ function zk.dissector(tvbuf, pktinfo, root)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
dprint2("zk.dissector returning",pktlen)
|
dprint2("zk.dissector returning",pktlen)
|
||||||
|
if rcomands[command] ~= nil then
|
||||||
|
pktinfo.cols.info:set(rcomands[command])
|
||||||
|
else
|
||||||
|
pktinfo.cols.info:set("CMD:" .. tostring(command))
|
||||||
|
end
|
||||||
prevCommand = command
|
prevCommand = command
|
||||||
-- tell wireshark how much of tvbuff we dissected
|
-- tell wireshark how much of tvbuff we dissected
|
||||||
return pktlen
|
return pktlen
|
||||||
|
Loading…
Reference in New Issue
Block a user