From 97182d4cf1ae553e52f95f0e464cd713b1d7de0d Mon Sep 17 00:00:00 2001 From: TiTi Date: Tue, 8 Oct 2013 23:55:25 +0200 Subject: [PATCH 1/2] Add a troubleshooting section (python 2.6 doesn't comes with the argparse module) --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 4578312..312c23f 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,22 @@ Clone this repository and `cd` into it, then run mkdir ~/.cheat cp cheatsheets/* ~/.cheat +### Testing + +After installing for all users or in your home directory, try `cheat tar` for instance. + +### Troubleshooting + +In case you got an error such as: +> ImportError: No module named argparse + +You're probably using python < 2.7 and you need to manually install the argparse module. +You can do this easily with pip: +```bash +sudo apt-get python-pip +sudo pip install argparse +``` +Other methods: https://pypi.python.org/pypi/argparse Modifying Cheatsheets ===================== From 9d1a65b4bb67bc7a2b2def5f9f61a17b00c854cc Mon Sep 17 00:00:00 2001 From: TiTi Date: Wed, 9 Oct 2013 00:16:31 +0200 Subject: [PATCH 2/2] Add cheatsheets --- cheatsheets/lsof | 3 +++ cheatsheets/netstat | 2 ++ cheatsheets/nmap | 3 +++ cheatsheets/pdftk | 3 +++ cheatsheets/ps | 5 ++++- cheatsheets/sam2p | 2 ++ 6 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 cheatsheets/sam2p diff --git a/cheatsheets/lsof b/cheatsheets/lsof index ca08a02..607c1ca 100644 --- a/cheatsheets/lsof +++ b/cheatsheets/lsof @@ -1,3 +1,6 @@ +# List all ipv4 network files +sudo lsof -i4 + # To find listening ports: lsof -Pnl +M -i4 diff --git a/cheatsheets/netstat b/cheatsheets/netstat index 72fbc07..c479fae 100644 --- a/cheatsheets/netstat +++ b/cheatsheets/netstat @@ -9,3 +9,5 @@ netstat -pln | grep | awk '{print $NF}' Example output: 1507/python +# Fast display of ipv4 tcp listening programs +sudo netstat -vtlnp --listening -4 diff --git a/cheatsheets/nmap b/cheatsheets/nmap index 7620afd..68da56a 100644 --- a/cheatsheets/nmap +++ b/cheatsheets/nmap @@ -31,3 +31,6 @@ nmap -traceroute [target] # TCP ACK ping: -PA # UDP ping: -PU # ARP ping: -PR + +# Example: Ping scan all machines on a class C network +nmap -sP 192.168.0.0/24 diff --git a/cheatsheets/pdftk b/cheatsheets/pdftk index d4d2ec2..6f1609c 100644 --- a/cheatsheets/pdftk +++ b/cheatsheets/pdftk @@ -1,6 +1,9 @@ # Concatenate all pdf files into one: pdftk *.pdf cat output all.pdf +# Concatenate specific pdf files into one: +pdftk 1.pdf 2.pdf 3.pdf cat output 123.pdf + # Concatenate pages 1 to 5 of first.pdf with page 3 of second.pdf pdftk A=fist.pdf B=second.pdf cat A1-5 B3 output new.pdf diff --git a/cheatsheets/ps b/cheatsheets/ps index 06dac71..3710a90 100644 --- a/cheatsheets/ps +++ b/cheatsheets/ps @@ -1,8 +1,11 @@ # To list every process on the system: ps aux +# To list a process tree +ps axjf + # To list every process owned by foouser: ps -aufoouser # To list every process with a user-defined format: -ps -eo pid,user,command \ No newline at end of file +ps -eo pid,user,command diff --git a/cheatsheets/sam2p b/cheatsheets/sam2p new file mode 100644 index 0000000..9d5f9f9 --- /dev/null +++ b/cheatsheets/sam2p @@ -0,0 +1,2 @@ +# Concatenate all pdf files into one: +sam2p *.pdf out.pdf