Solved

perl to cisco send command

Posted on 2013-12-21
7
361 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
7 Comments
 
LVL 108

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 77

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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now