Wordlists with crunch

Crunch is very nice, fast and and well configurable wordlist generator. You can specify character sets and generate wordlists in all possible combinations.

Conditions

Linux/Mac OS X with C compiler and make

For Mac OS X users, just install the Command Line Tools.

Steps

Download the latest source from SourceForge.net, unzip and compile.

# unzip
$ tar -zxvf crunch-3.6-2.tgz

# go into folder
$ cd crunch-x.x

# compile
$ make -f Makefile

After create the crunch executable you can start to create wordlist files.

Examples

The first example create the wordlist direct in terminal. All words contain 5 letters with chars “a”, “b” and “c”.

$ ./crunch 5 5 abc

The next example create the wordlist into the file (mylist.txt) with 5 numbers of 0 to 9.

$ ./crunch 5 5 0123456789 -o myfile.txt

Now it should create words with different length from 1 to 3 and mix of chars (A,B,C) and numbers (1,2,3).

$ ./crunch 1 3 ABC123 -o myfile.txt

There is more, crunch include permutation and defined charsets.

# example permutation
# the numbers aren't processed but are needed
$ ./crunch 4 5 -p peter tom susi

# example charset numeric (0-9)
$ ./crunch 5 5 -f ./charset.lst numeric -o myfile.txt

# example invert
$ ./crunch 5 5 -i -f ./charset.lst numeric -o myfile.txt

It is possible to use placeholder (like: @ , % and ^), to define the target size of files and compression. You can create wordlists for IBAN, telephone numbers, e-mails and many more. Read the man page of crunch!!!

# example
$ ./crunch 8 8 -t %%%%%%%%% -u | aircrack-ng -e [SSID] -w [*.cap]
  • @ will insert lower case characters
  • , will insert upper case characters
  • % will insert numbers
  • ^ will insert symbols

Last comment

Please be carefully with generated file size!!!

Command line banner grabbing

For security audit, banner grabbing is one of the first activities to determine information about services on a remote computer. This article describe some very simple methods for command line banner grabbing without nmap.

telnet

# Example
$ telnet example.com 80
GET / HTTP/1.1
Host: example.com
[ENTER]

netcat

# Example
$ nc example.com 80
GET / HTTP/1.1
Host: example.com
[ENTER]

curl

# Example
$ curl -I example.com

“-I” for fetch only HTTP-header

wget

# example
$ wget -q -S example.com

“-q” for turn off Wget’s output. “-S” for print the headers

Create PDF documentation on the fly

In software development, testers need to create a lot of documentation. Mac users can create very comfortable the documentation in PDF.

manpage to PDF

# Create PDF from manpage ping and open in Preview.app
$ man -t ping | open -f -a /Applications/Preview.app

Text to PDF

# Create PDF from text file
$ cupsfilter foo.txt > lorem.pdf 2> /dev/null

# Create PDF from text file and open in Preview.app
$ cupsfilter foo.txt 2>/dev/null | open -f -a /Applications/Preview.app

Image to PDF

# Create PDF from JPG
$ sips -s format pdf test.jpg --out test.pdf

Command’s to PDF

Many test steps would be carried out via command line and again later documented. This takes a lot of time and can lead to errors in documentations.

# Create file from history
$ history > history.txt

# Create PDF from history.txt
$ cupsfilter history.txt 2>/dev/null | open -f -a /Applications/Preview.app

PostScript to PDF

# Convert PostScript into PDF
$ pstopdf foo.ps

# Convert PostScript into PDF with specific name
$ pstopdf foo.ps -o bar.pdf

Create test files on the fly

In many cases test files are needed for software tester. Partially with specified file size. With a small set of commands, it is very easy to create these files. In order to check the generated file(s), you can use the following:

# Check file size
$ ls -lh test-file

# Determine file type
$ file test-file

# Display output one screen
$ less test-file

# or
$ hexdump test-file

Perl

# Example for 1.0K
$ perl -e 'print "a" x 1024' > test-file

# Example for 1.0M
$ perl -e 'print "a" x 1048576' > test-file

mkfile

# Example for 1.0K
$ mkfile 1k test-file

# Example for 1.0M
$ mkfile 1m test-file

dd

# Example for 1.0K
$ dd if=/dev/zero of=test-file bs=1k count=1

# Example for 1.0M
$ dd if=/dev/zero of=test-file bs=1m count=1

base64

# Example for 1.0K
$ base64 /dev/urandom | head -c 1024 > test-file

# Example for 1.0M
$ base64 /dev/urandom | head -c 1048576 > test-file