Wednesday, October 22, 2014

Virtualbox Problem with netoworking : "No host only network adapter selected"

Scenario :-

While carrying out dynamic malware analysis, it is better to set up a host only network with the victim host (on which you are running the malware) and the remnux host (on which you will be running the analysis tools).

Problem :-

I had a problem with my virtualbox on ubuntu 12.04, I coudn't add a host only adapter, the message was "no host only network adapter selected" and neither I could select anything.

Solution :-

Actually, the virtual host-only network wasn't set up yet. Here's is how to fix this problem:

    From the main menu, select File > Preferences (Ctrl+G) - NOT the settings of
    any particular vm.

    Select Network in the list on the left.

    You should see an empty white box with "Host-only Networks" at the top. On
    the right, there are three buttons to manage them. Click the topmost one
   (with a green plus symbol).

   A new Host-only network will be created and added to the list.

You should now be good to go!
:-)






Monday, September 8, 2014

multiple distro's on usb

I have a usb with multiple distros on it. The entire usb has two partitions - both fat32, one for the data and another one for the live distros.
I then installed multisystem on my laptop (Ubuntu14.04) :-
          Add the following line to /etc/apt/sources.list file:-
       deb http://liveusb.info/multisystem/depot all main
         and update the repositories :-
      sudo apt-get update && apt-get install multisystem
Now fireup the multisystem and insert the formatted usb. Remember to be a non root user. Select your usb drive partition which should store the distros. Now choose the .iso image you wish to have on the usb and multisystem does the rest. You can have multiple distros and may even have persistence working for any one of them. 

 

Bye!

Monday, June 2, 2014

USING VLC AS A VIDEO/AUDIO CUTTER

hi everyone!
Here are the steps for using VLC media player, as  an audio/video cutter :-
1.     Load your video / audio file in VLC.
2.     Activate Advanced controls located under the View menu. You will now
        see four extra buttons above the normal play/pause button.
3.     Seek to the position you want to start your recording and play the audio /
        video stream. Now press the record  button (the first one) in the Advanced
        controls section.
4.     Press the Record button again, when you want to stop the recording.
5.     Basically, we have used the built-in VLC decoder to record the audio / video
        clip.

Credits : - http://www.guidingtech.com/8802/use-vlc-as-video-cuting-tool/

Ofcourse, if you have ffmpeg insalled, you may use the following command line from a terminal window :-
      ffmpeg -i in.mp4 -ss [start] -t [duration] -c:v copy 
            -c:a copy out.mp4
The various options are as under:-   
     -ss specifies the start time, e.g. 00:01:23.000 or 83 (in seconds) 
     -t  specifies the duration of the clip (same format). 
     -c:v copy and -c:a copy copy the video and audio bitstreams without
        re-encoding them. This won't harm the quality and make the command run
        within seconds.
 
simple and pure joy of using open source software!
bye!

Friday, May 23, 2014

HOW TO CONVERT .MP4 VIDEOS TO PSP COMPATIBLE .MP4 FORMAT

Hi,
I have recently loaded the Arista Transcoder, using the Ubuntu Software Centre.
It is pretty simple to use, all you have to do is select the format for the conversion (from the drop-down box) and choose the video file to convert, it does the rest for you. Now upload the .mp4 file onto the VIDEO folder of your PSP and enjoy
:)

Tuesday, February 25, 2014

CREATING A VMDK FROM YOUR PHYSICAL WIN7 INSTLN

I have a dual boot system with Ubuntu12.04 and Windows 7. Presently, I am using Grub2 to choose the OS to boot into.

Since I mostly operate in Ubuntu, I decided to give up my Windows 7 installation entirely by moving it from physical installation to a VM. . After all when I need Windows and I donot need to reboot and I can freeze / unfreeze the system in a short time.

So essentially I installed Ubuntu12.04 as my base system and installed VirtualBox in it. Now I created a VM from my physical Win7 install and I use it in the Virtual Box. The steps to do it are as follows:-

(a)    Download and install VMware-converter-en-5.5.0-1362012.exe from the
internet, on the win7.

(b)    Create a vmdk image of the win7 system and save it in an external HDD.

(c)    Create  a VM inside the Virtual Box and choose to create it from - Use an
existing Virtual Hard Drive File.

There is yet another way to accomplish this task :-

(a)   Download and install  in the windows partition, Disk2vhd.exe from the sysinternals suite.

(b)   Create a .vhd image of your live system. But the important thing is the external HDD where you store this image must be NTFS partition , otherwise you will always get insufficient disk space error! which ofcourse is not a correct prompt for the error. There is yet another problem, the .vhd image will also carry your Grub installation, and inside the VM this will always give a grub rescue prompt. Just proceed to next step and remove the Grub installation from the .vhd file and reinstate the mbr using a Win7 System Restore disk.

