File Extraction Overview
From Release 6.0, Trisul features a very flexible file extraction platform. Most of the functionality is controlled by LUA scripts that you will write.
Extract and dump content like PDFs, Binaries, Javascripts, Video for further analysis.
How it works
What the platform provides | What you provide via LUA |
---|---|
1 . The Trisul platform provides the following services Dumps content in ramfs filesystem 2 . TCP reassembly 3 . HTTP reassembly chunking and decompression 4 . Async file system operations 5 . Ability to turn on and off feature on per flow basis 6 . Streaming or full file mode 7 . Integration with Trisul metrics | 1 . Determine by looking at headers or flows if you want the content or not 2 . Determine if you are no longer interested in content by looking at first few chunks 3 . Copy any files for further analysis off the ramfs filesystem to a disk based one 4 . Streaming processing if you want to deal with buffers instead of full files 5 . Any custom logging or sending to other systems. Your code. |
The ramfs
filesystem
Linux offers a memory backed filesystem called ramfs aka tmpfs Trisul’s file extraction feature uses this filesytem to dump extracted files. Your LUA script an operate on that file or copy it out to a real disk backed file system for further analysis.
The flow looks like this
Creating the ramfs filesytem
Location
The default location of the ramfs filesystem is at /usr/local/var/lib/trisul-probe/domain0/probe0/context0/run/ramfs
(see FileExtraction RamfsDir setting)
Creating
We will actually be using a memory system called tmpfs rather than the older ramfs. To create the file system in the default location with a size of 40MB use the following commands.
Using trisulctl_probe
trisulctl_probe features a convenient method to create the ramfs
sudo trisulctl_probe
createramfs probe0 context0
# then answer the questions, select a size of 10MB for the ramfs
Manually
or you can do it manually using the following commands (as root)
$ cd /usr/local/var/lib/trisul-probe/domain0/probe0/context0/run
$ mkdir ramfs
$ sudo mount -t tmpfs -o size=40m tmpfs ramfs/
Add entry of new filesystem to fstab
To ensure that the ramfs partition is persisted on reboot. Add it to fstab as shown in this example
tmpfs /usr/local/var/lib/trisul-probe/domain0/probe0/context0/run/ramfs tmpfs nodev,nosuid,size=20M 0 0