I'm currently creating a tool that can extract and search for data stored on a smartwatch for a University project.
I have been able to extract a file in particular called "Node.db" from my smartwatch which contains the Bluetooth MAC Address of the mobile phone the smartwatch is connected to. I am now trying to create a scanner than will scan this "node.db" file and print out the MAC Address.
This is the code I currently have:
// Identify the location of the node.txt file
File file = new File("C:\\WatchData\\node.txt");
// Notify the user that Bluetooth extraction has initalized
Txt_Results.append("Pulling bluetooth data...");
Scanner in = null;
try {
in = new Scanner(file);
while(in.hasNext())
{ // Scan till the end of the file
String line=in.nextLine();
// Scan the file for this string
if(line.contains("settings.bluetooth"))
// Print the MAC Address string out for the user
System.out.println(line);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
A previous function converted the file to .txt. The code searches each line and looks for "settings.bluetooth" and should print out this line which contains the MAC Address if it is found. However, I believe the format of the node.db file is stopping the scanner from finding this string. I believe that some of the data in the file is encoded. An example of how the data is presented is shown below. I believe it is the black characters it doesn't recognize:
When I run the code on the file, the program will simply hang and provide no error message. I have left the program to run for over 20 minutes and still no success.
The exact line I am trying to print out from the file is shown below:
I have tested this code on a text file without these encoded characters and can conclude that the code does work. So my question is the following:
Is there a way that I can get the scanner to skip the characters it doesn't recognize in the file so it can continue scanning the file?
Thanks in advance.