perl to cisco send command

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

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

Open in new window

login as: root
root@ password:
force.salay.com.tr#configure terminal
force.salay.com.tr(conf)#ip route xx.xx.xx.xx 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.
Question by:3XLcom
LVL 111

Expert Comment

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

Author Comment

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#
LVL 81

Expert Comment

ID: 39734001
Pearl has a module you can use to interact with cisco

Includes an example.
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.


Author Comment

ID: 39734004
but i need ssh
LVL 81

Expert Comment

ID: 39734012
There is an ssh perl module as well.

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

Accepted Solution

FishMonger earned 2000 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.

Author Closing Comment

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

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

627 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