MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Mon, Dec 29, 2008 10:29 pm

Scripting Telnet Under Microsoft Windows

Telnet sessions can be automated using the Telnet Scripting Tool v.1.0 written by Albert Yale. I found the utility at How can I reboot my Alcatel SpeedTouch Pro by using a shortcut or a script?, where there is a sample of a text file that can be used to automate a telnet connection. The first line placed in the file contains the IP address of the telnet server followed by the port number to be used (23 is the default port for telnet connections). The subsequent lines contain the strings to wait for from the server, e.g. WAIT "User :" and to send as responses, e.g. SEND "\m". The \m is for a carriage return and linefeed.
Usage Syntax:

tst10.exe /r:script.txt [options]

/r:script.txt      run script.txt
[options]          any of these:

/o:output.txt      send session output to output.txt
/m                 run script in minimized window

Usage Example:

tst10.exe /r:script.txt /o:output.txt /m

Scripting Syntax:

HOSTNAME PORT      port number optional, default: 23
WAIT "string"      string to wait for
SEND "string"      string to send
\"                 represents the a quote character
\m                 represents a <CR/LF>
\\                 represents the backslash character

Scripting Example: 23
WAIT "login"
SEND "root\m"
WAIT "password"
SEND "mypassword\m"
WAIT ">"
SEND "dip internet.dip\m"
WAIT ">"

Scripting Note:

You can start with either WAIT or SEND commands,
but you *must* alternate them. ie: you can't use two
or more WAIT or SEND in a row.


TST will disconnect and close as soon
as its done with the last entry of the script.

If you need to, you can type in the terminal
window while the script is running.

You can use the tool to automate not just sessions where you log into another system via the telnet protocol, but other types of connections where you might use the telnet command.

E.g., I often telnet to the Simple Mail Transfer Protocol (SMTP) port, which is port 25 on mail servers, to troubleshoot connections. The Telnet Scripting Tool (TST) can be used to automate this type of testing as well.

For instance, I created a file, testSMTP.txt, to use with the Telnet Scripting Tool in timing how long it was taking a mail server to display its banner. The banner from mail server software, such as sendmail, usually begins with the code 220, e.g. 220 ESMTP Sendmail 8.13.8/8.13.8; Mon, 29 Dec 2008 21:39:48 -0500. So, I placed the following commands in a file to connect to a mail sever at address 25
WAIT "220"
SEND "quit\m"

The first line specifies the IP address of the server followed by the port number to use, in this case port 25 for an SMTP connection. The WAIT "220" tells the Telnet Scripting Tool to wait for the string 220 from the server and then to send the quit command followed by a carriage return and line feed, e.g. the characters that would be sent if I typed "quit" and hit the Enter key

I then opened a command prompt on a Windows XP system and entered the command below:

C:\DOCUME~1\JSmith\MYDOCU~1\>"\program files\network\tst10\tst10.exe" /r:testSMTP.txt

In this case the file testSMTP.txt was in the current directory, but the tst10.exe program was in \program files\network\tst10\tst10.exe

Note: before using the program,I uploaded the executable, TST10.exe, to VirusTotal, a service that scans files with many different antivirus programs. It checked the file with 38 antivirus programs. None of them found any malware within the file (see MD5: 4aee641e6ddb9a5fa95f590273729708). Note: the viradd and virsize in the Portable Executable (PE) information stand for "Virtual Address" and "Virtual Size" respectively (see Strange tcpip header?).

Download Locations for TST10.Zip

Petri IT Knowledgebase
MoonPoint Support
TheWorldsEnd.NET - free PHP networking scripts


  1. How can I reboot my Alcatel SpeedTouch Pro by using a shortcut or a script?
    By: Daniel Petri
    Petri IT Knowledgebase
  2. Telnet Scripting for the DSL-G604T
    D-Link DSL-G604T Wireless ADSL Router Support Forum

[/network/telnet] permanent link

Mon, Dec 29, 2008 8:37 pm

The Letter "C"

A family member asked me why the English language has the letter "C" when it sounds like "K", e.g. "carp", "clown", or "public", or the letter "S", e.g. "publicity" or the second "c" in "cache", when it appears in words. She wanted to know why we didn't just dispense with the letter altogether. So I did a little online searching with Google and found an explanation at the history of the letter 'C'.

The explanation was that it derives from the Roman use of the letter C to stand for the K sound. The Anglo-Saxons in what is now Great Britain adopted the Roman system. After the Battle of Hastings in which William the Conqueror defeated the Anglo-Saxon forces led by Harold Godwinson many French words became part of the English language. The Norman French pronounced "C" as "S" before the letters "I,E,(Y)". So "C" became a letter with two sounds.

[/languages/english] permanent link

Mon, Dec 29, 2008 2:57 pm

Chopping Strings in BASH

The Bourne-again Shell (BASH) provides built-in mechanisms for extracting substrings from a string.

You can set the value of a variable with myvar="some text". You can view the value of the variable using $myvar or ${myvar}. Putting the "$" in front of the variable name causes BASH to use the value stored in myvar.

