-
Notifications
You must be signed in to change notification settings - Fork 49
/
lookatallthefeelsiknow
executable file
·42 lines (38 loc) · 1.49 KB
/
lookatallthefeelsiknow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# -----------------------------------------------------------
# store system time, change system time to random time
# reset file time, restore system time
#
# usage: lookatallthefeelsiknow <target file>
#
# bonus: find . -type f -exec bash -c '"$0" "$@" &' /root/lookatallthefeelsiknow {} \;
# b/c i'm drunk
# -----------------------------------------------------------
if [[ ! -f "${1}" ]]; then
echo "[x] is not file, is accually dolan"
exit 431366103406 # is dolan
fi
# -----------------------------------------------------------
# store system time
# -----------------------------------------------------------
dat_stamp=$(date +%m%d%H%M%Y.%S)
exit_code=1
# -----------------------------------------------------------
# generate and set random system time
# -----------------------------------------------------------
while [[ "${exit_code}" != 0 ]]; do
new_mm=$(printf '%02d' $(($(($RANDOM % 12))+1)))
new_dd=$(printf '%02d' $(($(($RANDOM % 31))+1)))
new_hh=$(printf '%02d' $(($RANDOM % 24)))
new_cc=$(printf '%02d' $(($RANDOM % 100)))
new_yy=$(printf '%02d' $(($RANDOM % 100)))
new_ss=$(printf '%02d' $(($RANDOM % 60)))
date "${new_mm}${new_dd}${new_hh}${new_cc}${new_yy}.${new_ss}" &> /dev/null
exit_code=$?
done
# -----------------------------------------------------------
# update file time stamp and restore system date
# -----------------------------------------------------------
touch "${1}"
date "${dat_stamp}" &> /dev/null
exit 0