Finding the largest files

Large files are always prime suspects when investigating. Large database dumps, password dumps, rainbow tables, credit card caches, stolen intellectual property, and other data are often stored in one large archive that is easy to spot if you have the right tools. Also, it would be helpful to find exceptionally large image or video files that may have steganographically-hidden information inside. Steganography is covered further in this chapter.

This program will search in a directory and all subdirectories for all files and sort them by file size. We'll explore the initial directory with ioutil.ReadDir() to get the contents as a slice of the os.FileInfo structs. To check whether a file is a directory, we'll use ...

Get Security with Go now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.