Pages

Saturday, July 14, 2012

Resizable linux partions --LVM-logical volume management

In linux we can can create resizable partition  which can be resized if free space is available. That type of partitions logical volumes.
lvm-digram

1.-------->First we need to create normal logical partitions.
i have a partion  /dev/sda4  in /dev/sda
2.--------->Then we need to select the partition and change the partition type to 0x8e or create the partition as physical volume using given option in palimpsest
using fdisk command we could change the partion type to 0x8e . we could use the 't' option in fdisk to change the type ,after seleting the 't' option it will prompt for the partition no of which type need to be changed .using the 'l' option will list types of  partition type.
fdisk /dev/sda
At the Linux fdisk command prompt,

  1. press n to create a new disk partition,

  2. press p to create a primary disk partition,

  3. press 1 to denote it as 1st disk partition,

  4. press ENTER twice to accept the default of 1st and last cylinder – to convert the whole secondary hard disk to a single disk partition,

  5. press t (will automatically select the only partition – partition 1) to change the default Linux partition type (0×83) to LVM partition type (0x8e),

  6. press L to list all the currently supported partition type,

  7. press 8e (as per the L listing) to change partition 1 to 8e, i.e. Linux LVM partition type,

  8. press p to display the secondary hard disk partition setup. Please take note that the first partition is denoted as /dev/hdb1 in Linux,

  9. press w to write the partition table and exit fdisk upon completion.


3.-------->Next, this LVM command will create a LVM physical volume (PV) on a regular hard disk or partition:
pvcreate /dev/sda4

4---------->Now, another LVM command to create a LVM volume group (VG) called vg0 with a physical extent size (PE size) of 16MB:
vgcreate -s 16M vg0 /dev/hdb1

 

5---------->Create a 400MB logical volume (LV) called lvol0 on volume group vg0:
lvcreate -L 400M -n lvol0 vg0

This lvcreate command will create a softlink /dev/vg0/lvol0 point to a correspondence block device file called /dev/mapper/vg0-lvol0.

6----------->Formatting the partition to the needed type ..here i am going to format it to ext4 type

mkfs.ext4 /dev/vg0/lvol0
Finally mounting the partition to the needed place.here i will be mounting the partition to /data

mkdir  /data

mount /dev/vg0/lvol0 /data

some of the useful commands in this are

pvs

vgs

lvs

pvdisplay

vgdisplay

lvdisplay

more useful commands are lvextend and lvreduce

reduced should be used carefully because  cutting of the file system may cause data loose if not done properly

Tuesday, June 19, 2012

Gcc for windows-Install the MinGW (GCC) Compiler Suite and Cygwin prompt

This Gcc compiler doesn't exactly replaces the normal Linux gcc compiler .First download the file from following link and run it to install MinGW (Minimalist GNU for Windows).We need net connection to install this

http://sourceforge.net/projects/mingw/files/MinGW/





in latest MinGW you will have c compiler in the list .Select the needed components and select the path to which you need to install it.After the installation we need to set the environment .

Create a directory (e.g. C:\MinGW), download all packages to C:\MinGW, extract the files from each package, and add C:\MinGW\bin; to your PATH environment variable using C:\> set PATH=C:\MinGW\bin;%PATH%" .or set it normally with properties of mycomputer>Environment variables.

To get more linux effect in windows install Cygwin from http://www.cygwin.com/install.html to get a terminal effect.and install needed packages as needed in cygwin.to install cygwin also we need internet connection

http://www.eecg.utoronto.ca/~aamodt/ece242/cygwin.html


Monday, May 21, 2012

Connecting to ur computer through ssh and No-IP form mobile or computer

Normally we use ssh for connecting to ur system over internet form other computer or mobile.When using ssh we will be having the ip address of the computer to which we need to connect .we set up a ssh server and we will be able to connect to this server using the ip to get a prompt to use.The main problem when u connect ur computer over internet is the dynamic ip problem.that is when the connection at ur computer is lost and reconnected u get another ip address and u don't know that one.

Solution

Using No-ip to get an static ip for the computer

Actually No-ip doesn't provide any static ip but binds our current ip to a host name so that when ever the ip is changed it automatically gets assigned to the host .thus by using the host name we a access the computer.

step1. Download the no-ip software form there site and install it-->> https://www.no-ip.com/downloads.php

step2.Make an account in the No-ip site and create a host name(which is free)

