Solved

perl to cisco send command

Posted on 2013-12-21
7
383 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
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Fine Tune your automatic Updates for Ubuntu / Debian
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to moveā€¦
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

726 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