Chinaunix首页 | 论坛 | 博客
  • 博客访问: 398450
  • 博文数量: 57
  • 博客积分: 193
  • 博客等级: 入伍新兵
  • 技术积分: 1192
  • 用 户 组: 普通用户
  • 注册时间: 2012-12-13 14:37
个人简介

当以艺术眼光看程序,寻找程序后面的原理,做到化而不忘

文章分类

全部博文(57)

文章存档

2017年(5)

2015年(7)

2014年(27)

2013年(18)

我的朋友

分类: Windows平台

2013-05-16 18:49:17

#!/usr/bin/perl
use strict;
my $FILEHANDLE;
open($FILEHANDLE,"a.dll");
binmode($FILEHANDLE);#编码转换,然后就可以当成字符串来读了,
my @array=<$FILEHANDLE>;#转化成数组,比如4550就战胜两个字节,45一个字节,50一个字节
my $FirstLine=$array[0];#这里有个问题:二进制下如何区分行呢?
if($FirstLine=~m/MZ?/)
{
    print "Valid DlL file\n";
}
else
{
    print "Invalid DLL File\n";
    exit(1);
}

print "***************************************************\n";
my $AllInfo = join("",@array);
my $Another=$AllInfo;
$Another=~m/[A-Za-z\s]/g;
print $Another,"\n";
print "***************************************************\n";
$Another=~s/\W[\s{2,}]//g;
print $Another,"\n";

print "***************************************************\n";
#查找导出函数,导出函数前面肯定有相应的DLL的名字
if($AllInfo=~m/(sMILEDownload.dll.[A-Za-z\W]*\W\W)/ig) 
{
    my $tmp = $1;
    print $1,"\n";
    print "***************************************************\n";
    $tmp=~s/\W{2,}/ /g; #连续进行两次正则表达式操作,也就是将正则表达式分开来
    $tmp=~s/\W{1}/,/g;  #这样在实现上更加简单
    print $tmp,"\n";
    print "***************************************************\n";
    print "Find the Dll Name\n";
}

阅读(2834) | 评论(0) | 转发(0) |
0

上一篇:WinDbg命令

下一篇:VC笔记

给主人留下些什么吧!~~