标题:判断是否是 pe 文件
只看楼主
zhu224039
Rank: 8Rank: 8
等 级:贵宾
威 望:17
帖 子:862
专家分:792
注 册:2012-7-29
结帖率:59.52%
 问题点数:0 回复次数:0 
判断是否是 pe 文件
#!/usr/bin/perl
#$filename='D:\cs\counter-strike\hl.exe'  ;
print "please insert a file name,and i will tell you it is a pe file?\n",":";
chomp ($filename=<STDIN>);
open CDFD , '<' ,$filename or die $!;
read CDFD,$dir,400;
$mzdos=substr $dir,0,2;
if($mzdos ge 'MZ')
{
  #print $dir,"\n";
  $elname=substr $dir,60,4;
  $elname=unpack "l",$elname;
  #print $elname,"\n";
  $peHEAD=substr $dir,$elname-1,4;
  if($peHEAD ge "PE"){
      print "this is a pe file\n";
  }
  else{
       print "NO";
       exit 0;
  }

}
else{
     print "NO";
     exit 1;
}
搜索更多相关主题的帖子: file insert please 
2014-07-13 08:31



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-433978-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011429 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved