Fix Windows Boot loader with Linux CD/DVD

Fix Windows Boot loader with Linux CD/DVD

This is like the 1000th time someone asked me to fix their windows boot loader directly or indirectly. Well many a times we run 2 OS, mostly Windows and Ubuntu (most often) as dual boot. And it is seen after few days or weeks we are fed up of the Ubuntu and we don’t want it anymore. Not the case with me though. To all those guys here’s what you have to do and should know.

We can simply delete the Ubuntu partition (the Drive/space where Ubuntu was installed). The thing is once we do this the Master Boot Loader (MBR) does not know where the Windows is located. So, next time you start your machine it will not boot the Windows. This happens because the GRUB (which is the Ubuntu Boot Loader) does not exist anymore. So, we need to tell the MBR to use the Windows Boot Loader henceforth. So, how do we do this? Well its easy. We need to somehow fix the MBR.

There are two ways of doing it.

1. With a Windows Recovery disc.

2. With a Ubuntu or Linux Live CD. We could also use an installation disc in “Try it” mode.

Well there are lots of info on how to do it with the Windows Recovery disc on the web. For those of you who don’t have a disc try with the Linux disc. Here is how you can do it.

Boot Linux (Ubuntu/ Knoppix) and make sure you’ve a working Internet connection and type following on the terminal/konsole.

    sudo apt-get install syslinux

if the package got installed use following to write the MBR.

    sudo dd if=/usr/lib/syslinux/mbr.bin of=/dev/sda

Well make sure your drive is sda, type the following in the terminal sudo fdisk -l. If not choose the correct drive.

In any case if you want to do it with the Windows Recovery Disc, you can get a disc here, if you don’t have one.
FYI: Please Wiki for information on what is GRUB, MBR etc.

 

 

 

Advertisements

Android Confections

Time has seen newer technologies. One of the coolest, latest one Android mobile OS has rampantly gripped the mobile phone market. Like many technologies Android has different flavors (versions), do you know whats your version is? Well its not the version numbers but the name which are sugary and quite delicious. I just thought you like to know what each version is codenamed.

Well the dubbed names kicked off with:

SecurIT – Int. Conference on Security of Internet of Things

If you have ever been concerned about using the internet and sharing details, you are not alone. Most of the common appliances in offices and households today are capable of being connected to the internet and indirectly monitoring your usage. While this offers larger flexibility, this convenience should not compromise your privacy. If you want to know all about this and how to manage threats and continue to live securely in the cyberworld, don’t miss out on this event. Amrita Vishwa Vidyapeetham is organizing the first ever international conference on Security of Internet of Things, SecurIT 2012, to be held at Amrita University campuses in Kochi and Amritapuri from 16 to 19 of August, 2012.

The SecurIT 2012, international conference will provide a leading-edge, cross-functional platform for researchers, academicians, professionals and industrial experts around the world to present and explore the latest advancements and  innovations in systems, applications, infrastructure, tools, test beds and foundation theories for the Security of Internet of Things. The three day conference will be hosted in the Amrita University campus in Amritapuri, in one of the most beautiful and picturesque locales of the Kerala coastal line.

The Internet of Things is a network of internet-enabled objects integrated via embedded devices, communicating with human beings as well as other devices as a distributed network. The conference focuses on the latest trends and  dvancements in the security aspect of internet of things. The conference will have academicians from universities and research labs and professionals from industry verticals such as security solution companies, automobile, mobile and wireless companies etc. to participate and contribute their original work and technical papers in key areas such as s security in cloud computing, mobile networks, cyber-physical control systems, healthcare systems, etc.

The conference uses a variety of formats to enable dialogue and participation ranging from technical presentations, demos, breakout sessions and hands-on workshops and tutorials on various key subjects of interest. As part of the conference events, an exciting student contest on ethical hacking called, sCTF (SecurIT Capture The Flag) is being conducted with attractive prizes and awards for the top-runners. Eligible students are offered free accommodation and travel grants to participate in the conference.

The conference is also conducting a contest ‘PitchFest’ a contest for start-ups with innovative ideas on internet of things. This contest is a perfect platform to present your innovative business ideas in the field of Internet of Things. The event is being held in cooperation with Cloud Security Alliance, and Trusted Computing Group. Pitchers can present their ideas in front of the elite panel of Pitchfest comprising Top level executives from our associate partners such as, Intel Capital, Cloud Security Alliance, Trusted Computing Group and www.edventure.com. The event will also give you an ample opportunity to network with many of the C level executives and CEOs from world famous companies across the globe.

The SecurIT 2012 conference will feature keynote and invited talks by world renowned speakers such as Robert Kahn, Co-Inventor of TCP/IP protocol, Esther Dyson, Entrepreneur & Philanthropist, Gulshan Rai, Director General, Cert-In, Pranav Mehta, CTO Embedded Systems, Intel Corporation,Yuliang Zheng, Professor, Department of Software and Information Systems University of North Carolina.

The conference is co-chaired by Dr. Ross Anderson, University of Cambridge and Dr. Greg Morrisett, Harvard University. The conference is steered by world-known technocrats and computer scientists such as Dr. Andrew Tanenbaum, VU, Amsterdam, Dr. Robert Kahn, Co-inventor of TCP/IP & CEO President, CNRI, Reston Virginia; Dr. Gulshan Rai,  Director General, Cert-In, Dr. John Mitchell, Professor, Stanford University & ACM Fellow, Dr. Gene Tsudik, Editor-Chief of ACM Transactions on Information and System Security & Professor, U.C. Irvine, Dr. Prasant Mahopatra, IEEE Fellow & Professor, U. C. Davis; Dr. Sree Rajan, Director, Fujitsu Laboratories of America, Dr. Masahiro Fujita, Professor, University of Tokyo, Dr. Venkat Rangan, Amrita University.

For more information, please visit our website, http://www.securit.ws/

FTPS vs SFTP

You might many articles on the net describing FTPS and SFTP. Here is a brief summarized list of pros and cons of the two file transfer protocols.

What ?

FTPS — File Transfer Protocol over SSL. FTPS is an encrypted flavor of the FTP protocol (kind of like how HTTPS is an encrypted flavor of HTTP).

SFTP — SSH File Transfer Protocol. SFTP uses the Secure Shell (ie: SSH) protocol to encrypt all file transfer communications.

FTPS

Pros:

  • Widely known and used
  • The communication can be read and understood by humans
  • Provides services for server-to-server file transfer
  • SSL/TLS has good authentication mechanisms (X.509 certificate features)
  • FTP and SSL/TLS support is built into many Internet communication frameworks

Cons:

  • Doesn’t have a uniform directory listing format
  • Requires a secondary DATA channel, which makes it hard to use behind the firewalls
  • Doesn’t define a standard for file name character sets (encodings)
  • Not all FTP servers support SSL/TLS
  • Doesn’t have a standard way to get and change file and directory attributes

SFTP

Pros:

  • Has good standards background that strictly defines most (if not all) aspects of operations
  • Has only one connection (no need for DATA connection)
  • The connection is always secured
  • The directory listing is uniform and machine-readable
  • The protocol includes operations for permission and attribute manipulation, file locking, and more functionality

Cons:

  • The communication is binary and can’t be logged “as is” for human reading
  • SSH keys are harder to manage and validate
  • The standards define certain things as optional or recommended, which leads to certain compatibility problems between different software titles from different vendors
  • No server-to-server copy and recursive directory removal operations
  • No built-in SSH/SFTP support in VCL and .NET frameworks

The UNIX/Linux Fork Bomb

This may look like few emoticons used in a wrong way, but when written in a UNIX shell; this may crash your computer. This is the infamous piece of shell script called “fork bomb”.

Here a function is called recursively and each call forks or creates two child processes which run as background process and cannot be auto killed. This way a large number of processes gets created eating away the system resources and brings the system to halt or crash.

