Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java Security  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 我常用反编译java的小工具
lxia

   Noodle



发贴: 14
积分: 40
于 2003-03-02 13:11 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
破解jar文件时,手工的一级一级进入目录调用jad -s java *.class很是麻烦,我用vbscript写了一个小程序,可以从当前目录递归进入子目录调用jad反编译,非常方便。(注: windows 98的vb script engine 版本比较低,可能会不灵光,我是在win2000和xp下用的)
用法:将JAD.exe放到windows/system32目录下,然后将附件展开的两个文件也放到windows/system32目录下。

将要破解jar文件展开到自己的工作目录下,然后在命令行键入 dejava , 就可以一把反编译所有的class文件了。

dejava.rar (0.8k)



作者 Re:我常用反编译java的小工具 [Re:lxia]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-03-02 13:41 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list

use strict;
use IO::Dir;
use Data::Dumper;

decompile(".");

sub decompile() {
  my ($base) = @_;  
  my $dir;
  tie %$dir, "IO::Dir", $base;
  foreach (keys %$dir) {
    my $f = $base."\\".$_;    
    if(-d $f) { #是目录
      if ( ($_ ne '.') && ($_ ne '..') ) {        
        #print "$f\n";
        decompile($f);
      }
    }  
    else {
      my $pos = rindex($_ ,'.');
      my $filename = substr($_,0,$pos);
      my $ext = substr($_,$pos+1);      
      if( $ext eq 'class' ) { #是类文件
         print $f,"\n";
         #print $base."\\$filename.java\n";
         `e:\\tools\\jad\\jad -noctor -space -t -i -radix10 -lradix10 -d $base $f`;        
      }
    }  
  }  
}





作者 Re:我常用反编译java的小工具 [Re:lxia]
luoq_dl

Love



发贴: 162
积分: 41
于 2003-03-04 09:29 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
[Hidden Post:10]

[您无权限看这个帖子,您的积分需要大于 10]


作者 Re:我常用反编译java的小工具 [Re:lxia]
glistar



CJSDN高级会员


发贴: 248
积分: 81
于 2003-03-04 13:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这样使用 JAD 就可以了:

jad -o -r -ff -sjava -d%1 %2/**/*.class

%1 代表目的路径
%2 代表class存放的路径



作者 Re:我常用反编译java的小工具 [Re:luoq_dl]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-03-04 13:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
呵呵,不知道啊。



作者 Re:我常用反编译java的小工具 [Re:rainman]
snowbug



CJSDN高级会员


发贴: 418
积分: 130
于 2003-03-05 07:10 user profilesend a private message to usersend email to snowbugsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
rainman wrote:
呵呵,不知道啊。


Ha, apparently rainman didn't read the "readme" file Smile



作者 Re:我常用反编译java的小工具 [Re:snowbug]
rainman

阿熊

元老


发贴: 5644
积分: 454
于 2003-03-05 08:38 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Embaressed yes, i didn't



作者 Re:我常用反编译java的小工具 [Re:rainman]
fsword



发贴: 0
积分: 0
于 2003-03-05 20:56 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这个不能操作jar包,我以前写了一个java类来做这事,后来觉得应该用脚本,就没有继续更新,贴出来,不知能否博大家一笑。


package org.fsword.util;

import java.util.*;
import java.util.zip.*;
import java.util.jar.*;
import java.io.*;

public class JarTool{

String targetStr = "";

private void execute(){
String jarFileStr = "C:\\javasoft\\jdk1.3.1\\lib\\dt.jar";
execute(jarFileStr);
}

private void execute(String jarFileStr){
String classFileOutDirStr = "C:\\temp";
execute(jarFileStr,classFileOutDirStr);
}

private void execute(String jarFileStr,String classFileOutDirStr){
String jadFileStr = "C:\\javasoft\\jad\\jad.exe";
execute(jarFileStr,classFileOutDirStr,jadFileStr);
}

JarTool(){
execute();
}

JarTool(String jarFileStr){
execute(jarFileStr);
}

JarTool(String jarFileStr,String classFileOutDirStr){
execute(jarFileStr,classFileOutDirStr);
}

JarTool(String jarFileStr,String classFileOutDirStr,String jadFileStr){
execute(jarFileStr,classFileOutDirStr,jadFileStr);
}

private void execute(String jarFileStr,String classFileOutDirStr,String jadFileStr){
try{
Vector vts = new Vector();
JarFile jarFile = new JarFile(jarFileStr);
Enumeration enu;
ZipEntry entryTemp;
BufferedInputStream in;
FileOutputStream fo;
int i=0;
enu = jarFile.entries();
while(enu.hasMoreElements()){
String entryName = enu.nextElement().toString();
if(entryName.endsWith(".class")){
in= new BufferedInputStream(jarFile.getInputStream(jarFile.getEntry(entryName)));
String foName = classFileOutDirStr + "\\" + entryName.replace('/','\\');
File nDir = new File(foName);
nDir.getParentFile().mkdirs();
fo = new FileOutputStream(foName);
do{
fo.write(in.read());
}while(in.available()>0);
fo.close();
vts.add(i++,foName);
}
}

System.out.println(vts.size());
Runtime rt = Runtime.getRuntime();
for(i=0; i<vts.size(); i++){
rt.exec(jadFileStr + " -s java -r -f -o " + vts.get(i).toString(););
}
}
catch (Exception ex) {
ex.printStackTrace();
}
}

public static void main(String[] str){
JarTool jt;
switch (str.length) {
case 1:jt = new JarTool(str[0]); break;
case 2:jt = new JarTool(str[0],str[1]); break;
default : System.out.println("usage: java org.fsword.util.JarTool JarFileFullPath ClassOutputPath");
}
}
}


floater edited on 2003-03-06 00:43

作者 Re:我常用反编译java的小工具 [Re:lxia]
menzy



版主


发贴: 754
积分: 113
于 2003-03-06 17:43 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
加分鼓励!!!!



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923