From bfaf39d7abf99a47b0fa41cb3d3cf52e37397b0c Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 11:22:50 +0200 Subject: [PATCH 1/7] [NMAP] Speed up nmap scan --- cheatsheets/nmap | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cheatsheets/nmap b/cheatsheets/nmap index afa46ef..81c54a8 100644 --- a/cheatsheets/nmap +++ b/cheatsheets/nmap @@ -8,7 +8,7 @@ nmap -iL [list.txt] nmap -6 [target] # OS detection: -nmap -O [target] +nmap -O --osscan_guess [target] # Save output to text file: nmap -oN [output.txt] [target] @@ -22,6 +22,9 @@ nmap -source-port [port] [target] # Do an aggressive scan: nmap -A [target] +# Speedup your scan: +nmap -T5 --min-parallelism=50 [target] + # Traceroute: nmap -traceroute [target] From 1c79ab5ed6af94c2358ad5fb4454fc73a4d0c9f9 Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 11:23:23 +0200 Subject: [PATCH 2/7] [APT-GET] Donwload deb withtou installing it --- cheatsheets/apt-get | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cheatsheets/apt-get b/cheatsheets/apt-get index 3888613..c18baf8 100644 --- a/cheatsheets/apt-get +++ b/cheatsheets/apt-get @@ -14,3 +14,9 @@ apt-get update && apt-get dist-upgrade # To install a new package(s) apt-get install package(s) + +# Download a package without installing it. (The package will be downloaded in your current working dir) +apt-get download modsecurity-crs + +# Change Cache dir and archive dir (where .deb are stored). +apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ... From 74c6c9b01bfd980a01cf9ea6cf32f8d9d3ff47da Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 17:12:39 +0200 Subject: [PATCH 3/7] [DD] Add some tricks for dd --- cheatsheets/dd | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cheatsheets/dd b/cheatsheets/dd index c1db5f3..b2a03c8 100644 --- a/cheatsheets/dd +++ b/cheatsheets/dd @@ -2,3 +2,13 @@ # Note: At the first iteration, we read 512 Bytes. # Note: At the second iteration, we read 512 Bytes. dd if=/dev/urandom of=/tmp/test.txt count=512 bs=2 + +# Watch the progress of 'dd' +dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d /proc/$dd_pid ]]; do kill -USR1 $dd_pid && sleep 1 && clear; done + +# Watch the progress of 'dd' with `pv` and `dialog` (apt-get install pv dialog) +(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0 + +# DD with "graphical" return +dcfldd if=/dev/zero of=/dev/null bs=500K + From d87cf0ae81ce8f1160fd8563a9f4ad34e1440720 Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 18:04:25 +0200 Subject: [PATCH 4/7] =?UTF-8?q?[APT=E2=88=92GET]=20Show=20apt-get=20instal?= =?UTF-8?q?led=20packages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cheatsheets/apt-get | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheatsheets/apt-get b/cheatsheets/apt-get index c18baf8..3208a53 100644 --- a/cheatsheets/apt-get +++ b/cheatsheets/apt-get @@ -20,3 +20,6 @@ apt-get download modsecurity-crs # Change Cache dir and archive dir (where .deb are stored). apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ... + +# Show apt-get installed packages. +cat /var/log/dpkg.log | grep 'install ' From 4703463a7cdf1622dbb55cb079d778d1bde83e5b Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 18:04:57 +0200 Subject: [PATCH 5/7] [DD] Watch the progress of `dd` with `pv` and `zenity` --- cheatsheets/dd | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cheatsheets/dd b/cheatsheets/dd index b2a03c8..2db5aaa 100644 --- a/cheatsheets/dd +++ b/cheatsheets/dd @@ -9,6 +9,9 @@ dd if=/dev/zero of=/dev/null bs=4KB &; export dd_pid=`pgrep '^dd'`; while [[ -d # Watch the progress of 'dd' with `pv` and `dialog` (apt-get install pv dialog) (pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | dialog --gauge "Running dd command (cloning), please wait..." 10 70 0 +# Watch the progress of 'dd' with `pv` and `zenity` (apt-get install pv zenity) +(pv -n /dev/zero | dd of=/dev/null bs=128M conv=notrunc,noerror) 2>&1 | zenity --title 'Running dd command (cloning), please wait...' --progress + # DD with "graphical" return dcfldd if=/dev/zero of=/dev/null bs=500K From 4c31138bbfff416f66d5583fe61276d02148fbe9 Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Fri, 18 Apr 2014 18:43:17 +0200 Subject: [PATCH 6/7] Make cheat working with python3 :) --- cheat | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cheat b/cheat index b4d00da..03f4dd8 100755 --- a/cheat +++ b/cheat @@ -151,7 +151,7 @@ class CheatSheets(object): new_sheet = os.path.join(DEFAULT_CHEAT_DIR, cheat) shutil.copy(sheet_path, new_sheet) subprocess.call(editor + [new_sheet]) - + # fail gracefully if the cheatsheet cannot be copied. This # can happen if DEFAULT_CHEAT_DIR does not exist except IOError: @@ -179,7 +179,7 @@ class CheatSheets(object): "Please retry usig sudo." % cheat) print >> sys.stderr, error_msg exit(1) - except OSError, errno: + except OSError as errno: print >> sys.stderr, ("Could not launch `%s` as your editor : %s" % (editor[0], errno.strerror)) exit(1) @@ -216,7 +216,7 @@ class CheatSheets(object): output += ''.join([" " + line + '\n' for line in block.split('\n')]) if output: - print output, + sys.stdout.write(output); # Custom action for argparse @@ -230,7 +230,7 @@ class ListDirectories(argparse.Action): class ListCheatsheets(argparse.Action): """List cheatsheets and exit""" def __call__(self, parser, namespace, values, option_string=None): - print sheets.list() + print(sheets.list()); parser.exit() From e5093db169fd9a834d256b1118f6787bf16883d6 Mon Sep 17 00:00:00 2001 From: ImmortalPC Date: Mon, 21 Apr 2014 23:15:09 +0200 Subject: [PATCH 7/7] [APT-GET] Change to grep [PACMAN] Change the AUR instructions --- cheatsheets/apt-get | 2 +- cheatsheets/pacman | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/cheatsheets/apt-get b/cheatsheets/apt-get index 3208a53..c7bc7f3 100644 --- a/cheatsheets/apt-get +++ b/cheatsheets/apt-get @@ -22,4 +22,4 @@ apt-get download modsecurity-crs apt-get -o Dir::Cache="/path/to/destination/dir/" -o Dir::Cache::archives="./" install ... # Show apt-get installed packages. -cat /var/log/dpkg.log | grep 'install ' +grep 'install ' /var/log/dpkg.log diff --git a/cheatsheets/pacman b/cheatsheets/pacman index 353f6c5..cb51fc6 100644 --- a/cheatsheets/pacman +++ b/cheatsheets/pacman @@ -32,12 +32,17 @@ pacman -Qdt # You can't directly install packages from the Arch User Database (AUR) with pacman. -# You need yaourt to perform that. But considering yaourt itself is in the AUR, here is how to -build a package from its tarball. -# First, get the .tar.gz archive and unpack it -wget -tar -xzf -cd -# Then build the package and install it +# You need yaourt to perform that. But considering yaourt itself is in the AUR, here is how to build a package from its tarball. +# Installing a package from AUR is a relatively simple process: +# - Retrieve the archive corresponding to your package from AUR website +# - Extract the archive (preferably in a folder for this purpose) +# - Run makepkg in the extracted directory. (makepkg-s allows you to install any dependencies automatically from deposits.) +# - Install the package created using pacman +# Assuming $pkgname contains the package name. +wget "https://aur.archlinux.org/packages/${pkgname::2}/$pkgname/$pkgname.tar.gz" +tar zxvf "$pkgname.tar.gz" +cd "$pkgname" +# Build the package makepkg -s -pacman -U +# Install +sudo pacman -U