Check These Out
Installs pip packages defining a proxy
Based on capsule8 agent examples, not rigorously tested
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
This command
1. SSH into a machine
2. Tunnels VNC port to your local computer ("-L 5900:localhost:5900")
3. Runs a single use vnc server ("x11vnc -safer -localhost -nopw -once -display :0")
4. Goes into the background ("-f")
5. Runs VNC viewer on the local computer connecting to the remote machine via the newly created SSH tunnel ("vinagre localhost:5900")
This command uses the debugger to attach to a running process, and reassign a filehandle to a file.
The two commands executed in gdb are
p close(1) which closes STDOUT
and
p creat("/tmp/filename",0600)
which creates a file and opens it for output. Since file handles are assigned
sequentially, this command opens the file in place of STDOUT and once the process continues, new output to STDOUT will instead be written to our capture file.
This directly puts the "mirror" into fullscreen, and lets you take photos by pressing the 's' key. I bet appearance conscious people will have keyboard shortcut for this command by now.
include in the list human readable hidden files too:
$ file .* *|grep 'ASCII text'|sort -rk2
more reliable command:
$ ls|xargs file|grep 'ASCII text'|sort -rk2
and include hidden files:
$ ls -a|xargs file|grep 'ASCII text'|sort -rk2
Generate a random MAC address with capital letters
You might want to secure your AWS operations requiring to use a MFA token. But then to use API or tools, you need to pass credentials generated with a MFA token.
This commands asks you for the MFA code and retrieves these credentials using AWS Cli. To print the exports, you can use:
`awk '{ print "export AWS_ACCESS_KEY_ID=\"" $1 "\"\n" "export AWS_SECRET_ACCESS_KEY=\"" $2 "\"\n" "export AWS_SESSION_TOKEN=\"" $3 "\"" }'`
You must adapt the command line to include:
* $MFA_IDis ARN of the virtual MFA or serial number of the physical one
* TTL for the credentials