Topic: 我常用反编译java的小工具

  Print this page

1.我常用反编译java的小工具 Copy to clipboard
Posted by: lxia
Posted on: 2003-03-02 13:11

破解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)

2.Re:我常用反编译java的小工具 [Re: lxia] Copy to clipboard
Posted by: rainman
Posted on: 2003-03-02 13:41


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`;        
      }
    }  
  }  
}


3.Re:我常用反编译java的小工具 [Re: lxia] Copy to clipboard
Posted by: luoq_dl
Posted on: 2003-03-04 09:29


4.Re:我常用反编译java的小工具 [Re: lxia] Copy to clipboard
Posted by: glistar
Posted on: 2003-03-04 13:03

这样使用 JAD 就可以了:

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

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

5.Re:我常用反编译java的小工具 [Re: luoq_dl] Copy to clipboard
Posted by: rainman
Posted on: 2003-03-04 13:14

呵呵,不知道啊。

6.Re:我常用反编译java的小工具 [Re: rainman] Copy to clipboard
Posted by: snowbug
Posted on: 2003-03-05 07:10

rainman wrote:
呵呵,不知道啊。


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

7.Re:我常用反编译java的小工具 [Re: snowbug] Copy to clipboard
Posted by: rainman
Posted on: 2003-03-05 08:38

Embaressed yes, i didn't

8.Re:我常用反编译java的小工具 [Re: rainman] Copy to clipboard
Posted by: fsword
Posted on: 2003-03-05 20:56

这个不能操作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");
}
}
}

9.Re:我常用反编译java的小工具 [Re: lxia] Copy to clipboard
Posted by: menzy
Posted on: 2003-03-06 17:43

加分鼓励!!!!


   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