Snott

Author: snott

  • BlackArch Linux

    BlackArch Linux

    I just found out about this Project. If you use Kali Linux and like Arch Linux this would be a perfect fit for you!

    BlackArch Linux is an Arch-based GNU/Linux distribution for pentesters and security researchers. The BlackArch package repository is compatible with existing Arch installs.

    Here are some of BlackArch’s features:

        – Support for i686 and x86_64 architectures
        – Over 600 tools (constantly increasing)
        – Modular package groups
        – A live ISO with multiple window managers, including dwm, Fluxbox, Openbox, Awesome, wmii, i3, and Spectrwm.
        – An installer with the ability to build from source.

    Soon they will release:

        – ARM support
        – Documentation for all tools

    The project authors are also releasing a tool to fetch and search exploit archives called sploitctl.

    As an Arch Linux user myself I will be trying this soon and post my experience here. Getting all of these security tools on a rolling release distribution like Arch Linux is extremely hard to do and I am really excited to see the results.

    To install any of these tools you need to add the BlackArch repository:

    Append the following lines to /etc/pacman.conf to add the BlackArch repository:

    [blackarch]

    Server = /$repo/os/$arch

    SigLevel = Optional TrustAll
    Where should be a complete URL pointing to the repository. Please use one of our official mirrors. See Mirror Sites.

    For package signing, run the following to pull in and sign the package signing keys:

    $ sudo pacman-key -r 4345771566D76038C7FEB43863EC0ADBEA87E4E3

    $ sudo pacman-key –lsign-key 4345771566D76038C7FEB43863EC0ADBEA87E4E3

    Now run:

    $ sudo pacman -Syyu

    Installing packages
    You may now install tools from the blackarch repository.

    To list all of the available tools, run

    $ sudo pacman -Sgg | grep blackarch | cut -d’ ‘ -f2 | sort -u

    To install all of the tools, run

    $ sudo pacman -S blackarch

    To install a category of tools, run

    $ sudo pacman -S blackarch-

    To see the blackarch categories, run

    $ sudo pacman -Sg | grep blackarch

    If you don’t have Arch Linux installed already you can download an ISO with all configuration already in place on the following page: http://blackarch.org/download.html

    Official website: http://blackarch.org/index.html

    List of tools provided (constantly updated): http://blackarch.org/tools.html

  • Handy Arch Linux commands

    Handy Arch Linux commands

    Here I will show you some useful commands that will make your life a lot easier, some of them are specific to Arch Linux while the majority will run on any distro.

    # = means execute as root or with sudo

     

    Get a list of installed packages

    # comm -23 <(pacman -Qeq|sort) <(pacman -Qmq|sort) > pkglist.txt

    This gets all explicitly installed top-level packages, i.e. those that are not required by other packages, and sorts them from a to z and then outputs the result to a file.

    Store this package list somewhere safe and handy (you can also set up a cron job so you always have the latest version of the file), and when you need it, just copy the pkglist.txt file to the new installation, and navigate to the directory containing it.

    This command comes extremely handy when you need or want to reinstall Arch Linux, because pacman can take a list of packages from a text file and use that as input, so by doing:

    # pacman -S $(< pkglist.txt)

    you can tell pacman to install everything you had before formatting, or to replicate the package list of another machine saving you hours (if not days).

    Command Line shortcuts (distro agnostic)

    This shortcuts are totally awesome and easy to learn, the web is filled with pages explaining how to use them, but for reference, here is a quick explanation:

    ctrl + u = cuts a command from the cursor position until de start of the line

    ctrl + y = recovers a command previously cut with ctrl + u

    ctrl + r = search a command you have typed before (very useful for long one-liner commands that are hard to remember). If the first command returned is not the one you are looking for, press ctrl + r again and it will get to the next result. To execute the command one you have found it, just press enter.

    Wipe a hard drive or USB/Flash media (including the MBR)

    • Filling the disk with all zeros (This may take a while, as it is making every bit of data 0) :
      # dd if=/dev/zero of=/dev/sdX bs=1M
    • If you are wiping your hard drive for security, you can populate it with random data rather than zeros (This is going to take even longer than the first example.) :
      # dd if=/dev/urandom of=/dev/sdX bs=1M

    Replace sdX with the drive you want to wipe, you can check with a tool such as Gparted so you know the exact location of the drive (it can be different from sdX in some circunstances).

    Incremental backup using rsync

    You don’t need to have expensive or bloated tools to have a nice backup of your system, this command:

    # rsync --delete --backup --backup-dir=/media/usborexternaldrive/backup-`date +%A` -avz /home/ /media/usborexternaldrive/current-backup


    Will backup all your users home directories in an incremental way, with the latest backup (current-backup) being a complete file snapshot, while the others contain just the differences between the current-backup folder and the day of the week you performed the backup.

    You can also mount a network folder or give it your dropbox directory so backups will land there. At the end of the week you will have one backup for each day of the week + a full backup without wasting any hard drive space, very neat!

    Download an entire website

    wget –random-wait -r -p -e robots=off -U mozilla http://www.example.com

    -p parameter tells wget to include all files, including images.

    -e robots=off you don’t want wget to obey by the robots.txt file

    -U mozilla as your browsers identity.

    –random-wait to let wget chose a random number of seconds to wait, avoid get into black list.

    Other Useful wget Parameters:

    –limit-rate=20k limits the rate at which it downloads files.

    -b continues wget after logging out.

    -o $HOME/wget_log.txt logs the output

    Remove spaces from all file names in a folder

    for file in *; do mv "$file" `echo $file | sed -e 's/  */_/g' -e 's/_-_/-/g'`; done

    Windows users like to put spaces in filenames (which is a pain on the linux console because
    you have to "escape" every space), this command will replace all spaces with dashes and
    underscores, saving you lots of time!