Information Security, Web, Networks and Systems

Tuesday, December 23, 2014

Installing CUDA Toolkit 6.5 in Ubuntu 14.10/14.04

10:44 PM Posted by Deepal , , , 14 comments

Checking system capability

First of all, you need to check whether your GPU is CUDA-capable. You can see whether your GPU is listed in CUDA GPUs at https://developer.nvidia.com/cuda-gpus.

Download

Download the CUDA Toolkit from,  https://developer.nvidia.com/cuda-downloads
You need to download the RUN installer for Ubuntu 14.04.

Installing background

Before installing CUDA toolkit, you need to first install nvidia proprietery driver in Ubuntu. You can install this using Additional Drivers in Ubuntu.

Then you need to exit the ubuntu graphics session and go to CLI. For this, press ctrl+alt+f1 and run the following command to stop lightdm display manager.

sudo service lightdm stop

Once the lightdm is stopped, you can proceed to next steps.

Installing Prerequisites

If your system does not include necessary dependencies, you might encounter following error when installing CUDA toolkit.

Missing recommended library: libGLU.so
Missing recommended library: libXi.so
Missing recommended library: libXmu.so
Missing recommended library: libGL.so

You need to install additional libraries which installs above dependencies as follows:

sudo apt-get install libglu1-mesa libxi-dev libxmu-dev

Installing CUDA toolkit and samples

Once dependencies are installed, go to where the CUDA toolkit is downloaded, and run the following command to start the installation.

sudo chmod a+x cuda_6.5.14_linux_64.run
sudo ./cuda_6.5.14_linux_64.run

If you get an error saying,

Unsupported compiler 4.*.*. Use --override to override this check

it says that your gcc compiler is incompatible with the installation. To prevent this error, you need to change the installation step as,

sudo ./cuda_6.5.14_linux_64.run --override compiler

You can then accept the EULA, and at the next step, do not install nvidia accellerated graphics driver(select no to when asking to install the driver), since we already have installed a proprietery driver.

If everything went well, your installation will complete successfully. After installation, you can enable Nvidia C Compiler (nvcc) by including following lines at the end of ~/.bashrc file.

For 32 bit include following two lines at the end of bashrc file

export PATH=$PATH:/usr/local/cuda-6.5/bin
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib

For 64 bit include following two lines at the end of bashrc file

export PATH=$PATH:/usr/local/cuda-6.5/bin
export LD_LIBRARY_PATH=/usr/local/cuda-6.5/lib64:/lib

When it is done, you can check you ncc by running the command,

nvcc --version

You can then go back to your graphics session by running,

sudo service lightdm start

These steps worked for me. Feel free to put a comment below if you encounter an error during installation.

Thank you.

Tuesday, July 8, 2014

Thursday, April 17, 2014

Configuring Secure IIS Response Headers in ASP.NET MVC

In a previous post I talked about how to configure a secure response in Apache by adding secure response headers (such as X-Frame-Options, X-XSS-Protection etc) and omitting headers that disclose internal implementation and technical details of the apache web server (such as X-Powered-By). In this post, I will talk about how to do this in an ASP.NET MVC web application. Instead of configuring these settings in the IIS server, this time I'm going to do this in the ASP.NET code itself since it gives more flexibility and does not affect other applications hosted on the same IIS server.

Using Anti Forgery Tokens with AJAX in ASP.NET

As you know, we can use anti forgery tokens to prevent Cross Site Request Forgery. Usually we add an anti forgery token in a hidden form field of the form. Each time we post the form to the server, server validates the request using the token in the hidden form field and the other one which is sent as a Cookie. See this post in my blog for more detailed information.
              But when we use AJAX to post data to the server asynchronously, we do not use forms most of the times. In those cases we explicitely need to attach the anti forgery token to our data which is sent via ajax. We can do this by some simple javascript.

Sunday, March 2, 2014

Apache Security - Configuring Secure Response Headers

In this post I talk about how to configure some security options of Apache Web Server. A proper configuration of Apache Web server may extreamely important since it sometimes can prevent certain Web Application Attacks even though the vulnerability is there in the web application. In this post I'll describe how to set configure apache to send Security concerned HTTP headers in its response and hide sensitive information from server response headers.

Friday, February 21, 2014

Anti-CSRF Tokens to prevent Cross Site Request Forgery (CSRF)

Cross Site Request Forgery is a client side Web Application Attack where attacker tricks victim to execute a malicious web request on behalf of himself. Attacker may send a link to the victim, with a little bit of Social Engineering, he will make victim click on the link. Then victim unintentionally issues a request to the web server which he did not intended to do. Lets see an example.

Wednesday, February 19, 2014

Secure Web Application Development Tips for Beginners

In this post I like to share some important facts I recently learned related to Secure Web Application Development. An expert in Secure Web Application development/Web Application Secure assessment will see these tips trivial, but I really hope they are important for those who are new to Web Application Development.

Thursday, December 19, 2013

Deep Dive into Tor - Introduction

TOR, The Onion Router in long terms, is a world well known Anonymous Network which provides users browse internet 'Completely' anonymous. Highlighting the word 'Completely' I don't say that nobody will ever know who you are and what you say in the internet through Tor. I will later describe some situations in which this 'Completely' term 'Completely' breaks.

Sunday, September 8, 2013

Sniff Public Traffic with Wireshark Monitor Mode and BroadCom Wirelesscard in Ubuntu

In this post I'll show you how to sniff packets with Wireshark Monitor mode in Ubuntu. First of all you need to check what wireless driver you have installed in your computer. In my case in ubuntu 13.04, you can check your driver installation at Additional Drivers.

Thursday, September 5, 2013

Change Screen Brightness in Ubuntu Terminal

11:35 AM Posted by Deepal , , , , No comments
I had a problem in my HP pavilion G6 Laptop with brightness change. I could not change the brightness using my function keys. Though I could change brightness by the Brightness & Lock settings, lowest brightness level was too bright for me. So I used following method to reduce the brightness.

    sudo -s
    nano /sys/class/backlight/intel_backlight/brightness

(In my case it was intel_backlight. This may change from computer to computer.) Edit the value of the file. In my case, the value was about 4000. So I reduced it to 800 and saved. Then the brightness was reduces. You can reduce the brightness into any level by just editing this file.

If you want to reduce the brightness at every startup, include following command in /etc/rc/local file.( /etc/rc.local file is executed at the end of every startup. If you put a command there, you can run that command at every startup)

    echo 800 > /sys/class/backlight/intel_backlight/brightness

Restart your computer and you'll see your command is effective.

A little more fun :


I created a small shell script (.sh) to reduce my brightness to any amount at any time easily. But for this script I would have changed the brightness using the entire command given above. This shell script made it easy. I just needed to execute the shell script and pass brightness value as a command line parameter as follows.

./brightness 600

Here is my shell script:

    #!/bin/sh
    echo $1 > /sys/class/backlight/intel_backlight/brightness
    echo "[+] Brightness set to $1n"