Check These Out
":! ls -l " results in listing the files in the current directory. pressing "enter" will get you back into vi.
the below command create a alias for share your internet connection with another.
$ifconfig eth0:1 192.168.0.1/24
Its obviously necessary too activate the iptables post-routing and ip forwarding, as root:
$modprobe iptable_nat
$iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
$echo 1 > /proc/sys/net/ipv4/ip_forward
Be sure that the alias 192.168.0.0/24 is not your active real ip range
curl inet-ip.info -> 113.33.232.62\n
curl inet-ip.info/ip -> 113.33.232.62
curl inet-ip.info/json -> JSON print
curl inet-ip.info/json/indent -> JSON pretty print
curl inet-ip.info/yaml -> YAML format
curl inet-ip.info/toml -> TOML format
http://inet-ip.info
This way, you can specify how many hours in which you want your machine to shut down.
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
- Where $URL is the URL of the file.
- Replace the $2 by $3 at the end to get a human-readable size.
Credits to svanberg @ ArchLinux forums for original idea.
Edit: Replaced command with better version by FRUiT. (removed unnecessary grep)
i.e.: Useful if you add ~/bin to your $PATH and you want to override locations of previously ran commands and you don't want to log out and log back in to be able to use them.
A much quicker and (not dirtier) option. use the man page for help. On linux/ubuntu you will need to `sudo apt-get -y install arp-scan`.