step3. now add the host name into the No-ip software in ur computer.First u need to use ur login id and password in the software then it will show ur host name .u can just select it.

 

Setting up ssh in windows

we can use freesshd for ssh services in windows.

  just download it from www.freesshd.com and install it.setup an ssh server.set the listen interface to all.and create a user account .with authorization "password stored as sha1"and give the password. and turn up the ssh server

its done now we can use putty to check whether its working or not ..In putty give the host name as host name u registered in no ip and connect

to connect from mobile putty is available for android and Symbian also.in mobile putty we can give the host name and username which we have created.

 

Thursday, May 17, 2012

removing Recycler virus

the recycler virus particularly come from pendrives,ipods,mp3 players etc.....which effects our folder's hidden and read only options....so to remove this virus I've got a lengthy,yet a very effective process..

1>restart your PC in safe mode {by pressing the F8 key constantly when the PC is restarted}

2>then run an anti-spyware check...for eg.download MALWAREBYTES ANTIMALWARE [its free]

3>run a complete anti-virus scan

4>clean up your system registry by downloading-- REG SEEKER

5>restart.....

[NOTE]:AFTER THIS PROCESS NEVER OPEN YOUR PENDRIVES OR ANY REMOVAL DRIVE,INSTEAD FORMAT THEM AND THEN OPEN......

Removing the Recycler.exe virus please follow the steps below…

Reboot your computer into Safe Mode, this is important as this is a memory resident virus. Do this by pressing F8 as the machine boots up and select safe mode from the DOS menu. Once in Safe Mode, press enter to stay in safe mode, you don't want to go to Recovery.

1. Open up windows explorer, Start>Programs>Accessories>Explorer

2. Go to (In Vista press ALT to display menus) Tools>Folder Options>View>uncheck the items below: 1>display the contents of system folders

2>hide extensions for known file types

3>hide protected operating system files(Recommended) Leave the other items as they are.

3. Press Apply>OK.

4. Leaving windows explorer open,

navigate to the root of the C:\ drive and remove AUTORUN.INF and any files that end in *.CMD and *.BAT excepting for AUTORUN.BAT and COMMAND.COM which are legacy files you may or may not have. Now go to C:\Recycler and remove anything located in the folders that look like recycle bins, if you are on a network there will be more than one.

5. Delete all instances of the virus on your disk. There are two or three variants of this virus, some put a file in the windows directory named SVHOSTE which is a hidden file - search for this and delete it.

 

6. Remove from Registry. Open Registry Editor.

Click Start>Run, type REGEDIT, then press Enter. In the left panel,

double-click the following: HKEY_LOCAL_MACHINE>SOFTWARE>Microsoft>Active Setup>Installed Components

In the left panel, locate and delete the key: {08B0E5C0-4FCB-11CF-AAX5-90401C608512} Close REGEDIT and click on Start>Run or on Vista just type in the search box MSCONFIG and press enter.

Click the startup tab and uncheck any misspelt entries such as Microssoft and Norrton, also take into account the command of this startup entry, navigate to where these files are located and delete them from your disk. Format any memory sticks you have used with this machine by going into explorer, right click on the disk and clicking format. Once Formatted reboot your virus free machine.

Wednesday, May 16, 2012

Tweak Windows Explorer to make the command window always available

The default behavior for Windows Explorer in Windows 7 and Vista is to display a context menu when you right-click a folder (Figure A). If you hold the Shift key down and right-click a folder, you will get more menu options on the list (Figure B).

Figure A



Context Menu

Figure B



Shifted Context Menu

This behavior is all well and good, but what if you want to have access to the Open Command Window Here command with just a right-click versus the Shift-right-click it requires by default? The answer involves a Windows Registry file edit.

Registry edit


Standard disclaimer: The Windows Registry File is vitally important to the proper operation of the Windows operating system. Please back up the file before you make any registry edits.

In Windows 7, click on the Start button and type regedit in the search box. Click on the regedit.exe file in the list of items and answer the UAC prompt. Once in the registry editor (Figure C), navigate to this key:

HKEY_CLASSES_ROOT\Drive\shell\cmd

Figure C



Registry editor

In the right-hand pane, right-click the Extended key to rename it to anything besides Extended (Figure D). Or you can simply delete the key, but doing so will make it more difficult to return to the default settings. This change adds the feature to drive icons in Windows Explorer.

Figure D



The Extended key

To add the Open Command Window Here feature to folders displayed in Windows Explorer, navigate to this key in the registry editor:

