Skip to content

Instantly share code, notes, and snippets.

@calebbaker
Last active December 5, 2019 14:33
Show Gist options
  • Save calebbaker/cdc093afd2f7585ada5eaf864bb80314 to your computer and use it in GitHub Desktop.
Save calebbaker/cdc093afd2f7585ada5eaf864bb80314 to your computer and use it in GitHub Desktop.
####
#### CLI Field Manual: An assortment of useful information and commands
#### Caleb Baker - caleb@calebbaker.net
####
#### The goal of this document is to provide an reference of commands I've found useful (but use infrequently enough not to remember off the top of my head), and keep the output as grepable as possible.
#### It's intended primarily for my personal use.
####
#### Sections
#### Linux CLI (Cross platform go here)
#### Powershell
#### Cisco
#### Windows/Batch
####
####
### Linux CLI
## dig
#Query 208.67.222.222 for the A record "myip.opendns.com" and display the response
dig @208.67.222.222 myip.opendns.com A +qr
## iptables
#List current iptables rules
iptables -S
#Export current iptables rules as a list of commands
iptables-save
#Port forward destination port 80 to local port 10000
iptables -t nat -a PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000
## openssl
#Convert PEM to PFX
openssl pkcs12 -inkey (keyfile) -in (certificate file) -export -out (destination pfx)
## tshark
#Output data filtered with -f flag to file in -w. Split every time period specified in -b.
tshark -i 5 -w d:\test2.pcap -b duration:86400 -f "udp dst port 53"
### Powershell
## Loops
# Infinate loop
while ($true) { }
### Cisco
# Show top processes by memory usage
show proc mem sort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment