Our social:

Latest Post

Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Installing and configuring NVIDIA video card drivers

In this , we will embrace CUDA, the NVIDIA parallel computing architecture. The first step will be the installation of the NVIDIA developer display driver followed by the installation of the CUDA toolkit. This will provide us with a dramatic increase in computer performance with the power of the GPU, which will be used in scenarios such as password cracking.
The following requirements need to be fulfilled:
1.       An Internet connection is required to complete this recipe
2.       The preparation of the kernel headers is needed before starting this task, which is explained in the Preparing kernel headers recipe at the beginning of this chapter
3.       In order to accomplish the installation of the NVIDIA driver, the X session needs to be shut down
How to do it...
Let's begin the process of installing and configuring the NVIDIA video card driver:
1.        Download the NVIDIA developer display driver according to your CPU architecture:
cd /tmp/




2. Install the driver:
chmod +x NVIDIA-Linux-x86_64-285.05.33.run
./NVIDIA-Linux-x86_64-285.05.33.run –kernel-source-path='/usr/src/linux'
3. Download the CUDA toolkit:
4. Install the CUDA toolkit to /opt:
chmod +x cudatoolkit_4.1.28_linux_64_ubuntu11.04.run
./cudatoolkit_4.1.28_linux_64_ubuntu11.04.run
5. Configure the environment variables required for nvcc to work:
echo PATH=$PATH:/opt/cuda/bin >> ~/.bashrc
echo LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/cuda/lib >> ~/.bashrc
echo export PATH >> ~/.bashrc
echo export LD_LIBRARY_PATH >> ~/.bashrc
6. Run the following command to make the variables take effect:
source ~/.bashrc
ldconfig
7. Install Pyrit dependencies:
apt-get install libssl-dev python-dev python-scapy
8. Download and install the GPU powered tool, Pyrit:
svn co http://pyrit.googlecode.com/svn/trunk/ pyrit_src
cd pyrit_src/pyrit
python setup.py build
python setup.py install
9. Finally, add the NVIDIA GPU module to Pyrit:
cd /tmp/pyrit_src/cpyrit_cuda
python setup.py build
python setup.py install

Installing and configuring ATI video card drivers

In this, we'll go into the details for installing and configuring the ATI video card driver, followed by the AMD Accelerated Parallel Processing (APP) SDK, CAL++, and OpenCL. Taking advantage of the ATI Stream Technology, we can run computationally-intensive tasks, typically running on the CPU, more quickly and efficiently. For more detailed information regarding the ATI Stream technology, visit www.amd.com/stream.
The following requirements need to be fulfilled:
·         A connection to the Internet is required to complete this recipe
·         The preparation of the kernel headers is needed before starting this task, which is explained in the Preparing kernel headers recipe at the beginning of this chapter
How to do it...
Let's begin installing and configuring the ATI drivers:
1. Download the ATI display driver required for our system:
cd /tmp/



2. Start the installation by typing the following command:
sh amd-driver-installer-12-1-x86.x86_64.run


3. When the setup completes, reboot your system for the changes to take effect and to prevent system instability.

4. Install the dependencies needed for further steps:
apt-get install libroot-python-dev libboost-python-dev libboost1.40-all-dev cmake
5. Download and untar the AMD APP SDK according to your CPU architecture:
wget http://developer.amd.com/Downloads/AMD-APP-SDK-v2.6- lnx64.tgz
mkdir AMD-APP-SDK-v2.6-lnx64
tar zxvf AMD-APP-SDK-v2.6-lnx64.tgz –C /tmp/AMD-APP-SDK-v2.6- lnx64
cd AMD-APP-SDK-v2.6-lnx64
6. Install AMD APP SDK by issuing the following command:
sh Install-AMD-APP.sh
7. Set the ATI Stream paths into the .bashrc file:
echo export ATISTREAMSDKROOT=/opt/AMDAPP/ >> ~/.bashrc
source ~/.bashrc
8. Download and compile CAL++:
cd /tmp/
svn co https://calpp.svn.sourceforge.net/svnroot/calpp calpp
cd calpp/trunk
cmake
make
make install
9. Download and compile Pyrit:
cd /tmp/
svn co http://pyrit.googlecode.com/svn/trunk/ pyrit_src
cd pyrit_src/pyrit
python setup.py build
python setup.py install
10. Build and install OpenCL:
cd /tmp/pyrit_src/cpyrit_opencl
python setup.py build
python setup.py install
11. Make a few changes to the cpyrit_calpp setup:
cd /tmp/pyrit_source/cpyrit_calpp
vi setup.py
Replace the following line:
VERSION = '0.4.0-dev'
With:
VERSION = '0.4.1-dev'
And also the following line:
CALPP_INC_DIRS.append(os.path.join(CALPP_INC_DIR, 'include'))
With:
CALPP_INC_DIRS.append(os.path.join(CALPP_INC_DIR, 'include/CAL'))
12. Finally, add the ATI GPU module to Pyrit:
python setup.py build
python setup.py install