HKEY_CLASSES_ROOT\Directory\shell\cmd

Once again, in the right-hand pane, right-click the Extended key (Figure E) and change the name or delete it completely if you are so inclined.

Figure E



An alternate access to the Extended key

Close the registry editor, and from now on, when you right-click a drive or a folder from within Windows Explorer you will see Open Command Window Here as one of your available options (Figure G).

Figure G



The now-available Open Command Window Here option


Sunday, March 25, 2012

PYTHON APPLICATION ..PART 2

part 2 deals with the server part ie the system..we need a system installed with python and sendkey attribute (make sure both of them are of same version)of python to do it

http://dl.dropbox.com/u/30579529/Bluecon/python/python-2.5.4.msi

http://dl.dropbox.com/u/30579529/Bluecon/python/SendKeys-0.3.win32-py2.5.exe

http://dl.dropbox.com/u/30579529/Bluecon/python/PyBluez-0.15.win32-py2.5.exe

in server side we broadcast a service and wait for client to connect .

after connecting  the server receives the ascii values from the client and server uses the sendkey attribute to make virtual keyboard and mouse movements with respect to received ascii values

/***********code*****************/
from ctypes import *
from bluetooth import *
import string
from SendKeys import *
user32=windll.user32
from ctypes.wintypes import *
import time

LEFTDOWN   = 0x00000002
LEFTUP     = 0x00000004
#  MIDDLEDOWN = 0x00000020
#  MIDDLEUP   = 0x00000040
#  MOVE       = 0x00000001
#  ABSOLUTE   = 0x00008000
RIGHTDOWN  = 0x00000008
RIGHTUP    = 0x00000010

class POINT(Structure):
_fields_ = [("x", c_ulong),
("y", c_ulong)]

def getpos():
global pt
pt = POINT()
windll.user32.GetCursorPos(byref(pt))
return pt.x, pt.y

def move(x,y):
windll.user32.SetCursorPos(x,y)

def up():
x = getpos()[0]
y = getpos()[1]
move(x,y-10)
def down():
x = getpos()[0]
y = getpos()[1]
move(x,y+10)
def left():
x = getpos()[0]
y = getpos()[1]
move(x-10,y)
def rigth():
x = getpos()[0]
y = getpos()[1]
move(x+10,y)

def rightclick():
windll.user32.mouse_event(RIGHTDOWN,0,0,0,0)
windll.user32.mouse_event(RIGHTUP,0,0,0,0)

def leftclick():
windll.user32.mouse_event(LEFTDOWN,0,0,0,0)
windll.user32.mouse_event(LEFTUP,0,0,0,0)

def send(data):
if(data==97):
SendKeys('a')
elif(data==98):
SendKeys('b')
elif(data==99):
SendKeys('c')
elif(data==100):
SendKeys('d')
elif(data==101):
SendKeys('e')
elif(data==102):
SendKeys('f')
elif(data==103):
SendKeys('g')
elif(data==104):
SendKeys('h')
elif(data==105):
SendKeys('i')
elif(data==106):
SendKeys('j')
elif(data==107):
SendKeys('k')
elif(data==108):
SendKeys('l')
elif(data==109):
SendKeys('m')
elif(data==110):
SendKeys('n')
elif(data==111):
SendKeys('o')
elif(data==112):
SendKeys('p')
elif(data==113):
SendKeys('q')
elif(data==114):
SendKeys('r')
elif(data==115):
SendKeys('s')
elif(data==116):
SendKeys('t')
elif(data==117):
SendKeys('u')
elif(data==118):
SendKeys('v')
elif(data==119):
SendKeys('w')
elif(data==120):
SendKeys('x')
elif(data==121):
SendKeys('y')
elif(data==122):
SendKeys('z')
elif(data==65):
SendKeys('A')
elif(data==66):
SendKeys('B')
elif(data==67):
SendKeys('C')
elif(data==68):
SendKeys('D')
elif(data==69):
SendKeys('E')
elif(data==70):
SendKeys('F')
elif(data==71):
SendKeys('G')
elif(data==72):
SendKeys('H')
elif(data==73):
SendKeys('I')
elif(data==74):
SendKeys('J')
elif(data==75):
SendKeys('K')
elif(data==76):
SendKeys('L')
elif(data==77):
SendKeys('M')
elif(data==78):
SendKeys('N')
elif(data==79):
SendKeys('O')
elif(data==80):
SendKeys('P')
elif(data==81):
SendKeys('Q')
elif(data==82):
SendKeys('R')
elif(data==83):
SendKeys('S')
elif(data==84):
SendKeys('T')
elif(data==85):
SendKeys('U')
elif(data==86):
SendKeys('V')
elif(data==87):
SendKeys('W')
elif(data==88):
SendKeys('X')
elif(data==89):
SendKeys('Y')
elif(data==90):
SendKeys('Z')
elif(data==48):
SendKeys('0')
elif(data==49):
SendKeys('1')
elif(data==50):
SendKeys('2')
elif(data==51):
SendKeys('3')
elif(data==52):
SendKeys('4')
elif(data==53):
SendKeys('5')
elif(data==54):
SendKeys('6')
elif(data==55):
SendKeys('7')
elif(data==56):
SendKeys('8')
elif(data==57):
SendKeys('9')
elif(data==43):
SendKeys('+')
elif(data==45):
SendKeys('-')
elif(data==42):
SendKeys('*')
elif(data==47):
SendKeys('/')
elif(data==61):
SendKeys('=')
elif(data==35):
SendKeys('#')
elif(data==44):
SendKeys(',')
elif(data==46):
SendKeys('.')
elif(data==59):
SendKeys(';')
elif(data==58):
SendKeys(':')
elif(data==64):
SendKeys('@')
elif(data==63):
SendKeys('?')
elif(data==32):
SendKeys(' ')
elif(data==13):
SendKeys("{ENTER}")
leftclick()
elif(data==8):
SendKeys("{BACKSPACE}")
elif(data==40):
SendKeys('(')
elif(data==41):
SendKeys(')')
elif(data==38):
SendKeys('&')
elif(data==33):
SendKeys('!')
elif(data==63497):
up()
elif(data==63498):
down()
elif(data==63495):
left()
elif(data==63496):
rigth()
elif(data==63557):
leftclick()
elif(data==63586):
rightclick()

parseStr = lambda x: x.isalpha() and x or x.isdigit() and int(x) or x.isalnum() and x or len(set(string.punctuation).intersection(x)) == 1 and x.count('.') == 1 and float(x) or x
server_sock=BluetoothSocket( RFCOMM )
server_sock.bind(("",PORT_ANY))
server_sock.listen(1)

port = server_sock.getsockname()[1]

uuid = "94f39d29-7d6d-437d-973b-fba39e49d4ee"

advertise_service( server_sock, "BLUECONTROL",
service_id = uuid,
service_classes = [ uuid, SERIAL_PORT_CLASS ],
profiles = [ SERIAL_PORT_PROFILE ],
#                   protocols = [ OBEX_UUID ]
)

print "Waiting for connection on RFCOMM channel %d" % port

client_sock, client_info = server_sock.accept()
print "Accepted connection from ", client_info

try:
while True:
data = client_sock.recv(1024)
if len(data) == 0: break
da=parseStr(data)
send(da)
except IOError:
pass

print "disconnected"

client_sock.close()
server_sock.close()
print "all done"

--------------

here i use a function parseStr to get the integer value form the received string .

later u can use pytoexe attribute in python to convert the server into a python independent running program

Thursday, March 1, 2012

Manually Remove Viruses from Your Windows

Most viruses launch when you log into Windows — they typically call an executable from the registry. In fact, that call will tell you exactly where the virus resides.

Start in the registry.

  • Click Start. Click Run and type: regedit.exe

  • Registry Editor opens. Expand HKEY_CURRENT_USER

  • Then expand Software. Next expand Microsoft.

  • Now expand Windows.

  • Then expand CurrentVersion.

  • Click on the Run folder.


Here you’ll find some of the programs that launch on startup. A rule of thumb: a virus is a randomly generated string that makes no sense.

The real giveaway that this is a virus is the location of the application it’s calling. It’s in the Application Data folder. It launches every time you log in. So no matter how many times you reboot, it comes right back.

Write down where the virus resides. In this case, it’s in the All Users Application Data folder. Then simply right-click the registry key and delete it. Now you haven’t actually deleted the virus, you’ve only deleted the call that launches it, which is doing the minimum. A virus is just a program, after all, so if the virus doesn’t launch it does no harm. But delete the file system anyway.

Now it’s time to go to the Application Data Folder. There is more than one — follow the path exactly as you wrote it down.

if its a VIRUS try the step in SAFEMODE