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


5th

Sep-2008

My Fav XKCD Comic Strip

Jerry Posted in Computer and Internet, Entertainment, Fun, Geekiness, reading, tech. No Comments »

Just read along the 1337 series

Part - 1

1337: Part 1

Part - 2

1337: Part 2

Part - 3

1337: Part 3

Part - 4

1337: Part 4

Part - 5

1337: Part 5

Simply awesome …


1st

Aug-2008

Blogging Workshop at BIMTECH

Jerry Posted in Blogging, Education, Entertainment, Friends Blogging, Fun, Mutiny.in, Report, Review, Travelogues, tech. 5 Comments »

logo-BIMTECH Blogging Workshop at BIMTECHNever ever did i expect that something that i follow as a passion would get me a chance to conduct a session at one of the best business schools in north India.

Last week-end, i flew to Delhi and on Saturday i was at BIMTECH, Greater Noida, for a session on blogging and the monetary benefits of blogging. The E-Cell of BIMTECH had contacted Mutiny for help and i took the offer.

The session was planned at 6p.m.. You really have to appreciate the guys who study at b-schools, a session at 6p.m. was nothing for them. Other colleges too were invited for the workshop and there were indeed people present at that time of the evening on a Saturday evening.

The session kicked off after a brief intro about the speaker, ahhmmmm that’s me :), and about Mutiny and of collage-300x187 Blogging Workshop at BIMTECHcourse about my friend Mayank (yes its the StudioWordpress guy!!! - http://mayankgupta.com or http://mayank.info ). Mayank was supposed to be on time and help me out with the session, but he was caught up with an emergency Snooker game-session. Well he did turn up to save me for the last 30min :).

I started off at the same grounds from where i started the blogging session at Wipro. Telling them everything that i knew about blogging, etiquette, etc etc. But there was a flaw. Most of the people who were there didn’t know how to start a blog. By ’start a blog’ i mean they didn’t know even how to get a blog at blogger. The lesson - get to know the people and the requirements before we start.

So STOP!!! Get back to the basics. Took them through the live demo of setting up a blog in Blogger. So when all was set, and everyone was on the same page, we were back to where we stopped.

Mayank was just in time as i was getting warmed up with the business side of blogging. Talked about some of the ways that i knew about making money out of blogging. Though i have to mention that i’m too lazy for a blogger that i don’t earn as much as others do, out of blogging.

The idea of a community blog was something new to them. The facts on how Mutiny has grown and maintains itself interested them.

After that it was Mayank’s turn to help everyone with the things that he knows. The way he earns his living was interesting to listen to and i’m quite sure that it would have opened up some idea for those who were listening.

The fact that interested me a lot was the volume of idea that people had for blogging. They all wanted to blog for so many reasons and they just wanted to know how.

Put together the session was one that’s one of the most memorable. I’m taking back some very valuable learnings and some ideas with me.

More pics here

BloggingWordshopAtBIMTECH Blogging Workshop at BIMTECH
Blogging Wordshop at BIMTECH

If any BIMTECH guys are reading this, i would like you to give me you feedbacks and comments too .. :)

(Cross-posted here)


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.


24th

May-2008

Blogging Workshop @ Wipro

Jerry Posted in Blogging, Computer and Internet, Entertainment, Friends Blogging, Fun, IT Industry, Media, Town & City Life, blog, tech., work 3 Comments »

Applying ThoughtThe day before the session, Christine calls me up and asks me, “So how do you intend to start the session?”. Then it hits me that, all this time i was preparing for each of the workshop, but didn’t even think of how to start of the whole discussion/workshop. Oops now i need to plan. gulp!

