-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Velocidex/i30
Implement I30 carving.
- Loading branch information
Showing
11 changed files
with
213 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*~ | ||
vendor/ | ||
ntfs | ||
ntfs | ||
ntfs.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module www.velocidex.com/golang/go-ntfs | ||
|
||
require ( | ||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc | ||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf | ||
github.com/davecgh/go-spew v1.1.1 | ||
github.com/mattn/go-runewidth v0.0.3 | ||
github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc | ||
github.com/pmezard/go-difflib v1.0.0 | ||
github.com/sebdah/goldie v0.0.0-20180424091453-8784dd1ab561 | ||
github.com/stretchr/testify v1.2.2 | ||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 | ||
www.velocidex.com/golang/vtypes v0.0.0-20180924145839-b0d509f8925b | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc h1:cAKDfWh5VpdgMhJosfJnn5/FoN2SRZ4p7fJNX58YPaU= | ||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= | ||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf h1:qet1QNfXsQxTZqLG4oE62mJzwPIB8+Tee4RNCL9ulrY= | ||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/mattn/go-runewidth v0.0.3 h1:a+kO+98RDGEfo6asOGMmpodZq4FNtnGP54yps8BzLR4= | ||
github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= | ||
github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc h1:rQ1O4ZLYR2xXHXgBCCfIIGnuZ0lidMQw2S5n1oOv+Wg= | ||
github.com/olekukonko/tablewriter v0.0.0-20180912035003-be2c049b30cc/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/sebdah/goldie v0.0.0-20180424091453-8784dd1ab561 h1:IY+sDBJR/wRtsxq+626xJnt4Tw7/ROA9cDIR8MMhWyg= | ||
github.com/sebdah/goldie v0.0.0-20180424091453-8784dd1ab561/go.mod h1:lvjGftC8oe7XPtyrOidaMi0rp5B9+XY/ZRUynGnuaxQ= | ||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= | ||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= | ||
gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQfozc= | ||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= | ||
www.velocidex.com/golang/vtypes v0.0.0-20180924145839-b0d509f8925b h1:z5v5o1dhtzaxvlWm6qSTYZ4OTr56Ol2JpM1Y5Wu9zQE= | ||
www.velocidex.com/golang/vtypes v0.0.0-20180924145839-b0d509f8925b/go.mod h1:tXxIx8UJuI81Hoxcv0DTq2a1Pi1H6l1uCf4dhqUSUkw= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package ntfs | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
func ExtractI30List(mft_entry *MFT_ENTRY) []*FileInfo { | ||
records := []*INDEX_RECORD_ENTRY{} | ||
|
||
for _, node := range mft_entry.DirNodes() { | ||
records = append(records, node.GetRecords()...) | ||
records = append(records, node.ScanSlack()...) | ||
} | ||
|
||
result := []*FileInfo{} | ||
for _, record := range records { | ||
if !record.IsValid() { | ||
continue | ||
} | ||
|
||
filename := &FILE_NAME{record.Get("file")} | ||
result = append(result, &FileInfo{ | ||
MFTId: record.Get("mftReference").AsString(), | ||
Mtime: time.Unix( | ||
filename.Get("file_modified"). | ||
AsInteger(), 0), | ||
Atime: time.Unix( | ||
filename.Get("file_accessed"). | ||
AsInteger(), 0), | ||
Ctime: time.Unix( | ||
filename.Get("mft_modified"). | ||
AsInteger(), 0), | ||
Name: filename.Name(), | ||
NameType: filename.Get("name_type").AsString(), | ||
}) | ||
} | ||
|
||
return result | ||
} | ||
|
||
const ( | ||
earliest_valid_time = 1000000000 // Sun Sep 9 11:46:40 2001 | ||
latest_valid_time = 2000000000 // Wed May 18 13:33:20 2033 | ||
) | ||
|
||
func (self *INDEX_RECORD_ENTRY) IsValid() bool { | ||
test_filename := &FILE_NAME{self.Get("file")} | ||
|
||
for _, field := range []string{ | ||
"file_modified", "file_accessed", | ||
"mft_modified", "created"} { | ||
test_time := test_filename.Get(field).AsInteger() | ||
if test_time < earliest_valid_time || test_time > latest_valid_time { | ||
return false | ||
} | ||
} | ||
|
||
return true | ||
} | ||
|
||
func (self *INDEX_NODE_HEADER) ScanSlack() []*INDEX_RECORD_ENTRY { | ||
result := []*INDEX_RECORD_ENTRY{} | ||
|
||
// start at the last record and carve until the end of the | ||
// allocation. | ||
start := self.Get("offset_to_end_index_entry").AsInteger() | ||
end := self.Get("sizeOfEntriesAlloc").AsInteger() - 0x52 | ||
for off := start; off < end; off++ { | ||
test_struct_obj, _ := self.Profile().Create( | ||
"INDEX_RECORD_ENTRY", off, self.Reader(), nil) | ||
test_struct := &INDEX_RECORD_ENTRY{test_struct_obj} | ||
if test_struct.IsValid() { | ||
result = append(result, test_struct) | ||
} | ||
} | ||
|
||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters