Changing file timestamp

In the same way you can modify file permissions, you can modify the timestamps to make it look like it was modified in the past or in the future. This can be useful for covering your tracks and making it look like a file that has not been accessed in a long time or set it for a future date to confuse forensic investigators. The Go os package contains the utilities for modifying files.

In this next example, a file's timestamp is modified to look like it was modified in the future. You can tweak the futureTime variable to make a file look like it has been modified to any specific time. This example provides a relative time by adding 50 hours and 15 minutes to the current time, but you can also specify an absolute time: ...

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.