Lost in Translation...

16th

Nov-2008

Mailing and Telneting with PERL

Jerry Posted in Computer and Internet, Education, Fun, Geekiness, Linux & OpenSource, Network and Security, Testing, tech., work No Comments »

There are many tutorials on the net on how to use the Net::Telnet module to write a script that will automate a telnet session. Perhaps the best place is the CPAN site itself. Though all i needed was a simple script that did the job, i had to scour through many other sites for reference. Finally i’m done with the script that will telnet to the server collect the logs and then mail it to the id that i specified.

I wrote the working version as two perl scripts. I still dont know why i did that, may be for the simplicity sake.

  • log.pl  => does the telnet to retrieve the logs and mail it to me
  • run.pl => which runs the log.pl every hour

So here is the code -

log.pl

#!/usr/bin/perl
use Telnet;
# ---------------------------
$date = `date`;
chop $date;
$mailId = "jerry\@jerrymannel.com";
$cmd = "cat in.log | mail ".$mailId." -s \"Logs - ".$date."\"  ";
# ---------------------------
$host = "192.168.1.100";
$port = "2300";
$uid = "jerry";
$pwd = "password";
open $inputLog,  ">in.log";
$box = new Net::Telnet();
$box->open(     Host => $host,
                Port => $port,
        );
$iLog = $box->input_log($inputLog);
$flag = $box->login(    Name => $uid,
                        Password => $pwd,
                );
$box->print("co");
$box->waitfor('/# $/i');
$box->print("show load;show cpu");
$box->waitfor('/# $/i');
$box->print("show log");
$box->waitfor('/# $/i');
$box->close;
# MAIL section
system $cmd;
exit

run.pl

#!/usr/bin/perl
while (1)
{
        $date = `date +%M%S`;
        chop $date;
        #print $date." - ";
        if ( $date eq "0000" )
        {
                print "Sending the mail @ - ".(`date`);
                system("./logs.pl");
        }
        sleep(1);
}

The script was run on a Linux machine. So i neednt worry about the ‘date’ command and getting the date printed out in a fashion that i needed.

:) Drop in a line of you have more queries on the script. Always happy to help.


11th

Nov-2008

Telnet Scripting Tool a.k.a TST10.exe

Jerry Posted in Computer and Internet, Fun, Geekiness, Linux & OpenSource, Network and Security, Science and Tech., Session/Workshop/Talk, Testing, Windows/Microsoft, tech. 1 Comment »

I have been thinking for a long time that i need to write about this tool that i found. Its quite interesting that this tool is really helpful in automating many of the routine sessions that i as a tester came across. This is by far the best automation tool that i found for telnet sessions.

Imagine these scenarios :

  • You need to do BSO authentications frequently when you switch networks
  • Get intermittent logs from the server for analysis
  • Run automated tests on remote systems (something which i have started to call as run-and-forget)
  • stuck in traffic…no way

Lets get into what this tool is and how to use it.

The tool is for windows (one of the things that i felt bad). To make use of this tool, u will need the exe file, i.e., tst10.exe and an input commands file. The input file will has the first line as the hostname/IP and port, which is followed by alternating SEND and WAIT commands.

Consider this example. I need to connect to a server of IP - 192.168.1.100, where a telnet service is running at PORT - 2300. This is how my script/input file will look like :

192.168.1.100 2300
SEND "\m"
WAIT "login:"
SEND "admin\m"
WAIT "Password:"
SEND "admin1\m"
WAIT "s1#"
SEND "co\m"
WAIT "s1(config)#"
SEND "show load; show cpu\m"
WAIT "s1(config)#"

“\m” = \n in C/PERL/Java/most programming langunages = CR or in non-techie terms “Enter”. SEND, sends the commands to be executed and the WAIT that follows tried to match the string in the output of the SEND commands before it.

How to run it?. There are 2 ways to do it. You can open up the command prompt navigate to the directory where the files are and then issue this command -

tst10.exe /r:IN /o:OUT

where IN is the input file and OUT stores the complete output of the session, so that you can skim through the file and have a look at what happened. OR, put the command in a batch file and double click it every time you need to run it.

Here is the screen capture -

TST10 Screen Capture

TST10 Screen Capture

How is it different from Net::Telnet module of Perl or something similar in TCL or Python? Think about it.

  • Time to write the code - 30min to ? depending upon how complex the situation is
  • Trying to match the output to with REGEX, which means that you need to spend time in coming up with the right regex. Now you have 2 problems in hand
  • Testing time to make sure that the script is robust enough

So this is perfect! NO. This doesn’t work for ssh sessions. Since telnet is getting substituted by ssh in most of the servers due to the secure nature of the connection its kind of difficult to fit it in a normal installation of Linux. I’m not sure about the telnet-ssh thingie happening in Solaris or any of the other servers.

Is there something like this for Linux? :( No. Hey, but look at it this way. Its some relief for us on windows platform for scripting.

You can build complex automatons with this combined with a little bit of Perl and Outlook. Here is one typical scenario that i made and which i have presented as a white-paper.

  • Outlook has a setting that detects for incoming mails with a specific subject line.
  • When the mail comes it evokes a Perl script.
  • The Perl script will go ahead an call the TST’s batch file, which initiates the TST10 session, connects to the remote server starts/runs the automation. The output will be stored in OUT file
  • The Perl script will skim the OUT file for any errors reported during the run.
  • Then it calls an FTP script that will go ahead and get the log files from the remote system
  • The log files are read, the results extracted and neatly formatted into mail and send to the required email-ids

:) sounds complex, but this script gave me enough time to hut for a new job and quit the previous employer.

Who wrote this? Someone by the name of Albert Yale. His home page is - http://ay.home.ml.org/, sadly the site is no longer online.

What happened to the white-paper? It got rejected ;) , humor was not the order of the day.

Download TST10 : tst10.exe | tst10.zip


4th

Sep-2008

Google Chrome - First Impressions

Jerry Posted in Browsers, Computer and Internet, Fun, Geekiness, Linux & OpenSource, Review, Science and Tech. No Comments »

chrome-205_noshadow Google Chrome - First Impressions

What should i comment on this browser. First thing that caught my attention was the cool technology that went into this beautiful little app. Remember the days when we used IE, then Fx came along and just tripped and toppled our whole browsing experience. Fx came up with the idea of tabs, imporved browsing experience, plugins etc. etc. You name it they had it, or rather they were ready to include that in their next realease.

I feel the same when i see Chrome or Google Chrome. Its the coolest idea that we can have for a browser at this point. A browser that doesnt crash or rather does a good crash. It never affects any of your other open sessions.

(Read the Chrome story)

The best fact - its open source. That means that even my granny can get the source code and help Google imporve it or can come out with her own Hare-Rama-Rahe-Krishna Browser for the religious kind.

After the initial interations with other users over twitter. I found that people have some common issues, worries, concerns etc etc and not to mention a funny stuff too.

Prasanth a fellow Mutineer, found the shift to Chrome taking a toll on his mental heath, it was too mentally tiring for him.

Sivaprasad was able to download the online installer, but as he was sitting behing a proxy and had to authenticate the installer didnt finish what it had started. He was kind enough to send in the fix for the problem which he found here.

For all those who need a complete offline installer, i have uploaded the same in my site and is awailable for download at this link - Chrome Download. This was Allajunaki’s idea

Interestingly Kiruba reported and error thrown by Chrome that read - “Google Chrome has encountered a problem and needs to close. Please tell Microsoft about it”. :D

Waiting for more reactions…

(first post on/using/with Chrome)

Chrome Offline installer Download


18th

Jul-2008

The Case of a Firefox Bug!!!

Jerry Posted in Browsers, Computer and Internet, Geekiness, In My Readings, Linux & OpenSource, Science and Tech., Windows/Microsoft No Comments »

How cool can it get. On the very first day at office you get to do things that you just simple love doing?

The Case : A page is displayed with a certain width in IE. But is taking the whole width in Fx … :)

Sounds familiar ? They where about to tag it as an Fx bug. Wait a sec!!! That’s not a BUG in Fx. Its just the way Fx is handling things. Pop in some things i read at Joel’s blog - Martian Headsets. Voila!!! all agree that its not a bug… :). I’m happy, they are happy … :)

Here is my simple explanation :

Its all with the implementation difference of the two browsers.

In US you drive on the right side of the road. Hence all cars are left-hand drive.

Bring the same car to UK/India where we drive on the left side of the road, things seem to be a bit mixed up. You car is not buggy nor is the law in place. Cars are always designed to place the driver towards the center of the road. in UK it has to be the right side of the car, but in US it has to be the left side. There is no way out.The three seat setup inside an F1.

Why is there this problem? Coz all the countries doesnt have the same traffic rules. They have some basic guidelines in place and have the law built around it to match them. Simple!!!