$ myvar="some text"
$ echo $myvar
some text
$ echo ${myvar}
some text

There is sometimes an advantage to the format that encloses the variable name in curly braces, i.e. the ${myvar} format.

$ echo "foo$myvar"
foosome text
$ echo "foo$myvarother text"
foo text
$ echo "foo${myvar}other text"
foosome textother text

In the above example, in the instance where the curly braces weren't used, the value of myvar wasn't displayed, because BASH didn't know I wanted myvar rather than myvarother, which has no value assigned to it, so it just dispalyed "foo text". In the second instance where the curly braces were used, BASH could tell I wanted the vaue of myvar and displayed "foo some textother text".

Substrings can be extracted from a string by chopping characters from the beginning and end of a string.

Chopping a trailing character:

You can chop a trailing character from a string in BASH by placing the variable name inside ${ }, such as ${myvar}, and then using %<char>. E.g. suppose myvar has the value "0064092004008999,". To remove the trailing comma from the end of the variable, you could use myvar=${myvar%,}

$ myvar="0064092004008999,"
$ echo ${myvar%,}

If you wanted to remove the last "9" and all characters that appear after it in the line, you can use "*" in the expression.

$ myvar="0064092004008999,"
$ echo ${myvar%9*}

In the example above, the shortest matching substring is selected and removed, i.e. the "9,". If you wanted to remove the longest matching substring, e.g. every character from the first "9" onwards, you could use

$ myvar="0064092004008999,"
$ echo ${myvar%%9*}

Chopping leading characters:

You can chop leading characters from a string by using # or ##. E.g. suppose myvar has the value "SNMPv2-MIB::sysContact.0 = STRING: John Smith". If you only want the name John Smith, you can use ## to remove the longest substring containing the ":" character. I.e., using myvar=${myvar##*:} wold work. If you instead used only one "#", the shortest matching substring would be removed. I.e., using myvar=${myvar#*:} would return :sysContact.0 = STRING: John Smith, where all characters up to and including the first ":" are removed.

