Simple Telnet Automation Using Expect – This is a nice simple bash shell script to automate and test telnet servers, it’s a nice script and well commented. Hope you enjoy, all comments welcome.

Simple Telnet Automation Using Expect – This is a nice simple bash shell script to automate and test telnet servers, it’s a nice script and well commented. Hope you enjoy, all comments welcome..

 

Explanation of Code (Bash Shell)

The code works by the user entering an argument, this argument could be either
-a, -h, or a server nickname. The -a argument would cause the bash shell to
log in and out of every server located in the autotelrc file, using the usernames
and passwords provided. The -h argument would bring up a small help message.
The code written is heavily commented but some parts deserve some explanation
as to their rationale.

 if [ "z$1" == "z" ]; then
echo “You didn’t type a valid argument.”

The z in front of the $1 argument is to tell if the user entered an argument
or not. If something isn’t entered it returns just the z by itself and the error
echo occurs.
If this condition is not true then the script then proceeds to the else statement.
Under this statement is another if statement. This takes account for the -a,
-h and server nickname argument. The counter I has been initialised at 2, this
saves us a line of code, if I = 2 then we would have to use another cut to trim
off the hashes in the rc file. So just incrementing the counter by 1 helps us
here. If the -h argument is used then the if statement give echoes us the help
message, which explains the usage to the user. If the -a argument is used, then
the statement then proceeds to work it’s way through the rc file and telnet
into each using the expect script (explained later) and then log out, this is
useful to a network administrator to test various telnet machines. If the user
specifies an argument with a server nickname then the script searches through
the rc file for the relevant line and telnets into it using the expect script.
The code used here was as follows.

 If [ $1 == $Nickname ]; then
./telExpect.exp $Machine $Username $Password
Fi #finish if statement

This was chosen instead of using the getops because it is much shorter code,
and in searching a small file there is not much performance difference.

6 Expect Script Examples to Expect the Unexpected (With Hello World)

6 Expect Script Examples to Expect the Unexpected (With Hello World).

 

Expect scripting language is used to feed input automatically to an interactive program. It is easy to learn compared to other scripting languages. Using expect script sysadmins and developers can automate redundant tasks easily. It works by expecting specific strings, and sending or responding strings accordingly.

Following three expect commands are used when automating any interactive processes.

  • send – to send the strings to the process
  • expect – wait for the specific string from the process
  • spawn – to start the command

Make sure to install expect packages on your system, as it does not get installed by default. Once installed, you’ll see the expect interpreter as “/usr/bin/expect”. Generally, expect script files has .exp as extensions.

25 Most Frequently Used Linux IPTables Rules Examples

25 Most Frequently Used Linux IPTables Rules Examples.

 

At a first glance, IPTables rules might look cryptic.

In this article, I’ve given 25 practical IPTables rules that you can copy/paste and use it for your needs.

These examples will act as a basic templates for you to tweak these rules to suite your specific requirement.

For easy reference, all these 25 iptables rules are in shell script format: iptables-rules

Rainmeter, desktop customization tool

Rainmeter, desktop customization tool.

 

What’s on your desktop?

 

Rainmeter displays customizable skins, like memory and battery power, RSS feeds and weather forecasts, right on your desktop. Many skins are even functional: they can record your notes and to-do lists, launch your favorite applications, and control your media player – all in a clean, unobtrusive interface that you can rearrange and customize to your liking. Rainmeter is at once an application and a toolkit. You are only limited by your imagination and creativity.

Rainmeter is open source software distributed free of charge under the terms of the GNU GPL v2 license.