To solve these confusions. Own a McLaren F1 car. It has a 3-seat setup, with the driver in the center. You never will have problem again. Just that you would have to be filthy rich .. :)


29th

May-2008

Windows 7 - First Thoughts

Jerry Posted in Computer Security, Computer and Internet, Entertainment, Freedom, Geekiness, IT Industry, Linux & OpenSource, Mac OS, Media, News and politics, Report, Review, Science and Tech., Windows/Microsoft, tech. No Comments »

I will try not to be too much biased against Windows. But will like to point out what is wrong.

Hearing the news of the Demo/Preview/Debut of Windows 7 at D6 conference by Microsoft VP Julie Larson-Green, my first reaction was, Oh NO not again!!!

fp__fp__fp__vista2bp81 Windows 7 - First ThoughtsI had my concerns. Microsoft has been stealing the show with its sleeky looks and publicity. If there is somebody at the market that can sell a rickety old-bus just by repainting it, its Microsoft.

Though all the other OS-es has evolved with age, windows simply refuses to budge more or less. The system requirements just to run a basic version of their latest OS takes more than twice the power that is required to run the latest Open Source OS. The fact remains that will less overhead the Open Source counterpart gives the looks and the WOW-ness.

How far can they drive along by just adding the new features without correcting the basic problems.

XP came and by the time people got adjusted to the response time, reaction time and usability, Vista was born. Now why the hell do i have to go for double the configuration for a new OS. Then again i will be doing the same things but that is going to add another transition phase in my life. From my own personal experience, the very simple task of setting an IP which took 4-5 clicks in XP, took me 5-10min in Vista just to figure out how to get the Properties window. Though basic functionality of an OS that the user looks for needs to be kept the same across versions, Microsoft fails to comply.

If the new version is going to be more user friendly than its previous one, why do you still need to pack the age old Win-98 looks with XP? They need to realize what the other OS-es in the market are doing different to keep things abreast with feature improvements, usability and performance.

At this point they just need to stop stuffing in features into an OS. It more or less looks like a huge american burger. A bite at one end will have half of the things falling out of the other end. By the time you get used to the new tasty burger in comes a new version double the size.


6th

Apr-2008

Wordpress 2.5 Image Upload Problem

Jerry Posted in Blogging, Browsers, Computer and Internet, Fun, Geekiness, Linux & OpenSource, blog, tech. 3 Comments »

Finally after more than 5 hours of trial and error i have the image uploader working fine for me. Trying this out crashed Firefox many times and i finally had to send a crash report to Mozilla.

Followed all the differsnt instruction as mentioned in this post. Changed the .htaccess file to various different formats. Nothing worked. Neither

Option -1 :

<IfModule mod_security.c>
SetEnvIfNoCase Content-Type \
“^multipart/form-data;” “MODSEC_NOPOSTBUFFERING=Do not buffer file uploads”
</IfModule>
<IfModule mod_gzip.c>
mod_gzip_on No
</IfModule>

Option - 2 :

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Option - 3 :

SetEnvIfNoCase Request_URI ^/wp-admin/async-upload.php$ MODSEC_ENABLE=Off

Option - 4 :

<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>

worked. It worked for some one. But never for me.

Finally there was one post that asked to give the full path for the upload folder. That only created a this directory path in the root folder - http:/jerrymannel.com/blog/wp-content/upload/

Yes things got messier ..

Then reading down the same forum i found this link - 2.5 Image/Media Uploader problems. Now that was a saver. Went setp by step. Bang!!! Step 4 was what had to be done and BINGO!!! Everything worked…. :)

I recommend starting at this and then trying out editing the .htaccess file. Happy Blogging.


3rd

Apr-2008

133t Series - My Fav Xkcd Strip

Jerry Posted in Computer and Internet, Entertainment, Geekiness, Linux & OpenSource, Network and Security 1 Comment »

xkcd.com logoXkcd is one of my fav web comic. Such good humor is hard to find, worst of all, i cant share that with most of my friends, cos half of them wont understand who Richard Stallman is.

Sharing here is my most favorite Xkcd series - the 1337 and that means “leet”.

1337: Part 1

read more at Xkcd itself…


10th

Jan-2008

The Most Hated Company

Jerry Posted in Computer and Internet, Linux & OpenSource, Mac OS, Media, Network and Security, News and politics, Science and Tech., Windows/Microsoft No Comments »

