Scripts to find and verify SSH logins to other machines by hacking back via Kippo

Standard

First we log all the connection attempts to my server(Live or new Virtual Machine) using the package called Kippo – http://code.google.com/p/kippo/.


Then we create this file I called grab_ssh_info.sh(Click for latest).

# Only read todays and loop each line in the string
grep -i $todays_date /home/ris/kippo-0.5/log/kippo.log | while read -r line; do

# Only read the lines that contain login auths and IPs. All in one line in this case.
if [[

]]; then
# Cut out the different parts.
inIP=

inUSER=

inPASS=

# Throw it all in together for outputing to a log of my own.
output=”$inIP|$inUSER|$inPASS”
#echo $output

# IF we do not already have it in the log, append the info to it.
if [ ! -e /root/scripts/kippo_ssh_auths.log ]; then
touch /root/scripts/kippo_ssh_auths.log
fi

grep -q “$output” /root/scripts/kippo_ssh_auths.log
if [ $? == 1 ]; then
echo “$inIP|$inUSER|$inPASS” >> /root/scripts/kippo_ssh_auths.log
fi
fi
done
[/crayon]


Then we can use the copy of /root/kippo_ssh_auths.log log to try and connect BACK to the door knockers machine and see if the login works.
If it does, add it to a success log(if new) and go on to the next one.
If it fails, ignore it. It will be deleted when we delete the copy of the log file at the end of the script.
I call this file test_ssh_info.sh


Small script(start_kippo.sh) for cron to make sure your Kippo is still running.
I noticed that the small VPS I was running would kill Kippo once awhile because I ran out of memory(32MB) and swap(32MB). So I tested every minute to see if needed starting again.


Set your log rotation to cycle the Kippo log every 24 hours or my scripts will be re testing a lot of ssh connections.
Set your cron to run them whenever. I recommend just before the logrotate cycle. Just make sure it is sequenced right. Do the grab script first.

1,185 total views, 1 views today

Physical to Virtual in VirtualBox – VirtualBox P2V

Standard

From: Physical to Virtual in VirtualBox – VirtualBox P2V.

VirtualBox P2V Physical to Virtual in VirtualBox

This article explains how you can do VirtualBox P2V convert physical machine to virtual machine in Sun VirtualBox. It’s not straight forward method since there no tools available for VirtualBox P2V Physical to Virtual conversion. But still it’s possible with free VMware tool.

Before start the procedures, let me tell you how it’s going to work.

VirtualBox P2V

We will use a free VMware converter tool to convert physical  to virtual machine which will create VMX and VMDK files according to physical computer and disks configuration.

Then import the created VMDK file to VirtualBox as hard disk, create a virtual machine and boot from VMDK file hard disk. That’s it. It will work fine.

Don’t waste your time to search a tool VirtualBox P2V convert Physical to Virtual in VirtualBox directl, its not available till today if I’m not wrong.  If you are a VirtualBox fan and you want to try P2V and run in Sun VirtualBox, then this is the only VirtualBox P2V option available.

Physical to Virtual in VirtualBox – VirtualBox P2V – Step by step methods

1)      Download VMware Converter here

2)      Convert your physical computer to virtual using free VMware vCentre converter as mentioned here. Make sure you select correct physical partitions, processors and memory size for new virtual  machine. Don’t split the virtual disks during the conversion.

3)      Once successfully created, locate the VMX and VMDK files. Don’t bother about VMX files.

4)      Now add the newly created vmdk file to VirtualBox media manager as shown below.

VirtualBox P2V

5)      Read more about adding and accessing vmdk disk files in sun VirtualBox here. This article explains how you can access vmdk disk file as partition in side virtual machine in sun VirtualBox. We don’t require that much now. Just to know how to add vmdk file to sun VirtualBox media manger.

6)      After successfully added vmdk disk file, create a new virtual machine in VirtualBox. Select the correct guest OS, processor type and memory size. In virtual hard disk box  select ‘Use existing Hard Disk’ and browse the disk you added by vmdk file in VirtualBox media manager. So your new virtual machine will boot from vmdk disk which we converted from physical to virtual.

Physical to Virtual VirtualBox P2V

7)      That’s it. Boot the virtual machine now. It will be booting and working fine. Sometimes it may install additional required drivers on sun virtual machine. Let it complete and install the Sun guest additions  to get better display performance with additional features.

8)      You must see your physical computer on Sun VirtualBox as virtual machine now. This is the easiest method to convert Physical to Virtual in VirtualBox – VirtualBox P2V with free tool.

9)      If you are still interested in running pure sun VirtualBox machine with VDI files, you can convert your newly created VMDK files to VDI format with free tool as mentioned here. After created vdi file add it to media manager and boot virtual machine from vdi files.

If you face any problem let me know, we can solve it together. if I’m wrong about VirtualBox P2V tools tell me where I can download  it and do P2V in Sun VirtualBox in one shot.

Physical to Virtual VirtualBox P2V

979 total views, no views today