Ejemplo n.º 1
0
    def __init__(self):
        """

        :rtype:
        """
        try:
            self.sensor = PyFingerprint('/dev/ttyS0', 57600, 0xFFFFFFFF,
                                        0x00000000)

            if not self.sensor.verifyPassword():
                raise ValueError(
                    'The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
            exit(1)
Ejemplo n.º 2
0
def delete(keyid):
    ## Tries to initialize the sensor
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')

    except Exception as e:
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        return 'Sensor Error'

    ## Gets some sensor information
    #print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))

    ## Tries to delete the template of the finger
    try:
        keyid = str(keyid)
        fingerset = {}
        if os.path.exists('dataset_fingers.dat'):
            with open('dataset_fingers.dat', 'rb') as readf:
                fingerset = pickle.load(readf)
        keys = fingerset.keys()
        values = fingerset.values()
        hasFlag = False
        posNo = -1
        for i in range(len(keys)):
            if values[i] == keyid:
                hasFlag = True
                posNo = int(keys[i])
                break
        if hasFlag == False:
            return 'Key Not Present'
        del fingerset[str(posNo)]
        with open('dataset_fingers.dat', 'wb') as writef:
            pickle.dump(fingerset, writef, protocol=pickle.HIGHEST_PROTOCOL)
        if (f.deleteTemplate(posNo) == True):
            print 'Successfully deleted', keyid, 'from the database!'
            return 'Done'

    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        return 'Unknown Error'
Ejemplo n.º 3
0
def Effacer(f):
    opwd = (hashlib.sha256(
        gp("Entrez le password: "******"erreur")
Ejemplo n.º 4
0
def Remover_Digital():
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')
    except Exception as e:
        exit(1)
    try:
        positionNumber = input(
            'Please enter the template position you want to delete: ')
        positionNumber = int(positionNumber)
        if (f.deleteTemplate(positionNumber) == True):
            print('Template deleted!')
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        exit(1)
def configureFingerPrint():
    while True:
        try:
            f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
            if (f.verifyPassword() == False):
                raise ValueError(
                    'The given fingerprint sensor password is wrong!')
                t.sleep(2)

            else:
                break
        except Exception as e:
            #lcdPrint.printExceptionMessage(str(e))
            fileObject.updateExceptionMessage(
                "attendanceFingerPrint{configureFingerPrint}", str(e))
            #t.sleep(1)
            sys.exit()
    return f
Ejemplo n.º 6
0
def Finger_loop():
    ser = Serial()
    try:
        ser = PyFingerprint('/dev/ttyAMA1', 115200, 0xFFFFFFFF, 0x00000000)
        if (ser.verifyPassword() == False):
            raise ValueError(
                'Указан неверный пароль датчика отпечатка пальца!')
    except Exception as e:
        print('Датчик отпечатка пальца не может быть инициализирован!')
        print('Сообщение об исключении: ' + str(e))
        exit(1)
    while True:
        if RunCheckVar("STATUS", "REC"):
            Add_finger(ser)
        elif RunCheckVar("STATUS", "DELETE"):
            Delete_finger(ser)
        else:
            Check_finger(ser)
Ejemplo n.º 7
0
    def searchFinger(self):
        ## Search for a finger
        ## Tries to initialize the sensor
        positionNumber = -1
        try:
            self.scanner = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF,
                                         0x00000000)

            if (self.scanner.verifyPassword() == False):
                raise ValueError(
                    'The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))

        ## Gets some sensor information
        print('Currently used templates: ' +
              str(self.scanner.getTemplateCount()) + '/' +
              str(self.scanner.getStorageCapacity()))

        ## Tries to search the finger and calculate hash
        try:
            print('Waiting for finger...')

            ## Wait that finger is read
            while (self.scanner.readImage() == False):
                pass

            ## Converts read image to characteristics and stores it in charbuffer 1
            self.scanner.convertImage(0x01)

            ## Searchs template
            result = self.scanner.searchTemplate()

            positionNumber = result[0]
            accuracyScore = result[1]

            if (positionNumber == -1):
                return positionNumber
            else:
                return positionNumber
        except:
            return positionNumber
Ejemplo n.º 8
0
def enroll():
    print('start enroll')
    port = config.figerScanPort
    f = PyFingerprint(port, 57600, 0xFFFFFFFF, 0x00000000)

    ## Gets some sensor information
    print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))

    ## Tries to enroll new finger
    try:
        print('Waiting for finger...')
        
        ## Wait that finger is read
        timeout = time.time() + 10
        while ( f.readImage() == False ):
            test = 0
            if test == 5 or time.time() > timeout:
                print('TimeOut')
                return -2 
                break
            test = test - 1
 
        f.convertImage(0x01)

        ## Checks if finger is already enrolled
        result = f.searchTemplate()
        positionNumber = result[0]

        if ( positionNumber >= 0 ):
            print('Template already exists at position #' + str(positionNumber))
            return -1

        f.createTemplate()

        ## Saves template at new position number
        positionNumber = f.storeTemplate()
        print('Finger enrolled successfully!')
        print('New template position #' + str(positionNumber))
        return positionNumber
    
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        return -2
def finger_login():
    try:
        f = PyFingerprint('COM6', 57600, 0xFFFFFFFF, 0x00000000)
        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')

    except Exception as e:
        del f
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        return jsonify(result='-1')
    try:
        print('Waiting for finger...')

        ## Wait that finger is read
        while (f.readImage() == False):
            pass

        ## Converts read image to characteristics and stores it in charbuffer 1
        f.convertImage(0x01)

        ## Searchs template
        result = f.searchTemplate()

        positionNumber = result[0]
        accuracyScore = result[1]
        #del f
        f.__del__()
        if (positionNumber == -1):

            print('No match found!')
            return jsonify(result='-1')

        else:

            print('Found template at position #' + str(positionNumber))
            return jsonify(result=positionNumber)

    except Exception as e:

        print('Operation failed!')
        print('Exception message: ' + str(e))
        return jsonify(result='-1')
Ejemplo n.º 10
0
def finger_verification():
    user_id = session.get('user_id')
    error = None
    db = get_db()
    try:

        f = PyFingerprint('/dev/ttyUSB1', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            raise ValueError('The given password is wrong!')

    except Exception as e:
        print('Not initialized')
        print('Exception:' + str(e))

    try:
        while (f.readImage() == False):
            pass
        f.convertImage(0x01)
        result = f.searchTemplate()
        positionNumber = result[0]
        accuracyScore = result[1]
        if (positionNumber == -1):
            error = 'Finger Print not matched. Try again.'
            flash(error)
            return redirect(url_for('auth.finger_view'))
        else:
            user = db.execute('SELECT * FROM user WHERE user_id =?',
                              (user_id, )).fetchone()
            print(user['finger_id'])
            if user['finger_id'] == positionNumber:
                if user['face_encoding']:
                    return redirect(url_for('auth.face_view'))
                else:
                    return redirect(url_for('auth.balance_view'))
            elif user['finger_id_emergency'] == positionNumber:
                error = "Emergency Protocol Activated"
                flash(error)
                return redirect(url_for('auth.finger_view'))
    except Exception as e:
        error = str(e)
        flash(error)
        return redirect(url_for('auth.finger_view'))
Ejemplo n.º 11
0
def init(device):

    GPIO.setwarnings(False)
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(gpio_RED, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(gpio_GREEN, GPIO.OUT, initial=GPIO.LOW)
    GPIO.setup(gpio_BUZZER, GPIO.OUT, initial=GPIO.LOW)

    baudrate = 57600
    address = 0xFFFFFFFF
    password = 0x00000000
    fsensor = PyFingerprint(device, baudrate, address, password)

    if not fsensor.verifyPassword():
        raise Exception('Sensor\'s password is incorrect.')
    lcd = lcd_i2c_driver.lcd()

    beep(2, 0.05)
    return fsensor, lcd
Ejemplo n.º 12
0
    def initialize_sensor(self):
        ## Tries to initialize the sensor
        print('Fingerprint reader')
        try:
            f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

            if not f.verifyPassword():
                raise ValueError(
                    'The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
            return None

        ## Gets some sensor information
        print('Currently used templates: ' + str(f.getTemplateCount()) + '/' +
              str(f.getStorageCapacity()))
        return f
Ejemplo n.º 13
0
def begin():  # Tries to initialize the sensor
    global Finger
    try:
        # pulled up to avoid false detection.
        # So we'll be setting up falling edge detection
        GPIO.setmode(GPIO.BCM)
        GPIO.setup(TOUCH_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)
        Finger = PyFingerprint(FINGER_PORT, FINGER_BAUDRATE, FINGER_ADDRESS,
                               FINGER_PASSWORD)
        if not Finger.verifyPassword():
            raise ValueError('Password for the Fingerprint module is wrong!')
        # Gets some sensor information
        print('Fingerprint used templates: ' + str(Finger.getTemplateCount()) +
              '/' + str(Finger.getStorageCapacity()))
        return True
    except Exception as e:
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        return False
Ejemplo n.º 14
0
def check():

    ## Tries to search the finger

    try:

        finger = PyFingerprint('/dev/ttyUSB0')

        print('Waiting for finger...')

        ## Wait that finger is read

        while (finger.readImage() == False):

            pass

        ## Converts read image to characteristics and stores it in charbuffer 1

        finger.convertImage(0x01)

        ## Searchs template

        result = finger.searchTemplate()
        print(result)

        positionNumber = result[0]

        #accuracyScore = result[1]

        if (positionNumber == -1):
            print('no match found!')
            return (positionNumber)

        else:
            print('Found template at position #' + str(positionNumber))
            return (positionNumber)

    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        return False
        exit(1)
Ejemplo n.º 15
0
def verify_test():
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if ( f.verifyPassword() == False ):
            raise ValueError('The given fingerprint sensor password is wrong!')

    except Exception as e:
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        exit(1)

    print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))
    time.sleep(0.1)
    try:
        while ( f.readImage() == False ):
            pass
        f.convertImage(0x01)
        result = f.searchTemplate() ## Searchs template
        positionNumber = result[0]
        accuracyScore = result[1]
        temp = positionNumber
        if ( positionNumber == -1 ):
            print('No match found! Try again')
            time.sleep(0.5)
            #login()
        else:
            print('Found template at position #' + str(positionNumber))
            print('The accuracy score is: ' + str(accuracyScore))
            #return 0
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        exit(1)
    
    if ( positionNumber == -1 ):
        print('No match found! Try again....')
        time.sleep(0.5)
        verify_test()
    #else:
    
    return positionNumber
def init_sensor():
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')

    except Exception as e:
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        exit(1)

    used = f.getTemplateCount()  #0,1,2,3 = 4
    print('Currently used templates: ' + str(used) + '/' +
          str(f.getStorageCapacity()))

    if (used > 0):
        del_me(used, f)
    else:
        print("Nothing to be deleted in module!")
Ejemplo n.º 17
0
    def run(self):
        try:
            self.f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

            if ( self.f.verifyPassword() == False ):
                raise ValueError('The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
        
        print('Currently used templates: ' + str(self.f.getTemplateCount()) +'/'+ str(self.f.getStorageCapacity()))

        while True:
            retry = 0
            while True:
                print('Waiting for finger...')
                retry+=1
                try:
                    while (self.f.readImage() == False):
                        #print('looping .readImage()')
                        time.sleep(0.5)
                        
                        pass
                    break
                except Exception as e:
                     print('PyFingerprint:{}, try {} of 3'.format(e, retry))
                     if retry == 3:
                         raise Exception('PyFingerprint: Failed to read image 3 times, exiting.')

                     # delay 2 seconds before next try
                     time.sleep(2)
                
            ## Converts read image to characteristics and stores it in charbuffer 1
            #f.convertImage(0x01)

                ## Searchs template
            #FingerprintThread.template = f.searchTemplate()
            self.app.event_generate('<<FINGERPRINT>>', when='tail')
            self._continue.clear()
            self._continue.wait()
Ejemplo n.º 18
0
 def plugin_init(self,enableplugin=None):
  plugin.PluginProto.plugin_init(self,enableplugin)
  self.taskdevicepluginconfig[0] = str(self.taskdevicepluginconfig[0]).strip()
  self.readinprogress=0
  self.initialized=False
  try:
   if self.initcount > 2:
    self.initcount = 0
    self.enabled = False
  except:
   self.initcount = 0
  if self.valuecount == 1:
    self.vtype = rpieGlobals.SENSOR_TYPE_SINGLE
  elif self.valuecount == 2:
    self.vtype = rpieGlobals.SENSOR_TYPE_DUAL
  elif self.valuecount == 3:
    self.vtype = rpieGlobals.SENSOR_TYPE_TRIPLE
  if self.enabled and self.taskdevicepluginconfig[0]!="" and self.taskdevicepluginconfig[0]!="0":
   time.sleep(0.5)
   try:
    if self.fp is not None:
     self.fp.__del__()
   except:
    pass
   try:
    time.sleep(2)
    self.fp = PyFingerprint(self.taskdevicepluginconfig[0],57600,0xFFFFFFFF,0)
    time.sleep(0.5)
    if self.fp.verifyPassword()==False:
     misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"FPM password wrong")
     self.fp = None
    self.initialized = True
    misc.addLog(rpieGlobals.LOG_LEVEL_INFO,"FPM initialized")
   except Exception as e:
    self.fp = None
    self.initialized = False
    misc.addLog(rpieGlobals.LOG_LEVEL_ERROR,"FPM init error: "+str(e))
   if self.initialized==False:
    self.initcount += 1
    time.sleep(3)
    self.plugin_init()
Ejemplo n.º 19
0
def display():

    ## Reads image and download it
    ##

    ## Tries to initialize the sensor
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')

    except Exception as e:
        print('The fingerprint sensor could not be initialized!')
        print('Exception message: ' + str(e))
        exit(1)

## Gets some sensor information
    print('Currently used templates: ' + str(f.getTemplateCount()) + '/' +
          str(f.getStorageCapacity()))

    ## Tries to read image and download it
    try:
        print('Waiting for finger...')

        ## Wait that finger is read
        while (f.readImage() == False):
            pass

        print('Downloading image (this take a while)...')

        imageDestination = tempfile.gettempdir() + '/fingerprint.bmp'
        f.downloadImage(imageDestination)

        print('The image was saved to "' + imageDestination + '".')
        print('Displaying fingerprint:')
        os.system('eog /tmp/fingerprint.bmp')
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        exit(1)
Ejemplo n.º 20
0
def silme(sil):
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            pass

    except Exception as e:
        pass
    ## Gets some sensor information

    ## Tries to delete the template of the finger
    try:
        positionNumber = sil + 1
        positionNumber = int(positionNumber)

        if (f.deleteTemplate(positionNumber) == True):
            return 4

    except Exception as e:
        pass
    def delete_fid(self, finger_id):
        try:
            f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

            if ( f.verifyPassword() == False ):
                raise ValueError('The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
            exit(1)

        try:
            if ( f.deleteTemplate(finger_id) == True ):
                print('Template deleted!')

        except Exception as e:
            print('Operation failed!')
            print('Exception message: ' + str(e))
            print(traceback.format_exc())
            exit(1)
Ejemplo n.º 22
0
def Adicionar_Digital():
	global sc_bioAdd
	sc_bioAdd = Toplevel(screen2)
	sc_bioAdd.title("Biometria")
	sc_bioAdd.attributes('fullscreen',True)
	Label(sc_bioAdd, text = "bota o dedin aí", font = "Arial 12").pack()
	try:
		f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
		if ( f.verifyPassword() == False ):
			raise ValueError('The given fingerprint sensor password is wrong!')
	except Exception as e:
			exit(1)
	try:
		Label(sc_bioAdd, text = "bota o dedin aí", font = "Arial 12").pack()
		while(f.readImage() == False):
			pass
		f.convertImage(0x01)
		result=f.searchTemplate()
		positionNumber= result[0]
		if (positionNumber >= 0):
			user_not_found()
			exit(0)
			Label(sc_bioAdd, text = "tira o dedin aí", font = "Arial 12").pack()
			time.sleep(2)
			Label(sc_bioAdd, text = "bota o dedin aí denovo", font = "Arial 12").pack()
			while(f.readImage() == False):
				pass
		f.convertImage(0x02)
		if (f.compareCharacteristics() == 0 ):
			raise Exception("Fingers not Match")
			password_not_recognised()
		f.createTemplate()
		positionNumber = f.storeTemplate()
		USR=open(positionNumber+".fin")
		USR.write(usr)
		USR.close
		Cadastrado()
		main_screen()
	except Exception as e:
		exit(1)
Ejemplo n.º 23
0
def Adicionar_Digital():
    global Tela
    Tela = Tk()
    Tela.title('bio')
    Tela.attributes('-fullscreen', True)
    Label(Tela, text='Iniciando...', font='Arial 12').pack()

    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
        if (f.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')
    except Exception as e:
        exit(1)
    Label(Tela, text='Insira o dedo', font="Arial 12").pack()
    try:
        print('botodeda1')
        while (f.readImage() == False):
            pass
        f.convertImage(0x01)
        result = f.searchTemplate()
        positionNumber = result[0]
        if (positionNumber >= 0):
            print('já tem')
            exit(0)
        Label(Tela, text='Remova', font='Arial 12').pack()
        time.sleep(2)
        Label(Tela, text='Insira o mesmo dedo', font="Arial 12").pack()
        while (f.readImage() == False):
            pass
        f.convertImage(0x02)
        if (f.compareCharacteristics() == 0):
            raise Exception('Fingers do not match')
        f.createTemplate()
        print('Finger enrolled successfully!')
        Label(Tela, text='Registrado!!!!!!!!', font='Arial 12').pack()
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        exit(0)
    Tela.mainloop()
Ejemplo n.º 24
0
    def delete(self):
        try:
            f = PyFingerprint(self.com, self.port, 0xFFFFFFFF, 0x00000000)

            if (f.verifyPassword() == False):
                raise ValueError(
                    'The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
            exit(1)

        ## Gets some sensor information
        print('Currently used templates: ' + str(f.getTemplateCount()) + '/' +
              str(f.getStorageCapacity()))

        ## Tries to delete the template of the finger
        try:
            positionNumber = input(
                'Please enter the template position you want to delete: ')
            positionNumber = int(positionNumber)

            if (f.deleteTemplate(positionNumber) == True):
                with open('./data_log.csv',
                          'r') as inp, open('./data_log_edit.csv', 'w') as out:
                    writer = csv.writer(out)
                    rows = csv.DictReader(inp)
                    writer.writerows([['positionnumber'] + ['empolynumber']])
                    for row in rows:
                        if row['positionnumber'] != str(positionNumber):
                            writer.writerow(
                                [row['positionnumber'], row['empolynumber']])
                os.rename('./data_log_edit.csv', './data_log.csv')
                print('Template deleted!')

        except Exception as e:
            print('Operation failed!')
            print('Exception message: ' + str(e))
            exit(1)
Ejemplo n.º 25
0
def temizle():
    try:
        f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

        if (f.verifyPassword() == False):
            pass

    except Exception as e:
        pass
    ## Gets some sensor information

    ## Tries to delete the template of the finger
    try:
        for i in range(2, 11):
            positionNumber = i
            positionNumber = int(positionNumber)
            if (f.deleteTemplate(positionNumber) == True):
                if (i == 10):
                    return 4

    except Exception as e:
        pass
Ejemplo n.º 26
0
    def __init__(self):
        Tk.__init__(self)
        self.geometry('+500+100')
        self.txtVarAction = StringVar(value="Not finger print yet")
        self.lblAction = Label(fg="white")
        self.lblAction['textvariable'] = self.txtVarAction
        self.lblAction.grid(row=0, column=0, padx=10, pady=15)

        self.gif = getImage(os.path.dirname(__file__) + "/reader.gif")
        self.lblImageFinger = Label()
        self.lblImageFinger['image'] = self.gif
        self.lblImageFinger.grid(row=1, column=0, padx=10, pady=5)

        self.btnRead = Button(text="Read finger", command=self.startReader)
        self.btnRead.grid(row=2, column=0, pady=10)

        self.txtVarUser = StringVar(value="Not user identified yet")
        self.lblUser = Label(fg="white", textvariable=self.txtVarUser)
        self.lblUser.grid(row=0, column=1, padx=10)

        self.txtVarPassword = StringVar()
        self.txtInPassword = Entry(width=30, textvariable=self.txtVarPassword)
        self.txtInPassword['state'] = 'disabled'
        self.txtInPassword.grid(row=1, column=1, padx=5)

        self.btnChekAcces = Button(text="Access", command=self.checkAccess)
        self.btnChekAcces['state'] = 'disabled'
        self.btnChekAcces.grid(row=2, column=1, padx=10, pady=5)

        self.sclient = Socket_client("Thread_client:daniel",
                                     ('192.168.1.10', 2300),
                                     functionGet=self.getData)

        self.reader = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF,
                                    0x00000000)

        # f.clearDatabase()
        if (self.reader.verifyPassword() == False):
            raise ValueError('The given fingerprint sensor password is wrong!')
Ejemplo n.º 27
0
def search():
    port = config.figerScanPort
    f = PyFingerprint(port, 57600, 0xFFFFFFFF, 0x00000000)
    ## Tries to search the finger and calculate hash
    try:
        print('Waiting for finger...')

        ## Wait that finger is read
        timeout = time.time() + 10
        while ( f.readImage() == False ):
            test = 0
            if test == 5 or time.time() > timeout:
                print('TimeOut')
                return -2 
                break
            test = test - 1

        ## Converts read image to characteristics and stores it in charbuffer 1
        f.convertImage(0x01)

        ## Searchs template
        result = f.searchTemplate()

        positionNumber = result[0]
        accuracyScore = result[1]

        if ( positionNumber == -1 ):
            print('No match found!')
            return -1
        else:
            print('Found template at position #' + str(positionNumber))
            print('The accuracy score is: ' + str(accuracyScore))
            return positionNumber
            
    except Exception as e:
        print('Operation failed!')
        print('Exception message: ' + str(e))
        return -1
Ejemplo n.º 28
0
    def __init__(self, client: mclient.Client, opts: conf.BasicConfig, logger: logging.Logger, device_id: str):
        from gpiozero.pins.native import NativeFactory
        from gpiozero import Device
        Device.pin_factory = NativeFactory()

        self._config = conf.PluginConfig(opts, PluginLoader.getConfigKey())
        self.__client = client
        self.__logger = logger.getChild("Fingerprint")
        self._finger = PyFingerprint(
            self._config["serial"],
            57600,
            0xFFFFFFFF,
            self._config.get("password", 0x00000000)
            )
        
        if not self._finger.verifyPassword():
            self.err_str = "PASSWD"
        
        if self._config.get("WAKEUP", 0) is not 0:
            self.wakupPin = Pin.Pin(pin=self._config.get("WAKEUP", 0), direction=Pin.PinDirection.IN_PULL_LOW)
            self.wakupPin.set_detect(self.wakeup, Pin.PinEventEdge.BOTH)
        else:
            self.wakeup(None, threadsleep=False)
    def delete_all(self):
        ## Tries to initialize the sensor
        try:
            f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)

            if ( f.verifyPassword() == False ):
                raise ValueError('The given fingerprint sensor password is wrong!')

        except Exception as e:
            print('The fingerprint sensor could not be initialized!')
            print('Exception message: ' + str(e))
            exit(1)

        ## Gets some sensor information
        print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))

        ## Tries to delete the template of the finger
        for finger_id in range(f.getTemplateCount() + 5):
            try:
                if ( f.deleteTemplate(finger_id) == True ):
                    print('Template deleted!')
            except:
                print('could not delete')
Ejemplo n.º 30
0
def Remover_Digital():
	global sc_bioRem
	sc_bioRem = Toplevel(screen2)
	sc_bioRem.title("Biometria")
	sc_bioRem.attributes('fullscreen',True)
	try:
		f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000)
	
		if ( f.verifyPassword() == False ):
			raise ValueError('The given fingerprint sensor password is wrong!')
			
			
	except Exception as e:
		exit(1)
	try:
		positionNumber = input('Please enter the template position you want to delete: ')
		positionNumber = int(positionNumber)
		if ( f.deleteTemplate(positionNumber) == True ):
			print('Template deleted!')
	except Exception as e:
		print('Operation failed!')
		print('Exception message: ' + str(e))
		exit(1)