热门关键字:  ubuntu  分区  函数  Fedora  linux系统进程

当前位置 :| 主页>Linux教程>编程开发>Perl>

Debian 下防止arp病毒的perl脚本

来源: 作者: 时间:2008-08-04 Tag: 点击:
#!/usr/bin/perl
use strict;
my $LocalIp="192.168.1.79";
my $file="/tmp/mac.txt";
system("sudo nmap -sP 192.168.1.0/24 > $file");
open(OLD,$file); my @content=<OLD>;close OLD;
open(NEW,">$file");
foreach my $con (@content)
{
if( $con =~ /Nmap/ig){$con="";}
if( $con =~ /$LocalIp/ig){$con="";}
if($con =~ /(\d+)\.(\d+)\.(\d+)\.(\d+)/)
{
print "$1\.$2\.$3\.$4\t";
print NEW "$1\.$2\.$3\.$4\t";
}
if($con =~ /(\w+)\:(\w+)\:(\w+)\:(\w+):(\w+):(\w+)/)
{
print "$1\:$2\:$3\:$4\:$5:$6\n";
print NEW "$1\:$2\:$3\:$4\:$5:$6\n";
}
}
close NEW;
system("sudo arp -f $file");
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名?
注册
栏目列表