Solved

perl to cisco send command

Posted on 2013-12-21
7
379 Views
Last Modified: 2013-12-26
This output is given from : sflowtool -4 -p 3601  | /scripts/DoSTargets



1387652837 178.20.228.47 15 mbps
1387652837 178.20.228.47 1792 pps
1387652837 185.9.156.35 11 mbps
1387652837 185.9.159.233 1536 pps
1387652838 185.9.156.35 11 mbps
1387652839 178.20.228.47 26 mbps
1387652839 178.20.228.47 2560 pps
1387652839 85.100.207.114 8 mbps
1387652840 178.20.228.47 27 mbps
1387652840 178.20.228.47 3072 pps
1387652840 185.9.159.233 12 mbps
1387652840 185.9.159.233 2304 pps
1387652841 178.20.228.47 20 mbps
1387652841 178.20.228.47 2048 pps
1387652841 89.253.155.97 8 mbps
1387652842 178.20.228.47 20 mbps
1387652842 178.20.228.47 1792 pps
1387652843 178.20.228.47 15 mbps
1387652843 178.20.228.47 1792 pps

Open in new window



login as: root
root@ password:
force.salay.com.tr>enable
Password:
force.salay.com.tr#configure terminal
force.salay.com.tr(conf)#ip route xx.xx.xx.xx 255.255.255.255 null 0

Open in new window



we want 3 things to do :

1. we want that perl script which will read this and will go and disable from the router the ip address as given below

sflowtool -4 -p 3601 -l | grep xx.xx.xx.xx  >  /logs/ban/xx.xx.xx.xx-dd-mm-hh-ss.log  

Open in new window


2. and also will record into mysql blocked table which has 3 columns

1. blocked ip
2. block time
3. traffic size

3. finally it will attach the log and will send email about it completed the process of blocking.
0
Comment
Question by:3XLcom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39733857
What is the question?  Please clarify -- are you writing this in Perl or PHP?
0
 

Author Comment

by:3XLcom
ID: 39733863
we need to write this on perl but we do not know so much about perl :)
actually trying to lern while developing if somebody give us part by part this software we will be able to learn and let it work because our main aim is on asp.net and c# perl is ver far from us and sflow and other things are not able to easily let them work with c#
0
 
LVL 78

Expert Comment

by:arnold
ID: 39734001
Pearl has a module you can use to interact with cisco
Telnet::Cisco
http://search.cpan.org/~joshua/Net-Telnet-Cisco-1.10/Cisco.pm

Includes an example.
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 

Author Comment

by:3XLcom
ID: 39734004
but i need ssh
0
 
LVL 78

Expert Comment

by:arnold
ID: 39734012
There is an ssh perl module as well.
http://search.cpan.org/~schwigon/Net-SSH-Perl-1.36/lib/Net/SSH/Perl.pm

There are ways to establish an SSL tunnel and then interact.
0
 
LVL 28

Accepted Solution

by:
FishMonger earned 500 total points
ID: 39735241
Net::SSH::Perl can be difficult to install due to its large number of dependencies.

Another option would be Net::SSH2.
0
 

Author Closing Comment

by:3XLcom
ID: 39740620
ssh connections can not keep alive the connection so it works for only one command for example when we send enable process is ending

ssh2 is the correct solution we have resolved thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question