将perl脚本转换为c#

编程入门 行业动态 更新时间:2024-10-27 21:11:16
本文介绍了将perl脚本转换为c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我不会将此脚本转换为c#,任何专业编码人员都可以帮助我! #从警报文件中获取攻击者的IP地址 sub get_alert_ip { 打开(ALERT,alert.ids)或死于无法打开或读取警报文件; while(< alert>) { next if(/ ^ \s * $ /); #skip空行 next if(/ ^#/); #skip评论专栏 if(/\.*\s(\\+\.\d+\\\+ \\\++)\。* / )#抓住IP地址 { $ alertip = $ 1; 打印警报IP地址是$ alertip \ n; } } 关闭(ALERT); #检查你是否得到它! if($ ip eq){print无法从警报中获取IP地址 fi le!\ n;}} $ alertip; } ######### #将新IP地址与我已经拥有的IP地址进行比较 抓取 sub compare_ip { my($ compareip)= @_; open(COMPARE, attackers.old)或死无法读取忽略文件, $!\ n; while(< compare>){ chop; next if(/ ^ \s * $ /); #skip空行 next if(/ ^#/); #skip评论专栏 if(/(.*)/) { } } $ alertip = $ 1; if($ alertipeq$ compareip) { print有人老还在攻击\ n; } 其他 {#向IPSEC滤波器子功能发送新IP地址 & ip fi lter($ compareip); $ tag = 1; } next; 关闭(比较); if($ tag eq 1) { system(echo $ compareip>> ; attackers.old); } }

i wont to convert this script to c# ,any Professional coder can help me ! #Grab the attacker's IP address from the alert file sub get_alert_ip{ open (ALERT, "alert.ids") or die "Cannot open or read alert file"; while (<alert>) { next if (/^\s*$/); #skip blank lines next if (/^#/); # skip comment lines if (/\.*\s(\d+\.\d+\.\d+\.\d+)\.*/) #Grab the IP Address { $alertip=$1; print "Alert IP address is $alertip \n"; } } close (ALERT); #Check to see if you got it! if ($ip eq ""){ print "Could not get the IP address out of the alert file! \n";} $alertip; } ######### #Compares the new IP address to the IP address I have already captured sub compare_ip{ my ($compareip) = @_; open (COMPARE, "attackers.old") or die "Cannot read the ignore file, $!\n"; while (<compare>) { chop; next if (/^\s*$/); #skip blank lines next if (/^#/); # skip comment lines if (/(.*)/) { } } $alertip=$1; if ("$alertip" eq "$compareip") { print "Somebody old is still attacking \n"; } else { #Send the new IP address to the IPSEC filter subfunction &ipfilter($compareip); $tag=1; } next; close (COMPARE); if ($tag eq 1) { system ("echo $compareip >> attackers.old"); } }

推荐答案

/ ); #skip空行 next if(/ ^#/); #skip评论专栏 if(/\.*\s(\\+\.\d+\\\+ \\\++)\。* / )#Grab the IP Address { /); #skip blank lines next if (/^#/); # skip comment lines if (/\.*\s(\d+\.\d+\.\d+\.\d+)\.*/) #Grab the IP Address {

alertip = alertip=

1; 打印警报IP地址 1; print "Alert IP address is

更多推荐

将perl脚本转换为c#

本文发布于:2023-10-07 15:51:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1469822.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   脚本   perl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!