Tuesday, April 18, 2006

Forgot password for Windows 2000?

Hi,
well, this trick can work only if you have got a dual boot machine with linux as one of the os. Also, either you should be a root or the windows partition should be mounten with appropriate permission.

just delete the file
"winnt/system32/config/sam"
and you are done. you can boot your machine in windows and can get entry with
user : administrator
passwd :

leave the password field null.

Saturday, April 15, 2006

Running commands using script


#!/usr/bin/perl
#Written by Vaibhav.
#guptav[at]cse[dot]iitb[dot]ac[dot]in on Mon Mar 7

use Expect;
#List of IPs in file 'IPS'
open(IP,"<IPS");
@IPS=<IP>;
close IP;
my $newpassword = "yourpassword";

foreach $ip(@IPS) {
chomp $ip;
print "-------$ip-------\n";
my $timeout = 50;
my $aft = new Expect;
$aft->spawn("ssh $ip")
or die "Cannot ssh to the machine \n";
$aft->log_file("/tmp/expect_log");
$aft->expect($timeout,'-re','\? $');
$aft->send("yes\n");
$aft->expect($timeout,'-re','password: $');
$aft->send("$newpassword\n");
$aft->expect($timeout,'-re','# $');
$aft->send("ls\n"); # OR LIST OF COMMANDS
$aft->expect($timeout,'-re','# $');
$aft->send("exit\n");
}