Search This Blog

Friday, March 1, 2013

Install Windows 7 and Ubuntu/Linux Mint on Dell vostro 3460 - having 32GB SSD drive

This was something for which I spent lot of time to make the newly shipped laptop dual boot with Win 7 and Linux Mint (Finally switched from Ubuntu to Linux mint, mainly because of Desktop Environment. I think of conducting a poll of "How many Ubuntu users switched their OS because of Desktop Environment?", or was there any already? Anyway I really got fade up of tweaking and twisting Precise Pangolin having Unity. So its a good feel with Mate on Linux Mint 13).


OK, back to the topic.
New Dell laptops have introduced a new technology called as Intel Rapid Storage Technology for improving protection, performance, etc.: http://www.intel.com/support/chipsets/imsm/sb/CS-020784.htm

They also used Intel Smart Response Technology, Intel Rapid Start Technology, and what not.


My Dell Vostro 3460 has WDC 1TB hard disk and 32GB Samsung SSD drive, with Intel i7 processor and 8GB DDR3 1600MHz RAM, etc.
The 32GB SSD to be used in conjunction with a high-capacity hard disk drive. The combination results in a high-performance, cost-effective storage solution. But only in case of Windows 8. I was quarreling with Dell support guys, what is the point of shipping it with the laptops which can not utilize it. And they say, "Sir, you can upgrade to Windows 8 so to utilize it."




Anyway, here is what I did:

You might not find any drive to install when SATA operation in BIOS is set to Intel RST.


So you would need to go to BIOS and change SATA operation to AHCI.


Then you will see the drives to reformat and install OS.


Disk 0 partitions belong to 32GB SSD drive whereas Disk 1 partitions are present with 1TB WDC hard disk.

There is no possible way to install "System Reserved" - 100MB (Needed for Win 7) in 32GB SSD drive. I tried multiple times to achieve that with no luck. :-(

Also, 32GB space is not enough for C: to install Win 7 onto (with all driver and other installations, etc.). Although its possible. I was installing all rest of the softwares on D: which I had created on 1TB hard disk, but again exception being Graphics driver for Nvidia. As you can not customize the path while installing it.


Finally, after so many alternatives, I thought of installing Linux first, so that I can utilize 32GB SSD drive for '/' partition, as 32GB will be more than enough for '/' partition unlike C: in case of Windows. And installing rest all partitions on 1TB hard disk.
  • Install / partition on 32GB SSD drive
  • 200MB /boot partition on 1TB
  • 200GB C: partition on 1TB
  • Rest all /home partition on 1TB
I didn't think of Swap as I thought I won't be in need because of 8GB RAM.

Once Linux Mint was installed, you would need to install Windows and of course, laptop couldn't recognize any other OS other than Windows because of overwriting of grub, so follow : https://help.ubuntu.com/community/RecoveringUbuntuAfterInstallingWindows

Once the Grub repair is done, you can see dual boot screen with Linux Mint and Windows 7. :-)





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


[Linux-Mint 13 - Maya] Disable Nvidia discrete graphic card in a Nvidia optimus laptop

I had been really really screwed up as I was not able to optimize my laptop battery life.
I'm having Windows 7 - Pro and Linux Mint 13 - Maya in dual boot. Yes, I switched to Linux Mint after lot of head-banging with Ubuntu 12.04 with freaky Unity. So this is it. With Linux Mint 13 Mate variant now.

Alright. Now, I had hell lot of problems lined up with DELL Vostro 3460 to customize it my own way.

Battery was lasting for nearly 5 hours with Windows 7 Pro, but that wasn't same with Mint. I had to struggle a lot to find out ways how can I optimize my laptop battery. Mint would last for merely 2 hours. That was really annoying. So many optimization options were not really helping me. Like installing laptop-mode-tools, disabling unused services for every boot-time, and what not.
And even after all that, powertop showed power consumption to be ~ 25 Watts.
Moreover, without ANY application open after just logging into the system. :-(

I was so annoyed that, after thinking of changing distro to ArchLinux, Debian, Fedora, CentOS, I even thought to format laptop and stick to Windows 7 - pro. :-(
I had anyway paid for Windows 7, so why not just focus on it.

Anyway let the rest of story rest in peace. :-)

After lot of head-banging, I figured out that its Nvidia drivers who is culprit behind all this. I saw people saying, "if you had to install Linux on laptop, why go for optimus Laptops."

But this blog post saved me hell lot of battery life:
https://wenlong.wordpress.com/2012/05/01/disable-the-nvidia-discrete-graphic-card-in-a-nvidia-optimus-laptop/

Thank you so much man.
Now, powertop shows merely 10 Watts after logging into system. :-)

I thought of creating a Bash script for lazy bunnies, but then it has a github download link for which version might differ as well. So, that is it!

What do I say to Nvidia when Linus can say that better. :D



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

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!!!

Tuesday, September 27, 2011

How to find file creation date in Linux

I had been struggling a lot, A LOT(I mean it) to find *any* possible solution to get the file creation date on Linux systems. But, I had given up at one point.
All in all, suddenly I came across a post on garage4hackers, and was so happy to see it.
So here we go...

Also AFAIK, this is possible with ext4 filesystems:


user@ubuntu:~$ touch test.txt && ls -l test.txt
-rw-r--r-- 1 user user 0 2011-09-27 18:38 test.txt
user@ubuntu:~$ cat << __eof > test.txt 
Hi there,
Hope you all fine.
__eof
user@ubuntu:~$ ls -l test.txt 
-rw-r--r-- 1 user user 29 2011-09-27 19:44 test.txt
user@ubuntu:~$ ls -i test.txt 
14552801 test.txt
user@ubuntu:~$ sudo debugfs -R 'stat <14552801>' /dev/sda7 
[sudo] password for user:
Inode: 14552801   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 340511001    Version: 0x00000000:00000001
User:  1000   Group:  1000   Size: 29
File ACL: 0    Directory ACL: 0
Links: 1   Blockcount: 8
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x4e81da5b:513cbff4 -- Tue Sep 27 19:44:51 2011
 atime: 0x4e81da5e:c8725434 -- Tue Sep 27 19:44:54 2011
 mtime: 0x4e81da5b:513cbff4 -- Tue Sep 27 19:44:51 2011
crtime: 0x4e81cacc:966104fc -- Tue Sep 27 18:38:28 2011
Size of extra inode fields: 28
EXTENTS:
(0): 58665199
debugfs 1.41.11 (14-Mar-2010)

Please note various timestamps mentioned in output

atime: Last time file was opened or executed
ctime: Time the inode information was updated. ctime also gets updated when file is modified
mtime: Last modified time
And most importantly
crtime: File creation time


Thanks to Hackuin, who had posted about it on garage4hackers forum.
Reference: http://www.garage4hackers.com/f30/did-you-know-330-2.html


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