-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathbiometric_extractor.py
More file actions
27 lines (21 loc) · 1000 Bytes
/
biometric_extractor.py
File metadata and controls
27 lines (21 loc) · 1000 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import subprocess
import io
# Connect to the Android device via USB
adb_connect_command = ['adb', 'devices']
subprocess.Popen(adb_connect_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
# Construct the ADB command to retrieve fingerprint data
adb_command = ['adb', 'shell', 'dumpsys', 'fingerprint']
# Execute the ADB command to retrieve fingerprint data
process = subprocess.Popen(adb_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
output, error = process.communicate()
# Check if the command was successful
if process.returncode == 0:
# Decode the output from bytes to string
output_str = output.decode('utf-8')
# Save the fingerprint data in a text file
with io.open('fingerprint_data.txt', 'w', encoding='utf-8') as file:
file.write(output_str)
print('Fingerprint data successfully saved in fingerprint_data.txt.')
else:
print('An error occurred while retrieving fingerprint data.')
print('Error:', error.decode('utf-8'))