@@ -749,11 +749,15 @@ int get_analysisdata(ostringstream *osslog = NULL) {
749
749
Wow64DisableWow64FsRedirection (&oldval);
750
750
751
751
char findpath[MAX_PATH + 1 ];
752
+ char filepath[MAX_PATH + 1 ];
752
753
char srcpath[MAX_PATH + 1 ];
753
754
char dstpath[MAX_PATH + 1 ];
754
755
755
- if (param_mftdump == true ) {
756
+ if (param_mftdump || param_securedump || param_usndump ) {
756
757
mkdir (" NTFS" );
758
+ }
759
+
760
+ if (param_mftdump == true ) {
757
761
// get MFT
758
762
sprintf (srcpath, " %s\\ $MFT" , osvolume);
759
763
sprintf (dstpath, " NTFS\\ %c_$MFT" , osvolume[0 ]);
@@ -867,20 +871,38 @@ int get_analysisdata(ostringstream *osslog = NULL) {
867
871
// get prefetch files
868
872
mkdir (" Prefetch" );
869
873
870
- sprintf (findpath, " %s\\ Prefetch\\ *.pf " , windir);
874
+ sprintf (findpath, " %s\\ Prefetch\\ *" , windir);
871
875
auto files = findfiles (string (findpath));
872
-
873
876
bool flag = false ;
874
877
for (auto file : files) {
875
- sprintf (srcpath, " %s\\ Prefetch\\ %s" , windir, file.first .c_str ());
876
- sprintf (dstpath, " Prefetch\\ %s" , file.first .c_str ());
877
- if (StealthGetFile (srcpath, dstpath, osslog, false )) {
878
- cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
878
+ if ( file.first .substr (file.first .length () - 3 ) == " .pf" ) {
879
+ sprintf (srcpath, " %s\\ Prefetch\\ %s" , windir, file.first .c_str ());
880
+ sprintf (dstpath, " Prefetch\\ %s" , file.first .c_str ());
881
+ if (StealthGetFile (srcpath, dstpath, osslog, false )) {
882
+ cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
883
+ }
884
+ else {
885
+ flag = true ;
886
+ }
879
887
}
880
- else {
881
- flag = true ;
888
+ // check if the file has ADS or not
889
+ sprintf (filepath, " %s\\ Prefetch\\ %s" , windir, file.first .c_str ());
890
+ auto strms = findstreams (filepath);
891
+ if ( strms.size () > 0 ){
892
+ for (auto strm : strms) {
893
+ sprintf (srcpath, " %s\\ Prefetch\\ %s%s" , windir, file.first .c_str (), strm.first .c_str ());
894
+ sprintf (dstpath, " Prefetch\\ %s%s" , file.first .c_str (), strm.first .c_str ());
895
+ if (StealthGetFile (srcpath, dstpath, osslog, false )) {
896
+ cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
897
+ }
898
+ else {
899
+ flag = true ;
900
+ }
901
+ }
882
902
}
903
+
883
904
}
905
+
884
906
if (flag) {
885
907
cerr << msg (" プリフェッチ 取得完了" , " prefetch is saved" ) << endl;
886
908
}
@@ -890,20 +912,38 @@ int get_analysisdata(ostringstream *osslog = NULL) {
890
912
891
913
// Windows.old
892
914
if (PathIsDirectory (backupdir)) {
915
+
893
916
mkdir (" Prefetch_old" );
894
-
895
- sprintf (findpath, " %s\\ Prefetch\\ *.pf" , windir_old);
917
+ sprintf (findpath, " %s\\ Prefetch\\ *" , windir_old);
896
918
auto files = findfiles (string (findpath));
897
919
898
920
bool flag = false ;
921
+
899
922
for (auto file : files) {
900
- sprintf (srcpath, " %s\\ Prefetch\\ %s" , windir_old, file.first .c_str ());
901
- sprintf (dstpath, " Prefetch_old\\ %s" , file.first .c_str ());
902
- if (StealthGetFile (srcpath, dstpath, osslog, false )) {
903
- cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
923
+ if ( file.first .substr (file.first .length () - 3 ) == " .pf" ) {
924
+ sprintf (srcpath, " %s\\ Prefetch\\ %s" , windir_old, file.first .c_str ());
925
+ sprintf (dstpath, " Prefetch_old\\ %s" , file.first .c_str ());
926
+ if (StealthGetFile (srcpath, dstpath, osslog, false )) {
927
+ cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
928
+ }
929
+ else {
930
+ flag = true ;
931
+ }
904
932
}
905
- else {
906
- flag = true ;
933
+ // check if the file has ADS or not
934
+ sprintf (filepath, " %s\\ Prefetch\\ %s" , windir_old, file.first .c_str ());
935
+ auto strms = findstreams (filepath);
936
+ if (strms.size () > 0 ) {
937
+ for (auto strm : strms) {
938
+ sprintf (srcpath, " %s\\ Prefetch\\ %s%s" , windir_old, file.first .c_str (), strm.first .c_str ());
939
+ sprintf (dstpath, " Prefetch_old\\ %s%s" , file.first .c_str (), strm.first .c_str ());
940
+ if (StealthGetFile (srcpath, dstpath, osslog, false )) {
941
+ cerr << msg (" 取得失敗" , " failed to save" ) << " : " << srcpath << endl;
942
+ }
943
+ else {
944
+ flag = true ;
945
+ }
946
+ }
907
947
}
908
948
}
909
949
if (flag) {
@@ -1173,7 +1213,7 @@ int main(int argc, char **argv)
1173
1213
1174
1214
// chack proces name
1175
1215
procname = basename (string (argv[0 ]));
1176
- cout << msg (" CDIR Collector v1.3.3 - 初動対応用データ収集ツール" , " CDIR Collector v1.3.3 - Data Acquisition Tool for First Response" ) << endl;
1216
+ cout << msg (" CDIR Collector v1.3.4 - 初動対応用データ収集ツール" , " CDIR Collector v1.3.4 - Data Acquisition Tool for First Response" ) << endl;
1177
1217
cout << msg (" Cyber Defense Institute, Inc.\n " , " Cyber Defense Institute, Inc.\n " ) << endl;
1178
1218
1179
1219
// set curdir -> exedir
@@ -1299,6 +1339,7 @@ int main(int argc, char **argv)
1299
1339
strncpy (usrvolume, (CASTVAL (string, config->getValue (" Target" ))).c_str (), 2 );
1300
1340
strncpy (sysdir, (CASTVAL (string, config->getValue (" Target" ))).c_str (), 2 );
1301
1341
strncpy (windir, (CASTVAL (string, config->getValue (" Target" ))).c_str (), 2 );
1342
+ strncpy (backupdir, (CASTVAL (string, config->getValue (" Target" ))).c_str (), 2 );
1302
1343
cerr << " Target: " << osvolume << endl;
1303
1344
}
1304
1345
0 commit comments