This time i will present 2 tutorials in one. One part describe how to create a simple Python package. The other part gives security testers a hint for sensible data. It is recommended to work with python virtualenv!
Preconditions
Python 2.7.x
pip, virtualenv, setuptools
Skype
Background
Skype stores sensible data, unencrypted, in a simple sqlite database (main.db). You would be surprised what information can be found there!
Example Locations
Mac OS – /Users/Library/Application Support/Skype/main.db
Windows – C:\Documents and Settings\Application Data\Skype\main.db
One way of finding out subdomains are wordlists. Knockpy offers exactly this possibility! It is written in Python, easy to install and to use. The usage of own wordlists is possible, too. The output displayed in the terminal and saved in CSV file.
Precondition
Python installed
Installation
# install with pip
$ sudo pip install https://github.com/guelfoweb/knock/archive/knock3.zip
Usage
# usage with internal wordlist
$ knockpy domain.com
# usage with own wordlist
$ knockpy domain.com -w wordlist.txt
# resolve domain name
$ knockpy -r domain.com
# check zone transfer
$ knockpy -r domain.com
As a penetration tester you may need to check your FTP Server(s). One possibilty is brute-force passwords to auditing. This tutorial show you how easy you can use Python to create such a tool.
It is time again for an extensive tutorial. This time, a tiny test application for passive and active information gathering. After the instruction you are welcome to improve the application with more features! Okay let’s start…
What should it do?
The security tester selects a information gathering method first. As second step the testers insert the URL or IP in a testfield and press a button. The result should printed out in a text area. The GUI should look like this:
How it is implemented?
The prefered language is Python 2.7. So it is portable to different OS and for the most of methods are already packages available. The GUI is done with Tkinter. Tkinter provides all objects which are needed as widgets and ranges for this scope out completely. The file and folder structure look like:
There is a command line tool that allows you to work with the wireless connection on your Mac. The tool is very useful but by default hidden and not well documented.
airport
# show airport help
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport --help
# turn it off
$ networksetup -setairportpower en0 off
# turn it on
$ networksetup -setairportpower en0 on
# join a network
$ networksetup -setairportnetwork en0 <SSID> <Password>
Let`s start a wifi scan and get some information
# scan with interface en0
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 --scan
# show information of en0
$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 --getinfo
Note: If do not specify the interface, airport will use the first wifi interface on the system.
Easy way
# create a symbolic link to the command
$ sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport
# after link created start the scan
$ airport en0 --scan
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!!!