Search This Blog

Tuesday, November 20, 2012

Install Intel Ethernet drivers on Ubuntu 10.04

This is one thing which I kept on doing every time I do sudo apt-get update; apt-get upgrade on my Ubuntu desktop. Thought someone could be stuck with similar issue.

Ok. If you are getting errors while installing Intel Ethernet drivers on Ubuntu as follows:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo make install
Makefile:71: *** Kernel header files not in any of the expected locations.
Makefile:72: *** Install the appropriate kernel development package, e.g.
Makefile:73: *** kernel-devel, for building kernel modules and try again.  Stop.

then you need to follow following steps:

1. Install kernel headers for your kernel version:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  linux-headers-2.6.32-45
The following NEW packages will be installed:
  linux-headers-2.6.32-45 linux-headers-2.6.32-45-generic
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 11.0MB of archives.
After this operation, 85.3MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://in.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-45 2.6.32-45.99
  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Err http://in.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-45-generic 2.6.32-45.99
  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45_2.6.32-45.99_all.deb  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Of course, as you do not have Internet connection, it can not download / fetch the required packages from the server. But by executing this command, you get to know what packages has to be downloaded from the Ubuntu servers.
In my case, those are: linux-headers-2.6.32-45 & linux-headers-2.6.32-45-generic.

2. So, lets download those packages from the URL's:
http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45_2.6.32-45.99_all.deb
http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb

3. Once downloaded (from some box having active Internet connection), we will try to install it on our machine:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo dpkg -i linux-headers-2.6.32-45*
Selecting previously deselected package linux-headers-2.6.32-45.
(Reading database ... 165649 files and directories currently installed.)
Unpacking linux-headers-2.6.32-45 (from .../linux-headers-2.6.32-45_2.6.32-45.99_all.deb) ...
Selecting previously deselected package linux-headers-2.6.32-45-generic.
Unpacking linux-headers-2.6.32-45-generic (from .../linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb) ...
Setting up linux-headers-2.6.32-45 (2.6.32-45.99) ...
Setting up linux-headers-2.6.32-45-generic (2.6.32-45.99) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic

run-parts: executing /etc/kernel/header_postinst.d/nvidia-common 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic

user@ubuntu:~/e1000e-x.xx.x/src$

4. Now, we will try to 'make install':

user@ubuntu:~/e1000e-x.xx.x/src$ sudo make install
make -C /lib/modules/2.6.32-45-generic/build SUBDIRS=/home/user/e1000e-x.xx.x/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-45-generic'
  CC [M]  /home/user/e1000e-x.xx.x/src/netdev.o
  CC [M]  /home/user/e1000e-x.xx.x/src/ethtool.o
  CC [M]  /home/user/e1000e-x.xx.x/src/param.o
  CC [M]  /home/user/e1000e-x.xx.x/src/82571.o
  CC [M]  /home/user/e1000e-x.xx.x/src/ich8lan.o
  CC [M]  /home/user/e1000e-x.xx.x/src/80003es2lan.o
  CC [M]  /home/user/e1000e-x.xx.x/src/mac.o
  CC [M]  /home/user/e1000e-x.xx.x/src/nvm.o
  CC [M]  /home/user/e1000e-x.xx.x/src/phy.o
  CC [M]  /home/user/e1000e-x.xx.x/src/manage.o
  CC [M]  /home/user/e1000e-x.xx.x/src/kcompat.o
  LD [M]  /home/user/e1000e-x.xx.x/src/e1000e.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/user/e1000e-x.xx.x/src/e1000e.mod.o
  LD [M]  /home/user/e1000e-x.xx.x/src/e1000e.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-45-generic'
# remove all old versions of the driver
find /lib/modules/2.6.32-45-generic -name e1000e.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-45-generic -name e1000e.ko.gz -exec rm -f {} \; || true
install -D -m 644 e1000e.ko /lib/modules/2.6.32-45-generic/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko
/sbin/depmod -a || true
install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
man -c -P'cat > /dev/null' e1000e || true
e1000e.

This looks good.

5. Although after all this, sudo modprobe e1000e didn't work and I didn't get the Ethernet connection back. :-(
You will have to make sure that older e1000e drivers are removed from the kernel, before loading the new module.

user@ubuntu:~/e1000e-x.xx.x/src$ sudo rmmod e1000e
user@ubuntu:~/e1000e-x.xx.x/src$ sudo modprobe e1000e
user@ubuntu:~/e1000e-x.xx.x/src$


..............Done!!!

Tuesday, August 7, 2012

sqlmap - NTLM authentication

It's been while I've posted anything new.
Had to stumble upon for an issue, while I was searching for NTLM authentication with 'sqlmap'.
Well if you are using sqlmap from BackTrack, this post is not for you. :-)

But, if you are trying your hands-on with sqlmap on your favorite Linux distro(Ubuntu, in my case), then this post will help you use sqlmap against NTLM authentication-based websites.

So here we go:

1.Tried running sqlmap with --auth-type and --auth-cred switches:

user@ubuntu:~$ ./sqlmap.py --auth-type=NTLM --auth-cred="DOMAIN\username:password" -u "http://www.domain.com/home.php?vulnid=1" -p "vulnid"

    sqlmap/0.9 - automatic SQL injection and database takeover tool
    http://sqlmap.sourceforge.net

[*] starting at: 12:22:48

[12:22:48] [CRITICAL] sqlmap requires Python NTLM third-party library in order to authenticate via NTLM, http://code.google.com/p/python-ntlm/

[*] shutting down at: 12:22:48


2. Failed. Ok. Downloaded python-ntlm library and try to install:

user@ubuntu:~$ sudo python setup.py install
Traceback (most recent call last):
  File "setup.py", line 1, in 
    from setuptools import setup, find_packages
ImportError: No module named setuptools


3. Failed again. Will try to install setuptools. Download setuptools from here:


user@ubuntu:~$ sudo sh setuptools-0.6c11-py2.7.egg 
[sudo] password for user: 
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding setuptools 0.6c11 to easy-install.pth file
Installing easy_install script to /usr/local/bin
Installing easy_install-2.7 script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11


4. After successfully installing setuptools, try again installing python-ntlm library:

user@ubuntu:~$ user@ubuntu:~$ sudo python setup.py install
running install
Checking .pth file support in /usr/local/lib/python2.7/dist-packages/
/usr/bin/python -E -c pass
TEST PASSED: /usr/local/lib/python2.7/dist-packages/ appears to support .pth files
running bdist_egg
running egg_info
creating python_ntlm.egg-info
writing python_ntlm.egg-info/PKG-INFO
writing top-level names to python_ntlm.egg-info/top_level.txt
writing dependency_links to python_ntlm.egg-info/dependency_links.txt
writing entry points to python_ntlm.egg-info/entry_points.txt
writing manifest file 'python_ntlm.egg-info/SOURCES.txt'
writing manifest file 'python_ntlm.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/ntlm
copying ntlm/des_data.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/des_c.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/U32.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/ntlm.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/__init__.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/des.py -> build/lib.linux-x86_64-2.7/ntlm
copying ntlm/HTTPNtlmAuthHandler.py -> build/lib.linux-x86_64-2.7/ntlm
creating build/bdist.linux-x86_64
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/des_data.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/des_c.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/U32.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/ntlm.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/__init__.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/des.py -> build/bdist.linux-x86_64/egg/ntlm
copying build/lib.linux-x86_64-2.7/ntlm/HTTPNtlmAuthHandler.py -> build/bdist.linux-x86_64/egg/ntlm
byte-compiling build/bdist.linux-x86_64/egg/ntlm/des_data.py to des_data.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/des_c.py to des_c.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/U32.py to U32.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/ntlm.py to ntlm.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/des.py to des.pyc
byte-compiling build/bdist.linux-x86_64/egg/ntlm/HTTPNtlmAuthHandler.py to HTTPNtlmAuthHandler.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying python_ntlm.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating dist
creating 'dist/python_ntlm-1.0.1-py2.7.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing python_ntlm-1.0.1-py2.7.egg
creating /usr/local/lib/python2.7/dist-packages/python_ntlm-1.0.1-py2.7.egg
Extracting python_ntlm-1.0.1-py2.7.egg to /usr/local/lib/python2.7/dist-packages
Adding python-ntlm 1.0.1 to easy-install.pth file
Installing ntlm_example_extended script to /usr/local/bin
Installing ntlm_example_simple script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/python_ntlm-1.0.1-py2.7.egg
Processing dependencies for python-ntlm==1.0.1
Finished processing dependencies for python-ntlm==1.0.1


5. So, python-ntlm library has been installed successfully. Now we try again running sqlmap with --auth-type and --auth-cred switches:


user@ubuntu:~$ ./sqlmap.py --auth-type=NTLM --auth-cred="DOMAIN\username:password" -u "http://www.domain.com/home.php?vulnid=1" -p "vulnid"

    sqlmap/0.9 - automatic SQL injection and database takeover tool
    http://sqlmap.sourceforge.net

[*] starting at: 12:35:38

[12:35:39] [INFO] using '/home/user/sqlmap/output/domain.com/session' as session file
[12:35:47] [INFO] testing connection to the target url
[12:36:11] [INFO] testing if the url is stable, wait a few seconds
[12:36:12] [INFO] url is stable
[12:36:12] [INFO] testing sql injection on GET parameter 'vulnid'
[12:36:12] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[12:36:13] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[12:36:14] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[12:36:14] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause'
[12:36:15] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[12:36:15] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[12:36:15] [INFO] testing 'PostgreSQL > 8.1 stacked queries'
[12:36:16] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries'
[12:36:16] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[12:36:17] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[12:36:17] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind'
[12:36:17] [INFO] testing 'Oracle AND time-based blind'
[12:36:18] [INFO] testing 'MySQL UNION query (NULL) - 1 to 10 columns'
[12:36:22] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[12:36:22] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS
.
.
.
.
</..snip..>;



..............Done!!!