Wiki: “the fork bomb is a form of denial-of-service attack against a computer system which makes use of the fork operation (or equivalent functionality) whereby a running process can create another running process. Fork bombs typically do not spread as worms or viruses; to incapacitate a system, they rely on the (generally valid) assumption that the number of programs and processes which may execute simultaneously on a computer has a limit.”

Understanding fork bomb code

Here is more human readable code:

bomb() {

bomb|bomb&

};bomb

Well a various other forms of the fork bomb, for other operating systems can be found here.

If you wanna try it out in your machine make sure to go through the prevention techniques mentioned here. Well in most cases a system restart/reboot solves the problem.

Adding a System Call to Linux Kernel 2.6.x

About ?
This article explains a way to add a system call to Linux kernel (2.6.x).

What is a System Call ?
A system call is an interface between a user-space application and a service that the kernel provides. It is a request for service that a program makes of the kernel. The service is generally something that only the kernel has the privilege to do, such as doing I/O.

System Call Implementation
Prerequisites:

  • You must have root access
  • You may need the following packages for building your kernel build-essential automake autoconf zlib1g-dev libdb4.4-dev libboost-dev libboost-serialization-dev libncurses-dev

Let’s Begin

1. Download the Linux 2.6.x kernel. Get the latest one from http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.4.tar.bz2
2. Unzip and untar the downloaded kernel to /usr/src
bzip2 linux-2.6.39.4.tar.bz2
tar -xvf linux-2.6.39.4.tar
3. Create a soft link
ln -s linux-2.6.39.4 linux
This is optional. We can also work with the directory linux-2.6.x.x just created.

4. Create mysyscall.c in the /usr/src/linux/kernel/ directory and add the following lines

#include <linux/linkage>
asmlinkage long sys_add ( int i , int j)
{
return i+j ;
}

Whats the code all about ?
This system call adds two numbers in the kernel space.
asmlinkage: thats there to indicate the code is written in ‘C’ as oppose to C++
sys_add: it is the system call function which adds two numbers

5. Now with your favorite editor edit the Makefile in the current directory. Add the following line

obj-y += mysyscall.o

6. Now that the system call is ready, its time to make necessary changes in some files so that the kernel is aware of this new system call.

Open the file arch/x86/kernel/syscall_table_32.S in a text editor. Go to the end of the
document and add this line
.long sys_add
Now open arch/x86/include/asm/unistd_32.h and find out

#define NR_syscalls 345
And and this this line before it
#define NR_add 345
Change NR_syscalls 345 to
#define N R_syscalls 346

(For 64 bit)
Now edit arch/x86/include/asm/unistd_64.h and add following line at the end of file

#define __NR_add 305
__SYSCALL(__NR_add , sys_add)

Now again in the source folder you will find a folder named include. Open the file
include/linux/syscalls.h and go to the end of the file. Before the line #endif add

asmlinkage long sys_add ( int i , int j) ;

7. Now its time to recompile the new kernel with your own system call added to it. Build the kernel source and install the necessary packages to do so

sudo make
sudo apt-get install kernel-package fakeroot
sudo make−kpkg clean
sudo fakeroot make-kpkg –initrd –append-to-version=-pv kernel-image kernel-headers
sudo dpkg −i ../linux-image-2.6.39.4-pv_2.6.39.4-pv-10.00.Custom_i386.deb

8. To verify your newly build kernel, type in the terminal
uname -r

9. Boot your newly build kernel

Testing !!

Create a file test.c and add the following lines to it.

#inlcude<stdio.h>
#inlclude<linux/unistd.h>
#include<sys/syscall.h>

#define sys_add 345

int main(void)
{
int a,b,c;
printf(“\nKernel Space : Addition\n”);
printf(“Input a:\n”);
scanf(“%d”,&a);
printf(“Input b:\n”);
scanf(“%d”,&b);
c = syscall(sys_add,a,b);
printf(“Sys call returned c: %d\n”,c);
return 0;
}

Save and compile your program and check the result 🙂