$ myvar="SNMPv2-MIB::sysContact.0 = STRING: John Smith"
$ echo ${myvar##*:}
John Smith
$ echo ${myvar#*:}
:sysContact.0 = STRING: John Smith


  1. Bash by example, Part 1
    Fundamental programming in the Bourne again shell (bash)
    Date: March 1, 2000

[/os/unix/bash] permanent link

Fri, Dec 26, 2008 7:24 pm

Send NetScreen Traffic Log to a TFTP Server

You can view the traffic log from a NetScreen firewall using the get log traffic command. If you are using the CLI for the router, when the results are displayed via a console or SSH connection, you will need to hit a key at the more prompt to page through the output. You can hit q to stop paging through the output.

But rather than page through it by the above method, you can also transfer the contents of the log to a TFTP server. Instructions for setting up a TFTP server on a Linux system can be found at Setting Up a Linux TFTP Server.

To redirect the output to a TFTP server, use the command get log traffic > tftp <IP Address> <filename>, substituting the IP address of the TFTP server for <IP Address> and the name of the file you want to write to on the TFTP server for <filename>. E.g. the command below would store the log file on a TFTP server at IP address in the file NetScreen-log.txt. Note: the file NetScreen-log.txt must already exist on the server, though it may be an empty file prior to transfer of the log file from the NetScreen firewall

ns5gt-> get log traffic > tftp NetScreen-log.txt
redirect to,NetScreen-log.txt
tftp transferred records = 1308
tftp success!

If you see a tftp timeout max error message followed by a tftp abort message, firewall software on the TFTP server may be blocking the file transfer. If you see a !rcv tftp error(1) File not found message then you likely have mistyped the name of the file that should be pre-existing on the server or the permissions on that file are not set appropriately, e.g., if the TFTP server is a Linux or Unix system, the file should have world read+write permissions set on it, which you can set with chmod 666 filename.

Applicable Products:

Applicable ScreenOS:


  1. How To: Redirect output to a TFTP server
    Date: October 7, 2008
    Juniper Networks Knowledge Base
  2. Setting Up a Linux TFTP Server
    Date: December 26, 2008
    MoonPoint Support

[/security/firewalls/netscreen] permanent link

Fri, Dec 26, 2008 6:23 pm

Setting Up a Linux TFTP Server

The Trivial File Transport Protocol (TFTP) proivides a mechanism to read files from or write files to a remote server. It is similar to the File Transfer Protocol (FTP), but doesn't have all of the features of FTP, such as an authentication mechanism.

The instructions below were written for the CentOS distribution of Linux, but TFTP server software is available for Linux, Unix, Windows and other operating systems. For Linux systems that use the Red Hat Package Manager (RPM) package management system, you can determine if the tftp-server package is installed with the command rpm -qi tftp-server.

# rpm -qi tftp-server
package tftp-server is not installed

The tftp-server package depends on the xinetd package; you can check if that package is installed with rpm -qi xinetd. If it isn't installed and you use the Yellow dog Updater, Modified (YUM) package management utility, you can install both packages with yum install tftp-server xinetd. To install just the tftp-server package, use yum install tftp-server. The installation of the tftp-server package will create the directory /tftpboot on the system. The directory should be set to 755 for tftp clients to be able to read from or write to files in the directory.

# ls -ld /tftpboot
drwxr-xr-x 2 root root 4096 Dec 24 14:15 /tftpboot

You next need to turn on the tftp service with the chkconfig command.

# chkconfig tftp on

You can verify that the service is available with chkconfig --list tftp.

# chkconfig --list tftp
tftp            on

TFTP uses the User Datagram Protocol and listens for data on port 69, so you can also use netstat -a | grep tftp to check on whether the system is listening for data on port 69. You should see something like the following if it is listening:

udp        0      0 *:tftp                      *:*

If you have firewall software running on the TFTP server, you will also need to allow connectivity to UDP port 69 through the firewall. You can do this on a CentOS system through the GUI by taking the following steps:

  1. Click on System.
  2. Click on Administration.
  3. Select Security Level and Firewall
  4. Under Firewall Options, select other ports.
  5. Click on the Add button.
  6. Put 69 in the port field and select udp for the protocol.
  7. Click on OK.
  8. Click on OK again.
  9. When prompted to override any existing firewall configuration, click on Yes.

To be able to write to a file on the tftp server, e.g. a file named firewall-log.txt in the /tftpboot directory, you need to first create the file with the touch command and then set the permissions on the file so it is "world" writable.

# touch /tftpboot/firewall-log.txt
# chmod 666 /tftpboot/firewall-log.txt

Once you have the TFTP server configured, you can then transfer files from the tftp client to the server.


  1. TFTP Server
    Date: January 8, 2007
  2. Configuring a TFTP Server
    Date: June 5, 2003

[/network/tftp] permanent link

Mon, Dec 15, 2008 9:00 pm

LED Holiday Lighting

I've heard that LEDs are more efficient for holiday lighting, but they cost more than traditional lights. Are they worth it?

Yes. Light-emitting diodes (LEDs) are small light sources illuminated by the movement of electrons through a semiconductor material - and they are worth the extra money.

According to ENERGY STAR®, LEDs are very energy efficient when producing individual colors, such as those used in many holiday lights. LEDs use up to 90 percent less energy than incandescent bulbs to produce the same amount of light.

The amount of electricity consumed by just one 7-watt incandescent bulb could power 140 LEDs - enough to light two 24-foot strings of lights.

Still not convinced? ENERGY STAR qualified LEDs are worth the extra money because they:

Learn more about LEDs by visiting


Lines - Delmarva.Com
December 2008

[/info/home/lighting] permanent link

Tue, Dec 09, 2008 9:48 pm

Transferring FTP Voyager Settings Between Systems

FTP Voyager, from Rhino Software, Inc. stores profile settings for a user in C:\Documents and Settings\username\Application Data\\FTP Voyager\FTPVoyager.ftp, where username is the userid for the relevant user. Note: this is true for version of FTP Voyager, but may not be true for all versions. Note, also, that you won't see the .ftp file extension if the system is configured to hide extensions for known file types.

So, if you need to reinstall FTP Voyager on another system, but wish to retain a user's individual FTP Voyager configuration information, such as personal FTP sites, which would appear under the FTP Voyager FTP Site Profile Manager, and scheduled file transfers, you should transfer this file from the old system to the new system and place the file in the corresponding directory on the new system.

[/network/ftp] permanent link

Mon, Dec 08, 2008 7:36 pm

Saving a Word Document as a Filtered Web Page

When saving a Word document, at least in Word 2003, you have the option of saving as "Web Page" or "Web Page, Filtered". You should get a smaller file if you use the filtered web page option. E.g., for one particular Word document, I found the size was half as much when I used the filtered option versus the unfiltered option, i.e. 26 KB for the filtered file versus 54 KB for the unfiltered version.

If you select "Web Page, Filtered" for the output file format, Word doesn't include tags that only have meaning to itself. Those tags might be useful if you are reopening the file to be edited again with Word, but don't need to be there for people viewing the document in their web browser or if it is to be edited later with an HTML editor. E.g., for one document the following code was in the head section of the HTML file in the unfiltered version, but not the filtered version.

<!--[if gte mso 9]><xml>
  <o:Author>Gail V. Williams</o:Author>
  <o:LastAuthor>John Smith</o:LastAuthor>
</xml><!--[if gte mso 9]><xml>

When you save a document as a filtered webpage, you will get a warning such as "Saving Test.doc in this format (Web Page, Filtered) will remove Office-specific tags. Some Office features may not be available when you reopen this page. Do you want to save the document in this format?". If you retain the original Word document in .doc format as well as the new filtered HTML version of the file, you can always re-edit the original copy, if you have any concerns about needing to retain the Microsoft Word specific information.


  1. About using filtered HTML
    Microsoft Office Online
  2. Reduce Web page size by filtering HTML
    Microsoft Office Online

[/os/windows/office/word] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo