使用jd-gui+javassist修改已编译好的class文件

2017-07-28

1.原因:因为公司代码管理不当导致源码丢失,只好已编译好的class文件进行修改

2.首先先在myeclipse中新建java项目并导入javassist

3.将需要修改的文件放到指定文件夹下

4..在项目中添加以下代码

package dtj;

import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;

public class MyTest {

///////入口启动函数

       public static void main(String[] args) throws Exception {

       //这个是得到反编译的池

      ClassPool pool = ClassPool.getDefault();
      
      pool.insertClassPath("E:/dtj") ;
      
    //取得需要反编译修改的文件,注意是完整路径

      CtClass cc1 = pool.get("SmsSender");

      try {
          
          
          cc1.setName("CTCC_SmsSender");
          //取得需要修改的方法

         // CtMethod method = cc1.getDeclaredMethod("a");

         //插入修改项,我们让他直接返回(注意:根据方法的具体返回值返回,因为这个方法返回值是void,所以直接return;)

         // method.insertBefore("{if(true) return ;}");

          //写入保存

          cc1.writeFile();

      } catch (NotFoundException e) {

          e.printStackTrace();

     }

} 
}

注:jd-gui和javassist的下载地址
下载


本文由 admin 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

4001 条评论

  1. xlxohbbc
    xlxohbbc

    使用jd-gui javassist修改已编译好的class文件 - 青花瓷
    axlxohbbc
    [url=http://www.gi0o5j9i36514oh49rfz26r5pe0l2k6as.org/]uxlxohbbc[/url]
    xlxohbbc http://www.gi0o5j9i36514oh49rfz26r5pe0l2k6as.org/

    1. KallinikaRok
      KallinikaRok

      is cannabis together

      441d achat is italie

      1. pqanielsddwsc
        pqanielsddwsc

        lbcyohprhkmq viagra testimonials viagra shelf life viagra free samples mexican pharmacy for erectile dysfunction and cialis
        viagra online sales
        http://dou46magadan.ru/user/bongomarch4/

    2. KallinikaRok
      KallinikaRok

      is verkaufte aus kanada

      441d at is daily soft tabs

      1. woaniellpjnqf
        woaniellpjnqf

        tmidywlprnpb low cost viagra canadian cialis] viagra pill brand cialis canadain paypal
        does generic viagra work
        http://www.agriverdesa.it/index.php?option=com_k2&view=itemlist&task=user&id=879358

    3. KallinikaRok
      KallinikaRok

      ff97 buy cialis cipla

      http://cialishhqq.com/ - get cialis toronto
      discount cialis

      precios cialis genrico

      1. atanielndpmap
        atanielndpmap

        qzvdyltxewul cheapest canadian pharmacy. for cialis online viagra safe generic viagra candian pharmacy viagra
        online pharmacy viagra
        http://hwctr.com/index.php?qa=user&qa_1=bongobeetle3

    4. KallinikaRok
      KallinikaRok

      is rezeptfrei online

      441d is jovene

    5. Kristianascied
      Kristianascied

      comprar is foro

      b5db is tablets prices in pk

      1. rcanielbumrwt
        rcanielbumrwt

        uciqysvvzbyx lowest price viagra viagra overnight viagra and high blood pressure price of cialis in canada
        viagra purchase

    6. Kristianascied
      Kristianascied

      is e cibo

      b5db is levitra is prices

    7. Gordianscied
      Gordianscied

      is tadalafil a at is

      be07 is to be

      1. ixhnry
        ixhnry

        4dnj9ns payday loan alternative
        http://loandayfastgo.com/ - installment loans for bad credit no payday loans
        payday loans in jacksonville fl
        best online payday loans direct lender payday loans oregon

    8. Gordianscied
      Gordianscied

      is 10 precio

      be07 is tadalafil a at is

  2. kkdkvgnvje
    kkdkvgnvje

    使用jd-gui javassist修改已编译好的class文件 - 青花瓷
    akkdkvgnvje
    [url=http://www.g8yw5ks66g33v98gj85j34pv0fh1r55ys.org/]ukkdkvgnvje[/url]
    kkdkvgnvje http://www.g8yw5ks66g33v98gj85j34pv0fh1r55ys.org/

    1. RebekkaRok
      RebekkaRok

      ato do is dosagem

      88fc usa is prescription

      1. yghxcn
        yghxcn

        7fudkob fast auto payday loans
        http://loandayfastgo.com/ - payday loans without checks
        payday loans no credit check no employment verification
        payday loans guaranteed approval advance america payday loan

    2. RebekkaRok
      RebekkaRok

      achat is generique pfizer

      88fc is bestellen online paypal

    3. RebekkaRok
      RebekkaRok

      escompte bon march is

      88fc original is for sale

    4. RebekkaRok
      RebekkaRok

      be is where

      88fc comprare is is levitr

      1. loqbyc
        loqbyc

        rclj6ga payday loan alternative
        http://loandayfastgo.com/ - payday loans chicago
        payday loans guaranteed approval
        payday loans fresno ca payday loans colorado

      2. kyanieledvjbw
        kyanieledvjbw

        lrzbxsprsfen sildenafil viagra canada viagra prescription viagra canadian pharmacies free cialis
        viagra order online
        http://tinyurl.com/qrnnti00

  3. sqfkxbkt
    sqfkxbkt

    使用jd-gui javassist修改已编译好的class文件 - 青花瓷
    sqfkxbkt http://www.gpokyslq944271j941ao31y8dig139a0s.org/
    asqfkxbkt
    [url=http://www.gpokyslq944271j941ao31y8dig139a0s.org/]usqfkxbkt[/url]

    1. AaronAbale
      AaronAbale

      http://amoxicillin-abc.com/ - amoxicillin price

    2. Bennybot
      Bennybot

      ciprofloxacin hcl

    3. CharlesSer
      CharlesSer

      albuterol

    4. Bennybot
      Bennybot

      diflucan no rx

      1. feanielonlscy
        feanielonlscy

        lryizupglkhy www.cialis.com viagra pro viagra pfizer online canadian pharmacy free viagra
        order viagra
        http://www.introrecycling.com/index.php?option=com_k2&view=itemlist&task=user&id=969701

    5. Bennybot
      Bennybot

      cheap vardenafil

    6. AaronAbale
      AaronAbale

      http://orderdiflucan.us.com/ - diflucan

      1. rdanielflmenb
        rdanielflmenb

        icmfvtqcootq best viagra viagra shelf life get viagra generic cialis canadian pharmacy
        herbal viagra reviews
        https://yourbookmark.stream/story.php?title=want-healthy-skin-its-easy-with-these-tips#discuss

      2. peanielqfmsyj
        peanielqfmsyj

        nzqvqxeeqkqx canada cialis effects of viagra viagra results cialiscanada
        viagra for women
        https://zzb.bz/NEFlD

    7. CharlesSer
      CharlesSer

      order viagra online

    8. Bennybot
      Bennybot

      torsemide

    9. MichaelHon
      MichaelHon

      metformin

    10. Brettpew
      Brettpew

      prednisone