(c)   Start VirtualBox and create a new VM. Reboot the virtual machine and Select CD/DVD as boot option. Boot from Recovery Disk, log in when prompted
Select command line as utility and execute the following commands:

       Bootrec.exe /FixMbr
    Bootrec.exe /FixBoot
    Bootrec.exe /RebuildBcd


(the intention here is to get rid of grub( which was in the dual boot original system) in the VM,  otherwise you'd be getting grub rescue at boot)

(d)  Reboot Virtual Machine and use it.

Thanks !

Sunday, February 23, 2014

MAKING WIFI WK ON Ubuntu 12.04 : FOR BROADCOM 4313 CARD ON HP PAVILION G6

I couldnot make the Wi-fi connection work at all. I first ascertained the make and model of my wifi card using the follwoing commands :-

# lspci -nn lists the hardware

02:00.0 Network controller [0280]: Broadcom Corporation BCM4313 802.11b/g/n Wireless LAN Controller [14e4:4727] (rev 01)

# sudo lshw -C network

 
  *-network              
       description: Wireless interface
       product: BCM4313 802.11b/g/n Wireless LAN Controller
       vendor: Broadcom Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: eth1
       version: 01
       serial: c0:18:85:98:9f:a5
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical 

       wireless
       configuration: broadcast=yes driver=wl0 driverversion=5.100.82.112 

       latency=0 multicast=yes wireless=IEEE 802.11
       resources: irq:16 memory:a2500000-a2503fff


So I looked up on the net and found that there were different options- some felt that the default open source driver brcmsmac would work best , while there were others who felt that enabling the broadcom driver would be the best option.

I first checked which of the above two drivers were in use on my laptop :-
# sudo nm-tool

     - Device: eth1 -----------------------------------------------------------------
       Type:               802.11 WiFi
       Driver:            wl
       State:              disconnected
       Default:           no
       HW Address:   C0:18:85:98:9F:A5

     Capabilities:

     Wireless Properties
      WEP Encryption:  yes
      WPA Encryption:  yes
      WPA2 Encryption: yes


The driver is the broadcom driver, so I tried out the other one :-
 # sudo modprobe -r b43 bcma
 # sudo modprobe -r brcmsmac bcma
 # sudo modprobe -r wl

 # sudo modprobe brcmsmac


The first three commands essentially removed all the drivers, and ruled out any possible misconfigurations, the last command loaded the default driver.
Wi-fi started working!
However, the change was only temporary and on successive reboots it again reloaded the wl driver, which caused the problem. I decided to keep the wl driver, just in case I needed it later. So I did the following workaround for a permt solution ;-
I modified the /etc/rc.local file to add the following lines above exit 0

# modprobe -r wl
# modprobe brcmsmac


I still have some issues with the poor signal strength. So maybe an update will be posted later!

Tuesday, February 18, 2014

CREATING A PRISTINE NEW INSTALL : Ubuntu 12.04 (LTS)

I decided to install Ubuntu on my laptop and customise it to my liking.
So, I chose the Ubuntu 12.04 (LTS) and went through the following steps
to customize my system :-

1.    Additional softwares installed from terminal :-

    apt-get install gparted
    apt-get install git                  // to install metasploit and Veil
    sudo apt-get install freemind
    apt-get install gimp
    apt-get install vlc
    apt-get install apache2
    apt-get install liferea           // rss reader
    apt-get install unetbootin    // install a distro (iso) on USB device
    apt-get install zenmap
    apt-get install wireshark
    apt-get install proxychains
    apt-get install openjdk-7-jdk

    [add the following two lines to ~/.bashrc file]
      export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386
      export PATH=$PATH:/usr/lib/jvm/java-7-openjdk-i386/bin


    ****REMASTERSYS****
    sudo su
    wget -O - http://www.remastersys.com/ubuntu/remastersys.gpg.key | apt-key
                add -
    Add the lines to /etc/apt/sources.list(sudo gedit /etc/apt/sources.list)
      #Remastersys Precise
      deb http://www.remastersys.com/ubuntu precise main

    sudo apt-get update && sudo apt-get install remastersys remastersys-gui

    ****FIREFOX******
    apt-get install firefox

    You can update your system with unsupported packages from this untrusted
    PPA by adding ppa:mozillateam/firefox-next to your system's Software
    Sources.
   

   deb http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu  
       quantal main 
   deb-src http://ppa.launchpad.net/mozillateam/firefox-next/ubuntu  
       quantal main 


    install NetVideoHunter plugin for firefox
   
    ****MULTI MEDIA PLUGINS / CODECS****
    apt-get install mpg123
    apt-get install adobe-flashplugin
    apt-get install gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg 
                gstreamer0.10-plugins-ugly
    apt-get install ffmpeg    // needed to play .flv files in movie player or vlc
    (to see how to do a screencast from terminal or how to play back TV on
    desktop see other posts)

    apt-get install ubuntu-restricted-extras

   
2.    Installed using Software Centre

       recordmydesktop and the gui
       netbeans
       guvcview     // for video and audio recordings.

3.    Software downloaded as tarballs / .deb and installed :-

      Tor Browser Bundle

      theHarvester2.2 from Edge Security website

      tar -zxvf truecrypt-7.1a-linux-x86.tar.gz (Download and extract tarball)
      sudo ./truecrypt-7.1a-linux-x86

      ****RELINUX******
     relinux_0.4a1-5_i386.deb
     sudo dpkg -i relinux_0.4a1-5_i386.deb

      ****GOOGLE EARTH******
     download the .deb file for googleearth package
     apt-get install lsb-core
     sudo dpkg -i googleearth*.deb
       
     ****VIRTUAL BOX***
    sudo dpkg -i 'virtualbox-4.3_4.3.4-91027~Ubuntu~raring_i386.deb'

    In order to be able to use the usb and external cd drive etc :-
    (launch virtualbox -> File -> Preferences -> Extensions - > choose the
    extension pack you have downloaded for your install for example ,
    Oracle_VM_VirtualBox_Extension_Pack-4.3.4-91027.vbox-extpack -> Click
    OK and install the extension pack)

    Next switch off (DONOT FREEZE THE VM, TURN IT OFF) the virtual
    machine and then open the settings for the vm and enable USB2.0 EHCI    
    Controller checkbox.

    Next add user to vboxusers group and restart your host OS :-
    sudo usermod -aG vboxusers yourUserName

    (VIMP :- You will only see your usb after you have restarted the host OS)

    (Also install the guest Aditions for every VM you create to enable shared
    folder with host OS and clip board sharing)
    
4.    Installations using git

      (a)    Veil 
          sudo git clone https://github.com/Veil-Framework/Veil.git
          cd /opt/Veil-Evasion
          sudo ./update.sh

      (b)    MSF install
          First uninstall ruby1.8.3 which is part of the base install of Ubuntu12.04
          sudo apt-get purge ruby1.8.*
         
          Install ruby1.9.1 and gems and verify their versions :-

          sudo apt-get install ruby1.9.1
          ruby -v
          sudo apt-get install rubygems1.9.1
          gem -v
          sudo apt-get install ruby1.9.1-dev

          Install postgresql

          sudo apt-get install postgresql
          sudo apt-get install libpq-dev

          Additional installs

          sudo apt-get install libpcap-dev

          cd /opt
          mkdir metasploit
          cd /opt/metasploit
          sudo git init
          sudo  git clone git://github.com/rapid7/metasploit-framework.git
                                  /opt/metasploit

          Now install the gem bundler & invoke it to install remaining gem bundle :-
          sudo gem install bundler
          sudo bundle install
      
          note:- Remember, if you donot pull down metasploit and clone it into
          /opt/metasploit directory first, you will not have any Gemfile, which
          carries the gem dependencies, that are installed by gem install bundler.
         

5.    After going through all the hardwork of customizing my installation, I decided it would be best to create an ISO image of my system, which I may either install on any new machine or create a VM with. So I used Remastersys.

Thanks for Reading and Enjoy !

Monday, February 17, 2014

Restoring dual boot windows / Ubuntu system : Using Clonezilla backup files


After I restored the /dev/sda3 partition of my laptop using the clonezilla backup of another Ubuntu system I had taken earlier,  I had to make the system bootable using grub2. Clonezilla had only put the ubuntu image on /dev/sda3 and not installed the grub in /boot folder of /dev/sda3  or the stage 1 files in /dev/sda.

1.    Make the ubuntu installation bootable

    (a) Use a live cd(Ubuntu) to boot up and mount the ubuntu partition  
         (/dev/sda3) at mount point /mnt

        sudo fdisk -l
        sudo mount -t auto /dev/sda3 /mnt

    (b) Install grub
       
        sudo grub-install --boot-directory=/mnt /dev/sda

    (c) Update grub to identify the win7 instln loc at /dev/sda1

        sudo update-grub

2.   Reboot. After rebooting the system, I could boot into my Ubuntu instln without any problem. But when I tried to boot up my win7 from the grub the system halted with the following error :-

    Status : 0xc000000e

    Info   : The boot  selection failed because a required dev is inaccessible.


A little bit of search on google suggested that the boot files of win7 were
corrupted somehow during the process.

3.    Getting win7 up and running :-
   
    Boot up the machine using a win7 recovery disk and after selecting the
    language etc click on Next button. In the next screen press Shift +F10 
    to get a terminal and execute the following commands :-
        c:/> bootrec /fixboot

        c:/> bootrec /fixmbr

        c:/> bootrec /rebuildbcd
        (this gave an error......Couldnot detect any windows installation!)

        To fix this, type the following commands at the Windows Recovery
        command prompt:

            c:/> bcdedit /export C:\BCD_Backup
            c:/> cd boot
            c:/> attrib bcd -s -h -r
            c:/> ren c:\boot\bcd bcd.old
            c:/> bootrec /RebuildBcd

    Close the terminal window and exit.

4.    On the next attempt I booted up both my win7 and Ubuntu without any problem.

Thanks !

CREATING AN ISO OF YOUR UBUNTU INSTLN

I have a nicely configured Ubuntu instln on my laptop. It is optimised and customized for my personal use. I wouldnot like to do it over and over again in case I format my dual boot system or due to some hardware failure, my linux distro stops. How to achieve that  ? Simple, use Remastersys.

1. Installation

   (a)   In the terminal window as root - issue the following commands :-
              'sudo su'
                     
               wget -O - http://www.remastersys.com/ubuntu/remastersys.gpg.key |   
               apt-key add -
                   
  (b)   Add the following line to /etc/apt/sources.list (sudo gedit /etc/apt
          /sources.list):-

            
              #Remastersys Precise
              deb http://www.remastersys.com/ubuntu precise main

  (c)   Now in the terminal type
              sudo apt-get update && sudo apt-get install remastersys
              && sudo apt-get install remastersys-gui
2. Usage

   (a)   Launch Remastersys gui and choose the first option:-
           create a live ISO backup of your system including your personal data

   (b)   Installing back the system from the iso image can be done in two ways:-

          (i)   You can copy the .iso on DVD and install on different machine as you
          would install any linux distro.

          (ii)  Copy the .iso on a usb device. Create a Virtual Box ubuntu linux vm
          and configure the Settings -> Storage -> Controller :IDE -> Attributes ->
          CD/DVD Drive, to point to the .iso image stored on the usb device. Then
          boot up the machine from the iso , you may use the live image of your
          system or install it as needed on the VM.
    
Enjoy!

Wednesday, January 8, 2014

HOW TO CONFIGURE YOUR UBUNTU SYSTEM TO LOGIN/LOGOUT WITH USB KEY

1.    Install pamusb-tools  and libpam-usb as under :-

       sudo apt-get install pamusb-tools libpam-usb

2.    Add USB device

       sudo pamusb-conf --add-device gerardButlers-usb-stick

3.   Define a user for PAM authentication ( the user must exist on the linux system) :-

      sudo pamusb-conf --add-user gerardButler

4.   Edit the  /etc/pam.d/common-auth file, so that pam can use the pam_usb library :-

       Add
      auth    sufficient      pam_usb.so
      
    above
      auth    required        pam_unix.so nullok_secure
 
    Note :- FOR TWO FACTOR AUTHENTICATION
     If you wish to use both the usb key as well as your user 
     password then add the following:-
 
      auth    required        pam_usb.so 

5.  In the terminal window, execute  su gerardButler and then provide the 
     password for the account.

6.  The pam_usb agent (pamusb-agent) allows you to automatically execute
     commands upon locking and unlocking events. Those events are generated when
     you insert or remove your authentication device. To configure the commands, you
     have to edit pam_usb's configuration file (/etc/pamusb.conf) and add agent
     entries into your user section.

     For instance, you could automatically start your screensaver as soon as you
     remove the device, and deactivate it when you plug the device back.

     Open and modify the file /etc/pamusb.conf file's user section as under :-
    
   <user id="gerardButler">
    <device>gerardButlers-usb-stick</device>
    <agent event="lock">gnome-screensaver-command --lock</agent>
    <agent event="unlock">gnome-screensaver-command --deactivate</agent>
   </user>

     Now, you have to add pamusb-agent to the list of autostarted applications so it will
     be started automatically. It is important to note that for agent events to work you
     have to ensure pamusb-agent is running at all times:-

  • Select Startup Programs and press Add
  • Enter pamusb-agent and press OK
Refs :-
     https://github.com/aluzzardi/pam_usb/wiki/Getting-Started
     http://linuxconfig.org/linux-authentication-login-with-usb-device

7.  Note :- Pad checking failed
     Sometimes pamusb stopped authenticating with the message "Pad checking
     failed". Use the following command to flush previously stored pam  config
     files and pads from your home directory, as under :-
    
     sudo rm ~/.pamusb/*

Enjoy and Ubuntu!