<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>2NMS.com</title>
	<link>http://www.2nms.com/blog</link>
	<description>Automating IT !</description>
	<pubDate>Thu, 09 Sep 2010 20:35:51 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Telnet to cisco router via SSH &#8216;hop&#8217; server</title>
		<link>http://www.2nms.com/blog/?p=36</link>
		<comments>http://www.2nms.com/blog/?p=36#comments</comments>
		<pubDate>Thu, 09 Sep 2010 20:32:41 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=36</guid>
		<description><![CDATA[Here&#8217;s a very short example how to telnet to a Cisco router using Net::Telnet by first hopping to a SSH server using Net::OpenSSH. 
This example opens an SSH session to a linux server, the server opens a telnet session inside the SSH tunnel and returns the PTY handle which can be used in Net::Telnet.

use strict;
use [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a very short example how to telnet to a Cisco router using Net::Telnet by first hopping to a SSH server using Net::OpenSSH. </p>
<p>This example opens an SSH session to a linux server, the server opens a telnet session inside the SSH tunnel and returns the PTY handle which can be used in Net::Telnet.</p>
<p><code><br />
use strict;<br />
use Net::OpenSSH;<br />
use Net::Telnet;</p>
<p>my $lhost = "debian";<br />
my $luser = "mwallraf";<br />
my $lpass = "";</p>
<p>my $chost = "cisco";<br />
my $cuser = "cisco";<br />
my $cpass = "cisco";</p>
<p>my $prompt = '/(?:Username: |Password: |[>#])/m';<br />
my @commands = ("term len 0", "show clock\r", "show version\r", "show users\r");</p>
<p>my $ssh = Net::OpenSSH->new($lhost,<br />
		'user' => $luser,<br />
		#'password' => $lpass,<br />
		'master_opts' => [ '-t' ],<br />
		#'async' => 1  # if enabled then password cannot be set here<br />
		);<br />
my ($pty, $err, $pid) = $ssh->open2pty("telnet cisco");</p>
<p>my $t = new Net::Telnet(<br />
		-telnetmode => 0,<br />
		-fhopen => $pty,<br />
		-prompt => $prompt,<br />
		-cmd_remove_mode => 1,<br />
		-output_record_separator => "\r",<br />
#		-dump_log => "debug.log",<br />
					);</p>
<p>my $end = 0;</p>
<p>while (!$end)  {<br />
	my ($pre, $post) = $t->waitfor($prompt);<br />
	print "pre = $pre, post = $post\n";</p>
<p>	if ($post =~ /Username/m)  {<br />
		# send username<br />
		$t->print("$cuser");<br />
	}<br />
	elsif ($post =~ /Password: /m)  {<br />
		# send password<br />
		$t->print("$cpass");<br />
	}<br />
	elsif ($post  =~ /[>#]/ &#038;&#038; @commands)  {<br />
		# send commands<br />
		my $cmd = shift(@commands);</p>
<p>                # commands without output do not contain break<br />
		if ($cmd !~ /[\r\n]/)  {<br />
			$t->print($cmd);<br />
		}<br />
		else {<br />
			print $t->cmd($cmd);<br />
		}<br />
	}<br />
	else {<br />
		# finish it<br />
		$end = 1;<br />
		$t->print("exit");<br />
	}<br />
}</p>
<p>$t->close();<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=36</wfw:commentRss>
		</item>
		<item>
		<title>Useful OneLiners</title>
		<link>http://www.2nms.com/blog/?p=35</link>
		<comments>http://www.2nms.com/blog/?p=35#comments</comments>
		<pubDate>Fri, 21 Mar 2008 21:45:10 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Perl One-Liners]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=35</guid>
		<description><![CDATA[  # add first and penultimate columns
   perl -lane 'print $F[0] + $F[-2]'
   # just lines 15 to 17
   perl -ne 'print if 15 .. 17' *.pod
   # in-place edit of *.c files changing all foo to bar
   perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c
 [...]]]></description>
			<content:encoded><![CDATA[<p>  # add first and penultimate columns<br />
   <code>perl -lane 'print $F[0] + $F[-2]'</code></p>
<p>   # just lines 15 to 17<br />
   <code>perl -ne 'print if 15 .. 17' *.pod</code></p>
<p>   # in-place edit of *.c files changing all foo to bar<br />
   <code>perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c</code></p>
<p>   # command-line that prints the first 50 lines (cheaply)<br />
   <code>perl -pe 'exit if $. > 50' f1 f2 f3 ...</code></p>
<p> <a href="http://www.2nms.com/blog/?p=35#more-35" class="more-link">(more&#8230;)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=35</wfw:commentRss>
		</item>
		<item>
		<title>Perl &#8220;One-Liners&#8221;</title>
		<link>http://www.2nms.com/blog/?p=34</link>
		<comments>http://www.2nms.com/blog/?p=34#comments</comments>
		<pubDate>Fri, 21 Mar 2008 21:40:03 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Perl One-Liners]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=34</guid>
		<description><![CDATA[Perl &#8220;One Liners&#8221; are -surprise surprise- little perl programs written on one line. 
Here are a few simple examples :
Guess what this one does  
$ perl -e 'print "Hello";' -e 'print " World\n"'
DOS to Unix text convert
$ perl -i -pe 's/\r//g' file
Unix to DOS text convert
$ perl -i -pe 's/\n/\r\n/' file
&#8216;Fun&#8217; with columns:
$ echo [...]]]></description>
			<content:encoded><![CDATA[<p>Perl &#8220;One Liners&#8221; are -surprise surprise- little perl programs written on one line. </p>
<p>Here are a few simple examples :</p>
<p><strong>Guess what this one does <img src='http://www.2nms.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </strong></p>
<p><code>$ perl -e 'print "Hello";' -e 'print " World\n"'</code></p>
<p><strong>DOS to Unix text convert</strong></p>
<p><code>$ perl -i -pe 's/\r//g' file</code></p>
<p><strong>Unix to DOS text convert</strong></p>
<p><code>$ perl -i -pe 's/\n/\r\n/' file</code></p>
<p><strong>&#8216;Fun&#8217; with columns:</strong></p>
<p><code>$ echo a b c | perl -lane 'print $F[1]'<br />
b<br />
$ echo a b c | perl -lane 'print "@F[0..1]"'<br />
a b<br />
$ echo a b c | perl -lane 'print "@F[-2,-1]"'<br />
b c</code></p>
<p>More one-liners will follow&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=34</wfw:commentRss>
		</item>
		<item>
		<title>Managing IP networks for free</title>
		<link>http://www.2nms.com/blog/?p=32</link>
		<comments>http://www.2nms.com/blog/?p=32#comments</comments>
		<pubDate>Fri, 04 Jan 2008 21:27:47 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[OpenSource]]></category>

		<category><![CDATA[Network Monitoring]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=32</guid>
		<description><![CDATA[Here&#8217;s a great tutorial on how you could manage your ip network for free!   All you need is a Linux box (surprise surprise) and of course an ip network.
The tutorial discusses some popular tools and scripts to perform these tasks :

Configuration change measurement: storing the configuration history of your network in a useful [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a great tutorial on how you could manage your ip network for free!   All you need is a Linux box (surprise surprise) and of course an ip network.<br />
The tutorial discusses some popular tools and scripts to perform these tasks :</p>
<ul>
<li>Configuration change measurement: storing the configuration history of your network in a useful way;
</li>
<li>Automatic network configuration audits: self-consistency checks wired to loud alarm bells;
</li>
<li>Automatic generation of DNS records for router interfaces, in the interests of traceroute beautification;
</li>
<li>Automatic generation of graphical maps to help operators visualise live topologies as their networks evolve;
</li>
<li>Gathering data from BGP peers to help in choosing &#8220;maximum-prefix&#8221; session limits.
</li>
</ul>
<p>Here&#8217;s the link : <a href="http://www.nanog.org/mtg-0210/abley.html" target="_blank">tutorial</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=32</wfw:commentRss>
		</item>
		<item>
		<title>Cisco::Accounting 1.01 on CPAN</title>
		<link>http://www.2nms.com/blog/?p=31</link>
		<comments>http://www.2nms.com/blog/?p=31#comments</comments>
		<pubDate>Mon, 20 Aug 2007 18:54:04 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Cisco-Accounting]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=31</guid>
		<description><![CDATA[Also our perl module Cisco::Accounting is now available on CPAN.
This module parses and aggregates IP Accounting information from remote Cisco devices or from remote hosts running the IPCAD daemon.
Several other actions are possible like checking and changing the accounting setting on interfaces, clear ip accounting, etc.
The module summarizes all data that it has parsed and [...]]]></description>
			<content:encoded><![CDATA[<p>Also our perl module <a href="http://www.2nms.com/blog/?page_id=29">Cisco::Accounting</a> is now available on <a href="http://search.cpan.org/~mwallraf/Cisco-Accounting-1.01/lib/Cisco/Accounting.pm">CPAN</a>.</p>
<p>This module parses and aggregates IP Accounting information from remote Cisco devices or from remote hosts running the IPCAD daemon.<br />
Several other actions are possible like checking and changing the accounting setting on interfaces, clear ip accounting, etc.</p>
<p>The module summarizes all data that it has parsed and also keeps a history.</p>
<p>A front-end to this module is our <a href="http://www.2nms.com/blog/?page_id=19">CIPAT</a> - Cisco IP Accounting Tool.</p>
<p>More information at our products page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=31</wfw:commentRss>
		</item>
		<item>
		<title>CIPAT 2.00 is now available</title>
		<link>http://www.2nms.com/blog/?p=30</link>
		<comments>http://www.2nms.com/blog/?p=30#comments</comments>
		<pubDate>Sun, 19 Aug 2007 19:09:03 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[CIPAT]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=30</guid>
		<description><![CDATA[A new version of CIPAT is available for download. CIPAT is Cisco IP Accounting Tool which is a front-end for the Cisco::Accounting perl module.
CIPAT is still a platform independent perl based tool but it has many new features like support for Cisco devices as well as hosts which are running the IPCAD daemon. 
Multiple output [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of <a href="http://www.2nms.com/blog/?page_id=19">CIPAT</a> is available for download. CIPAT is Cisco IP Accounting Tool which is a front-end for the <a href="http://www.2nms.com/blog/?page_id=29">Cisco::Accounting</a> perl module.</p>
<p>CIPAT is still a platform independent perl based tool but it has many new features like support for Cisco devices as well as hosts which are running the IPCAD daemon. </p>
<p>Multiple output formats are now supported : HTML, CSV and XML. </p>
<p>A limitation on number of polls or time limit can be set to automatically stop CIPAT and generate reports. </p>
<p>Check out the product page to find out more about the new CIPAT and to see some <a href="http://www.2nms.com/blog/?page_id=19">screenshots</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=30</wfw:commentRss>
		</item>
		<item>
		<title>Cisco::Version 0.02 available on CPAN</title>
		<link>http://www.2nms.com/blog/?p=28</link>
		<comments>http://www.2nms.com/blog/?p=28#comments</comments>
		<pubDate>Wed, 15 Aug 2007 15:22:10 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Cisco-Version]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=28</guid>
		<description><![CDATA[Our new Perl module Cisco::Version is also available on CPAN.  
This module extracts as much data as possible from Cisco&#8217;s &#8217;show version&#8217; command. Many chassis types are support.
The following details can be extracted :

software version information
bootstrap information
bootloader information
uptime
reload reason
reload time
software image file
DRAM memory information
flash information
configuration registry
password recovery mechanism

Read more &#8230;
]]></description>
			<content:encoded><![CDATA[<p>Our new Perl module <a href="http://search.cpan.org/~mwallraf/Cisco-Version-0.02/lib/Cisco/Version.pm">Cisco::Version</a> is also available on <a href="http://www.cpan.org">CPAN</a>.  </p>
<p>This module extracts as much data as possible from Cisco&#8217;s &#8217;show version&#8217; command. Many chassis types are support.</p>
<p>The following details can be extracted :</p>
<ul>
<li>software version information</li>
<li>bootstrap information</li>
<li>bootloader information</li>
<li>uptime</li>
<li>reload reason</li>
<li>reload time</li>
<li>software image file</li>
<li>DRAM memory information</li>
<li>flash information</li>
<li>configuration registry</li>
<li>password recovery mechanism</li>
</ul>
<p><a href="http://www.2nms.com/blog/?page_id=23">Read more &#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=28</wfw:commentRss>
		</item>
		<item>
		<title>Net::Telnet::Wrapper 0.1 on CPAN</title>
		<link>http://www.2nms.com/blog/?p=27</link>
		<comments>http://www.2nms.com/blog/?p=27#comments</comments>
		<pubDate>Tue, 14 Aug 2007 18:39:14 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Net-Telnet-Wrapper]]></category>

		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=27</guid>
		<description><![CDATA[Our first &#8216;official&#8217; Perl module has been published on CPAN : Net::Telnet::Wrapper.
This module is a wrapper around the existing modules Net::Telnet and Net::Telnet::Cisco, also available on CPAN, and it will help you to automate all your jobs that involve connecting to TCP ports (telnet, POP, HTTP, etc). There&#8217;s built-in support for many vendors like Cisco, [...]]]></description>
			<content:encoded><![CDATA[<p>Our first &#8216;official&#8217; Perl module has been published on <a href="http://www.cpan.org">CPAN</a> : <a href="http://search.cpan.org/~mwallraf/Net-Telnet-Wrapper-0.1/lib/Net/Telnet/Wrapper.pm">Net::Telnet::Wrapper</a>.</p>
<p>This module is a wrapper around the existing modules <a href="http://search.cpan.org/~jrogers/Net-Telnet-3.03/lib/Net/Telnet.pm">Net::Telnet</a> and <a href="http://search.cpan.org/~joshua/Net-Telnet-Cisco-1.10/Cisco.pm">Net::Telnet::Cisco</a>, also available on CPAN, and it will help you to automate all your jobs that involve connecting to TCP ports (telnet, POP, HTTP, etc). There&#8217;s built-in support for many vendors like Cisco, Nortel, Packeteer but also for automating tasks like verifying POP or SMTP availability, HTTP sites, etc.</p>
<p>Net::Telnet::Wrapper is not a replacement for Net::Telnet but really an extension and it has some add-ons that helps you to do more with less code : automatic logon retries, different connection modes (login, enable, config), easy output handling, better error checking and much more.</p>
<p>Find out more <a href="http://www.2nms.com/blog/?page_id=22">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=27</wfw:commentRss>
		</item>
		<item>
		<title>NetProvisioning 2.00 released</title>
		<link>http://www.2nms.com/blog/?p=26</link>
		<comments>http://www.2nms.com/blog/?p=26#comments</comments>
		<pubDate>Thu, 02 Aug 2007 21:04:06 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[Perl]]></category>

		<category><![CDATA[NetProvisioning]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=26</guid>
		<description><![CDATA[A new version of NetProvsioning has been released.  A separate project has been created on SourceForge where you can find the downloads and more documentation.
What has changed :

code has been optimized and separated into modules
multithreading code is more stable
device support is now handled by Net::Telnet::Wrapper which handles many device types and even support for [...]]]></description>
			<content:encoded><![CDATA[<p>A new version of <strong>NetProvsioning</strong> has been released.  A separate project has been created on <a href="http://www.sourceforge.net/projects/netprovisioning" title="SourceForge" target="_blank">SourceForge</a> where you can find the downloads and more documentation.</p>
<p>What has changed :</p>
<ul>
<li>code has been optimized and separated into modules</li>
<li>multithreading code is more stable</li>
<li>device support is now handled by <a href="http://search.cpan.org/~mwallraf/Net-Telnet-Wrapper-0.1/lib/Net/Telnet/Wrapper.pm" title="Net::Telnet::Wrapper" target="_blank">Net::Telnet::Wrapper</a> which handles many device types and even support for any TCP port like HTTP, POP3, SMTP etc.</li>
<li>better error handling</li>
<li>better &#8216;match&#8217; and &#8216;no-match&#8217; action support</li>
<li>documentation has been updated</li>
<li>the XML profiles have been optimized</li>
<li>support for usage of variables in profiles (ex. [enter], [date])</li>
<li>new wizard to generate profiles from scratch</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=26</wfw:commentRss>
		</item>
		<item>
		<title>New website</title>
		<link>http://www.2nms.com/blog/?p=25</link>
		<comments>http://www.2nms.com/blog/?p=25#comments</comments>
		<pubDate>Wed, 01 Aug 2007 20:47:01 +0000</pubDate>
		<dc:creator>Maarten</dc:creator>
		
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.2nms.com/blog/?p=25</guid>
		<description><![CDATA[As of today our new website is live!    Yes, there is still some work to do :  the products page has to be completed, screenshots added, template customized,  but hey .. it&#8217;s a start.
With this new blog-style website we hope that we can frequently post new articles and code examples.
Feel [...]]]></description>
			<content:encoded><![CDATA[<p><strong>As of today our new website is live!</strong>    Yes, there is still some work to do :  the products page has to be completed, screenshots added, template customized,  but hey .. it&#8217;s a start.</p>
<p>With this new blog-style website we hope that we can frequently post new articles and code examples.</p>
<p>Feel free to post any comments to the blog entries.</p>
<p>Maarten</p>
]]></content:encoded>
			<wfw:commentRss>http://www.2nms.com/blog/?feed=rss2&amp;p=25</wfw:commentRss>
		</item>
	</channel>
</rss>

