All posts tagged kali

Well, last time we covered how to install nvidia drivers on Kali 2016.1 i.e. sana. This time I’m here to update it to the latest of the latest version. The tutorial is pretty easy to follow. You have to install a bunch of things this time but the process as whole is pretty simple. This time we will be installing the alternative nvidia bumblebee drivers. So here it goes.

Now the steps here are pretty simple. If you need a detailed guide. Hit me up!

Analyze the system

First step is to know the system thoroughly, first check nvidia card

lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia'

this should return something like bellow, which will give you a brief information about your nvidia GPU, some recent GPU shows them as 3D controllers.

01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev ff) (prog-if ff)

Now check the currently loaded nouveau (free nvidia driver) module and vga_switcheroo module,

lsmod | grep -i 'nouveau'
lsmod | grep -i 'vga_switcheroo'

Unload nouveau modules and install bbswitch

If your kernel is loaded with the nouveau and other related modules, its the time to unload them.

sudo modprobe -r nouveau
sudo modprobe -r vga_switcheroo

Lets install bbswitch and related components to compile it. Installing bbswitch with dkms will automatically compile proper kernel module after any future kernel update.

apt-get update
apt-get upgrade 
apt-get dist-upgrade
apt-get update
apt-get upgrade 
modprobe -r nouveau 
modprobe -r vga_switcheroo
apt-get install gcc make linux-headers-$(uname -r)
apt-get install dksm bbswitch-dkms 
apt-get install dkms bbswitch-dkms 
modprobe bbswitch load_state=0

Created /etc/modprobe.d/nouveau-blacklist.conf and added “blacklist nouveau” with out quotes

nano /etc/modprobe.d/nouveau-blacklist.conf

nano /etc/modules
Install/Run these commands in sequential order:
apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils
apt-get install bumblebee-nvidia 
sudo dpkg -i /root/Downloads/virtualgl_2.5_amd64.deb 
usermod -aG bumblebee $USER
service bumblebeed restart 
apt-get install devscripts
apt-get build-dep bumblebee
apt-get source bumblebee
sed -i 's/"Xorg"/"\/usr\/lib\/xorg\/Xorg"/' bumblebee-3.2.1/src/bbsecondary.h
bumblebee-3.2.1/
dpkg-buildpackage -us -uc -nc
dpkg -i ../bumblebee_3.2.1-10_amd64.deb 
service bumblebeed restart 
reboot

Uncommented BusID “PCI:01:00:0” and replace the 1 with the number you get from lspci

nano /etc/bumblebee/xorg.conf.nvidia
service bumblebeed restart
optirun -v -b virtualgl -c jpeg glxgears
apt-get install freeglut3-dev libxmu-dev libpcap-dev

nano ~/.bashrc
export PATH=$PATH:/opt/VirtualGL/bin:/usr/local/cuda-7.5/bin
optirun -v -b virtualgl -c jpeg glxgears
optirun -vv glxgears
chmod +x Downloads/cuda_7.5.18_linux.run 
./Downloads/cuda_7.5.18_linux.run --override compiler

nano /etc/ld.so.conf
ldconfig
apt-get install libcuda1
cd /root/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery/
make
optirun ./deviceQuery

Usage

To run your application with the discrete NVIDIA card run in the terminal:

optirun [options] <application> [application-parameters]
For example:

optirun firefox
For a list of options for optirun execute:

optirun --help

Normally you do not use optirun for your window manager, installations, or other non-graphic, resource intensive programs. The optirun command is mainly used for graphic demanding programs (ex. games).

Testing the difference between Intel and the new Nvidia graphics?

After rebooting the system, test the sample glxgears program.

optirun -vv glxgears

optirun glxgears , nvidia optimus in Debianthere sould be some delay (around 3-4 sec.) before starting glxgears, if it returns around or over 1000 FPS performance, that means NVIDIA optimus is working properly. For more information about optirun command, see the man page, man optirun , and run optirun with different arguments, like

optirun -v -b virtualgl -c jpeg glxgears

A more detailed testing and benchmarking the NVIDIA GPU could be done with furmark , which returns more accurate result than this simple glxgears test.

http://fixmynix.com/install-and-configure-nvidia-optimus-with-bumblebee-in-debian/

 

Specially for hackers : You can now run Kali Pentesting OS in your web browser

This bit of news is going to elate hackers and security researchers. Kali Linux is one of the most loved distros by the security community and it is now coming to in your browser.

Network security specialist Jerry Gamblin has created a project called KaliBrowser which allows you to run the world’s best loved Kali Linux operating system on a web browser. Gamblin has used Kali Linux Docker image, Openbox window manager, and NoVNC HTML5-based VNC client to bring Kali OS to your browser.

For the uninitiated, Kali Linux is often heralded as a must have Linux distro for hackers, security researchers and pentesters. It is one of the best security auditing operating systems based on the Linux kernel and the successor of the popular BackTrack. The Kali Linux has itself been upgraded to 2016.1, based on Debian GNU/Linux 8 “Jessie,” and that there’s an official Kali Linux Docker image that lets users run the distro on any platform.

Here’s how to get started with KaliBrowser right now

Those familiar with Kali Linux can use the Docker Linux container engine to run the penetration testing operating system on your web browser. The KaliBrowser can run on all operating systems including Microsoft’s latest Windows 10, by running the following command below in a terminal emulator.

sudo docker run -d -t -i -p 6080:6080 jgamblin/kalibrowser

Once that command finishes downloading and extracting all the files, all you have to do is to open your favorite web browser and point it to http://localhost:6080.

However, please note that this is a basic Kali Linux installation,  so you will need to add additional tools you want. It can be done by installing via the command-line.

The tutorial once again :

It runs the following packages:
Kali Docker
OpenBox
NoVNC

Getting started is as easy as:
docker run -d -t -i -p 6080:6080 jgamblin/kalibrowser

and then point your favorite browser to:
http://ip:6080

To keep this image as small  Gamblin has included only the base Linux (it is still 841MB) A bit advanced version is available here jgamblin/kalibrowser-top10 (2GB) that has the Kali Top 10 metapackage pre installed so if you want that  run:
docker run -d -t -i -p 6080:6080 jgamblin/kalibrowser-top10 

 

Following the official documentation for installing Nvidia driver on Kali 2.0 didn’t work for me. I installed nvidia-kernel-dkms, disabled nouveau driver, and rebooted. Then I had an error saying Something went wrong.. and presented with only a logout button. I was unable to login to the graphical interface. So I dug every bit of information in the internet and finally installed NVIDIA driver (361.28) on Kali (kernel 4.0.0).

Preparation

First, download the driver for your GPU. To know which driver to download, run lspci | grep -E "VGA|3D" command. It will show the GPU you currently have. Mine is GeForce GT 740M. Then look for the appropriate driver for your GPU at Nvidia website. Here are the archives for 64 bit and 32 bit system. After downloading the driver, place it somewhere in your home folder – we will be needing it later. Make it executable chmod +x ~/Downloads/NVIDIAxxxx.run.

Next, install the linux headers:

  • apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
  • aptitude -r install linux-headers-$(uname -r) Where -r means install all recommended packages as well.

 

If you have installed nvidia-kernel-dkms earlier, remove it and all nvidia packages by apt-get remove nvidia* --purge.

Disable nouveau driver

Create a file /etc/modprobe.d/nvidia-installer-disable-nouveau.conf and paste the following lines:

 Stop X server

We need to stop the X server so we can run the Nvidia installer. Kali2.0 uses gdm by default. You can stop the X server by stopping gdm systemctl stop gdm. Another way is to hit Ctrl+Alt+Backspace. You can also try the methods suggestedhere in case previous methods don’t work.

If nothing works then just restart. As you have already disabled nouveau, your kernel won;t be able to load X server or the nouveau driver.

Backup your xorg.conf file (optional)

cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup

Chances are, there won’t be any file to backup.

Install Nvidia Driver

Now, cd into the directory where the installer is located. Then run the installer ./NVIDIAxxxx.run -a. Just accept whatever the installer asks. For 64 bit systems, you might encounter a question about 32bit libs, just ignore it.

After the installation completes, we need to disable the nouveau driver and configure the X server.

Configure X server

(From the Arch wiki )

Then, configure xorg.conf. You will need to know the PCI address of the NVIDIA card, which you can find by issuing lspci | grep -E "VGA|3D". The PCI address is the first 7 characters of the line that mentions NVIDIA. It will look something like01:00.0. In the xorg.conf, you will need to format it as #:#:#; e.g. 01:00.0 would be formatted as 1:0:0.

In my case, the bus id for my GPU was 04:00.0.

Now, you can take the backup of the conf file created while installing Nvidia driver but it is 100% useless and will not work.

Edit/create the file /etc/X11/xorg.conf and add the following lines after removing any other text that is there in that file.

Then create a file /usr/share/gdm/greeter/autostart/display_setup.desktop and paste the following lines:

Reboot and you should be good to go.

Sources

If during the installation of Kali Linux 2.0, you have chose to not use any network mirrors, chances are you  will be using a pretty basic version of the sources.lst file. For those of you don’t know, sources.lst file determines the software repositories from where you can install packages using “apt”. If you have a minimal version of “sources.lst”, you won’t be able to install many of the packages. For example, if you try to install “htop”, you will get an error saying “package not found”. Follow the instructions below to get a full sources.lst file

First of all, let’s move the previous sources.lst file to backup location and then let’s create a new one with needed repositories.

mv /etc/apt/sources.list /etc/apt/sources.list-backup

Now open up a text editor of your choice and open the /etc/apt/sources.list file.

nano /etc/apt/sources.list

Now, copy the following content and paste it in the leafpad window, and save it.

The following is the Kali rolling repository. You should be using this unless you have some reasons to use the old repo.

deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free

The following is the old repositories. Use this only if you know what you are doing.

deb http://http.kali.org/kali sana main non-free contrib
deb http://security.kali.org/kali-security sana/updates main contrib non-free
deb-src http://http.kali.org/kali sana main non-free contrib
deb-src http://security.kali.org/kali-security sana/updates main contrib non-free

That’s it, you should now have access to most of the packages. Once you save the file, do the following command once,

And you’re good to go.

Well, I just installed the latest Kali OS, I found out no guide out there is up to date. So here it is, I’ll try to write as much as possible.

 

Step 1: Get the deb file

You need to download the Chrome .deb file to install on your Kali Machine. Go HERE and download the .deb ( Make sure you download the correct one – 32bit or 64bit )

 

Step 2: Installing the deb using dpkg

Let’s install the .deb file. For that, open up a terminal and “cd” to the directory where you have downloaded the deb file. Remember to use “sudo” if you’re not root. As a side not, you can install any .deb file on Kali or any Debian based distro using the following command.

It will probably show you an error saying there is some dependency issue or some stuff like that.

Install the following package

in terminal Do:

nano /etc/apt/sources.list

And make sure these two lines are there:

deb http://http.kali.org/kali sana main non-free contrib

deb http://security.kali.org/kali-security sana/updates main contrib non-free

ctrl + O to save and ctrl+x to close

 

Type:

  1. apt-get update && apt-get upgrade && apt-get dist-upgrade
  2. apt-get -f install
  3. and again type, apt-get update && apt-get upgrade && apt-get dist-upgrade

Now install chrome with commad: dpkg -i chrome*.deb

I guarantee that chrome gets installed now.

 

Now comes another issue, you cannot run Chrome, yet

 

This is where things get ugly. If you try to open up google chrome, it won’t open. Nothing would happen. Actually, you won’t see any error messages. It just won’t open. And there is a reason why it won’t open, that’s because you’re trying to run it as “root”.

Default user in Kali is “root” and it was done for a reason, Kali is not intended to use as a daily OS. But that does not mean that you can’t use it as a daily OS. In fact, Kali 2.0 is my main OS and it runs without any issues.

If you want to use Chrome, you have two options:

In fact there are several methods by which you can use Google chrome. Most of them involve enabling chrome to be run as root. This is not the right way to handle things. There is a reason why chrome refuses to run as root. That’s because, if you run the browser as root, then someone exploiting your browser could get root privileges. But, anyway, let’s cut to the chase.

Option 1. Create a normal user with sudo privileges to use daily, and use “sudo su -” to switch to root whenever you want.

This is the preferred method. This is how I use Kali. If you want to know how to set up a sudo user in Kali, google it:). I’ll probably write about it later.

Option 2. Create another user and switch to that user in a terminal and open up the applications like google chrome or VLC. Let me explain this for you:

This is how it’s done in the second option:

 

<pre class="toolbar:2 lang:default decode:true "># First of all, we need to enable access to X server for all users
# Otherwise, the newly created user won't be able to run applications with GUI
# Issue the following command
xhost +
# Create a new user. Here bob is the username
adduser bob
# Now the program will ask for password etc, provide them
# Once the user is created, you can switch to the new user using the following command 
su - bob
# Now you're in bob's terminal, and you can open google chrome by typing
google-chrome 
# It should open up the chrome browser</pre>

 

That’s it. That way you can run chrome browser, without changing any system files.