Directory encryption (By using Truecrypt)

The last recipe of this chapter will be about information privacy. We will use TrueCrypt to hide important and secret digital information from public eyes with encryption keys.
How to do it...
Let's perform the following steps:

1.     1.   Install TrueCrypt by clicking on the Applications menu and navigating to BackTrack | Forensics | Digital Anti Forensics | install truecrypt. Click on Install TrueCrypt and follow the onscreen directions:


1.      2.  Launch TrueCrypt from Applications | BackTrack | Forensics | Digital Anti Forensics | truecrypt to find a window similar to the following screenshot:

3. Click on Create Volume to start TrueCrypt Volume Creation Wizard.
4. Leave the default option and click on Next.
5. Select Standard TrueCrypt volume and click on Next.
6. Click on the Select File… button and specify a name and location for the new TrueCrypt volume. Click on Save when done:


7. Click on the Next button and select the encryption and hash algorithm we want to use.
8. In the next screen, we'll specify the amount of space we want for the container.
9. Now, we need to type the password for our volume. Once done, click on Next.
10. Choose the filesystem type.
11. Select the cross-platform support depending on your needs.
12. At the next screen, the wizard asks us to move around the mouse within the window to increase the cryptographic strength of the encryption keys. When done, click on the Format button.
13. The formatting will start and ends with the creation of the TrueCrypt volume. Click on OK and Exit.
14. We're now back to the TrueCrypt window.
15. To decrypt our volume, pick a slot from the list, click on Select File…, and open our created volume.
16. Click on Mount and type your password. Click on OK when done:


17. We can now access the volume by double-clicking on the slot or through the mount directory. Save files in it and when finished, simply click on Dismount All.







Setting up ProxyChains in Backtrack


ProxyChains is a program that allows us to force any TCP connection made by an application through a proxy. In this recipe, we will be discussing the task of breaking the direct connection between the receiver and the sender by forcing the connection of given applications through a user-defined list of proxies.
How to do it...
Let's begin the process of setting up ProxyChains:
1. Open the ProxyChains configuration file:
vim /etc/proxychains.conf

2. Uncomment the chaining type we want to use, in this case dynamic_chain:


3. Add some proxy servers to the list:


4. Resolve the target host through our chained proxies:
proxyresolv www.targethost.com
5. Now we can run ProxyChains through the application we want to use. For example:
proxychains msfconsole

Applying updates and configuring extra security tools in Backtrack

In this recipe, we will cover the process of updating BackTrack and configuring some extra tools, which will be useful in later chapters and recipes. As BackTrack packages are constantly updated between releases, you will soon find that a newer set of tools are available than what were originally downloaded on your DVD ROM. We will dive into updating our installation, obtaining an activation code for Nessus, and concluding with installing Squid.
How to do it...
Let's begin the process of applying updates and configuring extra security tools:
1. Update the local package index with the latest changes made in the repositories:
apt-get update
2. Upgrade existing packages:
apt-get upgrade
3. Upgrade to the new version (if available):
apt-get dist-upgrade
4. Obtain an activation code for Nessus by registering at the following website:
http://www.nessus.org/products/nessus/nessus-plugins/obtain-an-activation-code
5. Activate Nessus by executing the following command:
/opt/nessus/bin/nessus-fetch --register A60F-XXXX-XXXX-XXXX-0006
Where A60F-XXXX-XXXX-XXXX-0006 should be your activation code.
6. Create a user account for the Nessus web interface:
/opt/nessus/sbin/nessus-adduser
7. To start the Nessus server, we simply invoke the following command:
/etc/init.d/nessusd start
8. Install Squid:
apt-get install squid3
9. Remove Squid from starting up automatically at boot time:

update-rc.d -f squid3 remove

Installing Broadcom drivers in Backtrack

In this , we'll perform the installation of the official Broadcom hybrid Linux wireless driver. Using a Broadcom wireless USB adapter gives us the greatest possibility of success in terms of getting our wireless USB access point to work on BackTrack 5. For the rest of the recipes in this book, we will assume installation of the Broadcom wireless drivers.
An Internet connection is required to complete this recipe.
How to do it...
Let's begin the process of installing the Broadcom drivers:
1. Open a terminal window and download the appropriate Broadcom driver from http://www.broadcom.com/support/802.11/linux_sta.php:



2. Extract the downloaded driver by using the following script:
mkdir broadcom
tar xvfz hybrid-portsrc_x86_64-v5_100_82_112.tar.gz -C /tmp/broadcom
3. Modify the wl_cfg80211.c file as there's a bug in version 5.100.82.112 that prevents compiling the code under kernel version 2.6.39:
vim /tmp/broadcom/src/wl/sys/wl_cfg80211.c
In the file, the following line at line number 1814 needs to be replaced:
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 39)
It needs to be replaced with:
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39)
Once done, save the changes.
4. Compile the code:
make clean
make
make install
5. Update the dependencies:
depmod -a
6. Find loaded modules by issuing the following command:
lsmod | grep b43\|ssb\|bcma
7. Remove the modules found by executing the following command:
rmmod <module>b43
Where <module> could be: b43 or ssb or bcma.
8. Blacklist the modules to prevent them from loading at system startup:
echo "blacklist <module>" >> /etc/modprobe.d/blacklist.conf
Where <module> could be: b43 or ssb or bcma or wl.
9. Finally, add the new module to the Linux kernel to make it part of the boot process:
modprobe wl

Preparing kernel headers

There will be occasional times where we'll face the need to compile code, which requires the kernel headers. Kernel headers are the source code of the Linux kernel. In this first recipe, we'll explain the steps required to accomplish the task of preparing the kernel headers for compilation.
Getting ready
A connection to the Internet is required to complete this recipe.
How to do it...
Let's begin the process of preparing the kernel headers:
1. Execute the following script to prepare the kernel sources:

prepare-kernel-sources


2. Copy the following directory and its entire contents:

cd /usr/src/linux
cp -rf include/generated/* include/linux/
3. Now we're ready to compile code that requires the kernel headers.

Setting up the wireless network in Backtrack

The advantages of setting up our wireless network is that it enables us to use BackTrack wirelessly. In a true, ethical, penetration test, not having to depend on an Ethernet cable enables us to have all of the freedoms of a regular desktop.
How to do it...
Let's begin setting up the wireless network:
1. From the desktop, start the network manager by clicking on the Applications menu and navigating to Internet | Wicd Network Manager, or by issuing the following command at the Terminal window:
wicd-gtk --no-tray

2. Wicd Network Manager will open with a list of available networks:


3. Click on the Properties button to specify the network details. When done, click on OK:



4. Finally, click on the Connect button. We're ready to go!

Starting network services in Backtrack

BackTrack comes with several network services, which may be useful in various situations and are disabled by default. In this recipe, we will cover the steps to set up and start each service using various methods.
Getting ready
A connection to the network with a valid IP address is needed in order to continue.
How to do it...
Let's begin the process of starting our default service:
1. Start the Apache web server:
service apache2 start
We can verify the server is running by browsing to the localhost address.
2. To start the SSH service, SSH keys need to be generated for the first time:
sshd-generate
3. Start the Secure Shell server:
service ssh start
4. To verify the server is up and listening, use the netstat command:
netstat -tpan | grep 22
5. Start the FTP server:
service pure-ftpd start

6. To verify the FTP server, use the following command:
netstat -ant | grep 21

7. To stop a service, just issue the following command:
service <servicename> stop
Here, <servicename> stands for the network service we want to stop. For example:
service apache2 stop

8. To enable a service at boot time, use the following command:
update-rc.d –f <servicename> defaults

Here, <servicename> stands for the network service we want at boot time. For example:

update-rc.d –f ssh defaults

Changing the root password in Linux

For security reasons, it's recommended as a good practice to always change the default root password. This would not prevent a malicious user obtaining access to our system, but surely will make things harder.
How to do it...
To change the default root password, just issue the following command:
passwd

Enter you new password and press Enter. You will also be asked to retype your password:


Installing BackTrack to a USB drive with persistent memory

Having a BackTrack USB drive provides us with the ability to persistently save system settings and permanently update and install new software packages onto the USB device, allowing us to carry our own personalized BackTrack with us at all times.
Thanks to open source tools such as UNetbootin, we can create a bootable Live USB drive of a vast majority of Linux distributions, including BackTrack with persistent storage.
The following tools and preparation are needed in order to continue:
·         A FAT32 formatted USB drive with a minimum capacity of 8 GB
·         A BackTrack ISO image
·         UNetbootin (unetbootin.sourceforge.net/unetbootin-windows-latest. exe)
·         You can download BackTrack 5 from http://www.backtrack-linux.org/ downloads/

Let's begin the process of installing BackTrack 5 to a USB drive:

1.       Insert our previously formatted USB drive:


2. Start UNetbootin as administrator.

3. Choose the Diskimage option and select the location of the BackTrack DVD ISO image:


4. Set the amount of space to be used for persistence. We're going to use 4096 MB for our       8 GB USB thumb drive:


5. Select our USB drive and click on the OK button to start creating the bootable USB drive.

6. The process will take some time to complete while it extracts and copies the DVD files to the USB and installs the Bootloader:


7. The installation is complete and we're ready to reboot the computer and boot from the newly created BackTrack USB drive with persistent memory: