Merge pull request #156 from ImmortalPC/master

[NMAP, APT−GET, DD,PACMAN] Add some cheats + Make cheat working with python3
This commit is contained in:
Chris Lane 2014-04-21 21:05:25 -04:00
commit 6f00652c52
5 changed files with 43 additions and 13 deletions

8
cheat
View file

@ -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()

View file

@ -14,3 +14,12 @@ 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 ...
# Show apt-get installed packages.
grep 'install ' /var/log/dpkg.log

View file

@ -2,3 +2,16 @@
# 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
# 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

View file

@ -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]

View file

@ -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 <archive url>
tar -xzf <archive file>
cd <unpacked folder>
# 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 <package file (.pkg.tar.xz)>
# Install
sudo pacman -U <package file (.pkg.tar.xz)>