In my yesterday’s post I described a simple clustering algorithm that could be used to group files that contain references to each other. Today I am posting the source code of the program that generated the data in my last post, together with a demo that shows how powerful such clustering could be if combined with proper visualization techniques.
In the example I have shown, I used a relatively small folder where Total Commander was installed. The resulting cluster looks like this:
You can play with it interactively here.
Imagine that someone adds files to the Total Commander folder. Since they are not referenced by any other file in this folder, they will create separate clusters. After adding 3 such files:
we get the following clusters:
You can play with it interactively here (you need to drag the orphans away to get the same result as shown on the screenshot).
Finally, we can imagine that a hacker of malware creates a couple of files that are perhaps referencing each other. An example could be:
- malware.exe – referencing keystrokes.txt and config.bin
If we now cluster this directory, we will get something like this:
The ‘malware’ files clearly stand out.
You can play with it interactively here (again, you need to drag the nodes away to get the same result as shown on the screenshot).
For more examples see part 3.
I believe there is a lot of opportunities in leveraging clustering to reduce the amount of data we need to analyze and to improve user experience by introducing new ways to look at data. There are a lot of visualization techniques that are not used in forensic software today and it is a pity. Clustering adds an extra dimension on top of a timeline and structure imposed by the organization of a file system – we can only hope that forensic software of the future will take this into account.
For inspiration and really amazing examples of visualization go to https://github.com/mbostock/d3/wiki/Gallery. I used the very same script to create the interactive demos referenced by this post.
The source code of the filighter script that generates these clusters is here.