Just curious, Can you fake an uptime
, for instance increase it to 10 years?
I have tried changing system time, and it won't do this trick.
Using /proc/uptimeThe first number is the total number of seconds the system has been up. The second number is how much of that time the machine has spent idle, in seconds. On multi core systems (and some Linux versions) the second number is the sum of the idle time accumulated by each CPU.
You can also read the /proc/uptime file to get the system uptime. /proc is a virtual or pseudo-filesystem, also known as a process information pseudo-filesystem. It contains information about the system and the processes it's currently running.
Uptime Command In Linux: It is used to find out how long the system is active (running). This command returns set of values that involve, the current time, and the amount of time system is in running state, number of users currently logged into, and the load time for the past 1, 5 and 15 minutes respectively.
First, open the terminal window and then type: uptime command – Tell how long the Linux system has been running. w command – Show who is logged on and what they are doing including the uptime of a Linux box. top command – Display Linux server processes and display system Uptime in Linux too.
alias uptime='echo " 11:07:17 up 10 BILLION YEARS!, 4 users, load average: 0.38, 0.52, 0.41"'
If you want to get extra-fancy, you could take the actual uptime output and modify that.
Have a look at this utility: UptimeFaker.
Yeah, you should be able to attach a gdb to the running kernel, and hack the uptime value. You'd need to know where it was kept, and have a symbols file. I am assuming here, that uptime is held in something statically allocated.
Alternatively, write a small kernel module which hacks the uptime when you load it (and immediately unloads again).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With