From c5f1d5c1acdd3d4922560cff34ff0506749449ee Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Mon, 31 Mar 2014 00:03:12 +0200 Subject: [PATCH 1/4] [IPTABLES] Add some cheats for iptables --- cheatsheets/iptables | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cheatsheets/iptables b/cheatsheets/iptables index badc271..2e0a132 100644 --- a/cheatsheets/iptables +++ b/cheatsheets/iptables @@ -16,3 +16,25 @@ iptables -A INPUT -i eth0 -p tcp --dport 902 -j REJECT --reject-with icmp-port-u # icmp-host-prohibited or # icmp-admin-prohibited # tcp-reset + +# Add a comment to a rule: +iptables ... -m comment --comment "This rule is here for this reason" + + +# To remove or insert a rule: +# 1) Show all rules +iptables -L INPUT --line-numbers +# OR iptables -nL --line-numbers + +# Chain INPUT (policy ACCEPT) +# num target prot opt source destination +# 1 ACCEPT udp -- anywhere anywhere udp dpt:domain +# 2 ACCEPT tcp -- anywhere anywhere tcp dpt:domain +# 3 ACCEPT udp -- anywhere anywhere udp dpt:bootps +# 4 ACCEPT tcp -- anywhere anywhere tcp dpt:bootps + +# 2.a) REMOVE (-D) a rule. (here an INPUT rule) +iptables -D INPUT 2 + +# 2.b) OR INSERT a rule. +iptables -I INPUT {LINE_NUMBER} -i eth1 -p tcp --dport 21 -s 123.123.123.123 -j ACCEPT -m comment --comment "This rule is here for this reason" From 1e7ee5b7fa45b264c75f7e6f908040b7143aa18d Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Tue, 1 Apr 2014 19:18:19 +0200 Subject: [PATCH 2/4] [NMAP] Update nmap --- cheatsheets/nmap | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/cheatsheets/nmap b/cheatsheets/nmap index 68da56a..d4361ca 100644 --- a/cheatsheets/nmap +++ b/cheatsheets/nmap @@ -33,4 +33,22 @@ nmap -traceroute [target] # ARP ping: -PR # Example: Ping scan all machines on a class C network -nmap -sP 192.168.0.0/24 +nmap -sP 192.168.0.0/24* + +# Use some script: +nmap --script default,safe + +# Loads the script in the default category, the banner script, and all .nse files in the directory /home/user/customscripts. +nmap --script default,banner,/home/user/customscripts + +# Loads all scripts whose name starts with http-, such as http-auth and http-open-proxy. +nmap --script 'http-*' + +# Loads every script except for those in the intrusive category. +nmap --script "not intrusive" + +# Loads those scripts that are in both the default and safe categories. +nmap --script "default and safe" + +# Loads scripts in the default, safe, or intrusive categories, except for those whose names start with http-. +nmap --script "(default or safe or intrusive) and not http-*" From 041bcd2f6316b9da317ebdb26e0f0bd446a19a20 Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Wed, 2 Apr 2014 11:12:09 +0200 Subject: [PATCH 3/4] [FIND] add a cheat to find all files that have the same node (hard link) as MY_FILE --- cheatsheets/find | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheatsheets/find b/cheatsheets/find index c6126b3..5cd262f 100644 --- a/cheatsheets/find +++ b/cheatsheets/find @@ -39,3 +39,6 @@ find . -maxdepth 2 -name build -type d # To search all files who are not in .git directory find . ! -iwholename '*.git*' -type f + +# Find all files that have the same node (hard link) as MY_FILE_HERE +find / -type f -samefile MY_FILE_HERE 2>/dev/null From 5805d2c52e6b17507878046132132f75320a15ee Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Wed, 2 Apr 2014 11:14:18 +0200 Subject: [PATCH 4/4] [NMAP] Correct a bug --- cheatsheets/nmap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cheatsheets/nmap b/cheatsheets/nmap index d4361ca..afa46ef 100644 --- a/cheatsheets/nmap +++ b/cheatsheets/nmap @@ -33,7 +33,7 @@ nmap -traceroute [target] # ARP ping: -PR # Example: Ping scan all machines on a class C network -nmap -sP 192.168.0.0/24* +nmap -sP 192.168.0.0/24 # Use some script: nmap --script default,safe