11-1-07-eee The Most Hated CompanyPicture this about a laptop

It comes for as low as $299, ie Rs. 12K. Most expensive is $499, ie Rs.20k
Fully-featured laptop costs $69 less than the 16 GB Apple iPod Touch.
It’s $100 less than an Amazon Kindle e-book reader
It runs Linux (Xandros running KDE)- which is $30 less than Amazon.com’s discounted price for Microsoft Windows Vista Ultimate
They first in market with flash based storage.

Now thats a laptop that i would buy soon. (Just dont ask how soon ’soon’ is, as i’m known for procrastinating)
This makes ASUS Eee PC hated by, well lets just say every major company. Now that includes - Microsoft, Apple, Dell etc. and Azuztek a.k.a Azuz the most hated IT company as of now.
Intel loves them coz they are running a Celeron processor.
Is this going to hurt OLPC after the Intel back-out? I dont know and frankly i cant just about predict or speculate anything about the OLPC project. Their $100 laptop is now priced at $200 and now without Intel … i just cant make out anything.
[Source of news - http://itmanagement.earthweb.com/]
[Image source - engadget]


10th

Jan-2008

Some reasons why you SHOULD use Free Software..

Jerry Posted in Advice, Browsers, Computer and Internet, Fun, Geekiness, Linux & OpenSource, Network and Security, News and politics No Comments »

copyleft Some reasons why you SHOULD use Free Software..No before i get into the whole thing, by Free Software i mean the programs that follow the 0-3 Freedoms as stated by the Free Software Foundation. Or rather Copy-Left than Copy Right … :)
Why is that a Free S/w user is so good at fixing a system, trouble shooting software issues and fixes thing without even reading the manual.
Now these are the reasons

1) Free software users expect open licenses and no activation methods
2) Free software users expect regular upgrades and patches
3) Free software users expect to work the way they choose
4) Free software users want control of their own systems
5) Free software users explore
6) Free software users expect to help themselves
7) Free software users don’t fear the command line
8) Free software users learn software categories, not programs
9) Free software users expect access to developers and other employees


27th

Dec-2007

DOMPlayer and the Doom.

Jerry Posted in Advice, Computer Security, Computer and Internet, Geekiness, IT Industry, Linux & OpenSource, Network and Security, Science and Tech., Security, Windows/Microsoft 3 Comments »

Creativity has no limits and the fact that people can go to any extend to infect you machine with malware, let me say comes as a total relief. After people has spend dollars securing their machine with the latest spyware remover, anti-virus, pop-up blocker and all the shit that you can get you hands on, there is no stopping a curious browser who downloads some thing and authorizes it to do some operation and ends ups in a deeper shit that he was before.

We all love torrent. The countless torrent files that you looked up on the net to download your favorite movie, would have at least made you thin, what you would have done with out those torrent sites. Its the same feeling you get when you thank George Bush for the oil that he is bringing in from Iraq and Kuwait.

So when some thought of the idea of infecting your machine with the help of torrent download and get paid $3 for doing so , has to be credited with the ingenuity of the idea. Here is the whole scenario.

You download a movie (most of the reports came up with the latest movies like Hitman, Beowuf, National Treasure : Book of Secrets) or an episode of your favorite series on TV. When you try to play it it says

This video can only be played in DomPlayer, Visit Download.Domplayer.Com

Like any other desperate downloader you visit their site :

dom3wplayer_image002 DOMPlayer and the Doom.

Pretty neat site of a movie player, compared to VLC Player and Real Player. So you go and download the player, the Download button is right in front of you. So whats the big deal. Go ahead download the file… At this point i got suspicious and thought hey i never heard any of my friends talk about such a player, instead of installing it at the home PC (Windows XP), let me try to get an installer/player for Linux. That way its safe and its my Laptop, if anything gets screwd up i can just install all over again. Big Deal!!!

Web searches got me to couple of forums here and here. They talked about another player 3wPlayer by Wildman Productions(i have no idea who the hell they are).

dom3wplayer_image004 DOMPlayer and the Doom.

bst DOMPlayer and the Doom.In fact the real deal here is as reported from Best Security Tips is DOM Player says its clean but you call them up and pay them to activate the attack on your P. If that doesnt work they ask you to download 3wPlayer. Which is another piece of shit and load the malware to the PC free of charge.

Now that is a cool idea. You get paid to get infected like the way you paid to get protected. Over that you download movie files (AVI files) which might be renamed porno movies.