本文介绍了将perl脚本转换为c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我不会将此脚本转换为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 filesub get_alert_ip{open (ALERT, "alert.ids") or die "Cannot open or read alert file";while (<alert>){next if (/^\s*$/); #skip blank linesnext if (/^#/); # skip comment linesif (/\.*\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 alertfile! \n";}$alertip;}##########Compares the new IP address to the IP address I have alreadycapturedsub compare_ip{my ($compareip) = @_;open (COMPARE, "attackers.old") or die "Cannot read the ignore file,$!\n";while (<compare>) {chop;next if (/^\s*$/); #skip blank linesnext if (/^#/); # skip comment linesif (/(.*)/){}}$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 linesnext if (/^#/); # skip comment linesif (/\.*\s(\d+\.\d+\.\d+\.\d+)\.*/) #Grab the IP Address{ alertip =alertip= 1; 打印警报IP地址1;print "Alert IP address is 这篇关于将perl脚本转换为c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-22 12:40