Changed code to support encoded characters

Change code to support encoded characters from regripper and reading them from regripper output file.
This commit is contained in:
Mark McKinnon 2021-06-08 09:10:48 -04:00
parent cd963ef0b6
commit 4feb6e187c
2 changed files with 6 additions and 2 deletions

View File

@ -29,7 +29,9 @@ import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
@ -1062,7 +1064,7 @@ class ExtractRegistry extends Extract {
File regfile = new File(regFilePath);
List<BlackboardArtifact> newArtifacts = new ArrayList<>();
try (BufferedReader bufferedReader = new BufferedReader(new FileReader(regfile))) {
try (BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(regfile), StandardCharsets.UTF_8))) {
// Read the file in and create a Document and elements
String userInfoSection = "User Information";
String previousLine = null;

View File

@ -23,6 +23,7 @@
#-----------------------------------------------------------
package samparse;
use strict;
use Encode::Unicode;
my %config = (hive => "SAM",
hivemask => 2,
@ -364,7 +365,8 @@ sub _translateSID {
#---------------------------------------------------------------------
sub _uniToAscii {
my $str = $_[0];
$str =~ s/\x00//g;
Encode::from_to($str,'UTF-16LE','utf8');
$str = Encode::decode_utf8($str);
return $str;
}