Avatar of 3XLcom
3XLcom
 asked on

perl to cisco send command

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.
PerlLinuxPHP

Avatar of undefined
Last Comment
3XLcom

8/22/2022 - Mon
Ray Paseur

What is the question?  Please clarify -- are you writing this in Perl or PHP?
3XLcom

ASKER
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#
arnold

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.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
3XLcom

ASKER
but i need ssh
arnold

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.
ASKER CERTIFIED SOLUTION
FishMonger

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
3XLcom

ASKER
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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.