Ok, i felt i was going to crash and burn during the session - 1. I had no idea how i’m going to start off 2. The slides looked very very boring. The slides were a disaster, i was planning a workshop and they wanted slides if the whole thing was to be approved by the management. As a last minute step, turned to Calvin and Hobbes for help. Boy! they helped. Now my slides looked wacky and who ever saw it smiled. Let it be. So i spent the rest of yesterday’s evening taking screen shots of Twitter, Kwippy, Muziboo, Tempostand, Mutiny.in, All things Pakistan and individual blogs of 2s, Amit Agarwal, Adeeth’s and Mine. I would have loved to show all the blogs that i read, but the company firewall just blocked’em off. :(

On the D-Day, I was 30 min well before time and met up with Christine. The first of the participants turned up and didn’t even hope to have even 10 people. With all the work and things around, chances are that something like blogging could take a back seat for people. I was mistaken. There was close to 25 participants.

So here we go, as an intro got all the people who were there and had a blog to have their blog-ids written on the board. Only 8!!! Great!!! So more people wanted to get into blogging and as i learned they were confused at some point or the other with many things.TypePad

As we started off, i made the fact clear that it will be a discussion/workshop as opposed to a session. Pushed for some user interaction and it just took off from there, jokes, experiences and facts. A fun filled session where the beginners are now serious on starting a blog. To the question, Should Al Qaida blog? YES was the reply, as they all believed no one should be stopped from blogging.logo Blogging Workshop @ Wipro

Interestingly, every one converged on the point that, blogs provide a fact / news in its raw format rather than the media, which they though to be fabricated. We moved on to show the newbies how simple it was to set up a blog. Interestingly most of the people who blogged used Blogspot and haven’t even heard of LiveJournal or TypePad.

logo Blogging Workshop @ WiproThe discussions drifted from some serious discussions on What to be done on profanity?, What formed the basis of Moderating a Comment?, The Do’s and Dont’s of Blogging..etc to some fun stuffs that i shared with them. Interestingly people didnt know what RSS feeds are. So got someone to explain the whole RSS funda to them.

What is MicroBlogging and why do we do it?, was a tough one to make them understand. Finally i feel that when i showed them Twitter and the indian counterpart Kwippy. They then got the whole idea of micro-blogging.

Finally i had to tell them about Google Analytics and showed my own Analytics graph as an example of the worst thing that you can do - being lazy. The downward graph showed it all.
I was quite overwhelmed by the participation i had and people said it was wonderful. Felt good.

The presentation that i made can be found here - Blogging Workshop (PPT)


23rd

May-2008

Tete-a-tete with CTO of Xerox

Jerry Posted in Computer and Internet, Education, Geekiness, IT Industry, Media, News and politics, Science and Tech., tech. 2 Comments »

scobleizer-tv Tete-a-tete with CTO of Xerox

Scobleizer has done this video, a talk with the CTO of Xerox, Sophie Vandebroek at Palo Alto Research Center.

She has talked about some really interesting things.

Xerox as i knew was just about making ‘xerox’ copies. The term Xerox has now become synonymous to make a copy. But the real Xerox is into many more fields like Biomedical, clean water, etc.

She says, “Its fun to work in Xerox because we create the Future, Today!!!” and “We no longer makes copiers…”. WOW!!!


24th

Apr-2008

Various Moods at Barcamp Bangalore 6

Jerry Posted in BarCamp, Computer and Internet, Fun, IT Industry, India, barcampbangalore6, bcb6, tech. 3 Comments »

Though this post comes a week late, but its stilll worth sharing those moments. Here is the link to the fotos

Ujj Living out the real spirit of a BarCamp by helping out with things…

005-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

100rabh getting geared up for the day’s hungama…

009-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

Ashwin taking shots of the people at the Reg. Desk
011-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

The crowd deciding on the days topic…
018-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

The Spirit of Barcamp
020-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

Some girl loves Prashanth …
034-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

The Twitterers who turned up for the Tweet-up
050-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

Thej flaunting .. uhhh .. his EeePC..
051-BCB-6-Day-1 Various Moods at Barcamp Bangalore 6

Remnants of BCB5…
026-BCB-6-Day-2 Various Moods at Barcamp Bangalore 6

More at my album

BarcampBangalore6 Various Moods at Barcamp Bangalore 6
Barcamp Bangalore 6


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.


6th

Dec-2006

End of Road for SUSE 10.1

Jerry Posted in Fun, Love, RedHat, SUSE, tech., work No Comments »

fedora_core End of Road for SUSE 10.1
So finally i have all the CDs necessary to carry forward the switching from SUSE10.1 to FC6.

Have to kick start all my activities now.