Created
May 3, 2017 21:19
-
-
Save samuelsonbrito/abb36de4190eb9caf039d658982b8597 to your computer and use it in GitHub Desktop.
Leitor Biométrico CIS com Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import ctypes | |
| FAKE = 0 #NÃO DETECTAR DEDO FALSO | |
| #FAKE = 1; #DETECTAR DEDO FALSO | |
| try: | |
| sdk = ctypes.cdll.LoadLibrary('/usr/lib/libcis_sdk.so') | |
| except: | |
| print("Falha ao importar bibliotecas.") | |
| sys.exit() | |
| r = sdk.CIS_SDK_Biometrico_Iniciar(FAKE) | |
| if(r != 1): | |
| print("ERRO ",r) | |
| sys.exit() | |
| print("Lendo digital: ") | |
| amostra = bytes(b'\x00')*669 | |
| r = sdk.CIS_SDK_Biometrico_LerDigital(amostra) | |
| if(r!=1): | |
| print("ERRO: "+r) | |
| else: | |
| print("Leitura efetuada") | |
| print("------------------------\n") | |
| try: | |
| #RECUPERA DIGITAL CADASTRADA | |
| file = open("NOME.tpl","rb") | |
| print("COMPARANDO DIGITAL...") | |
| tpl = file.read() | |
| file.close() | |
| r = sdk.CIS_SDK_Biometrico_CompararDigital(amostra,tpl) | |
| if(r != 1): | |
| print("Digital não cadastrada") | |
| else: | |
| print("Digital encontrada com sucesso") | |
| except: | |
| #CADASTRA A DIGITAL | |
| print("CADASTRANDO DIGITAL...") | |
| tpl1 = open("NOME.tpl","wb") | |
| tpl1.write(amostra) | |
| tpl1.close() | |
| sdk.CIS_SDK_Biometrico_Finalizar() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@andremartins746 você precisa das libs.