成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

Java混淆編譯器怎么實(shí)現(xiàn)

本篇內(nèi)容主要講解“Java混淆編譯器怎么實(shí)現(xiàn)”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Java混淆編譯器怎么實(shí)現(xiàn)”吧!

在蒙城等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、網(wǎng)站設(shè)計(jì)、外貿(mào)營銷網(wǎng)站建設(shè) 網(wǎng)站設(shè)計(jì)制作定制網(wǎng)站制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),成都全網(wǎng)營銷,外貿(mào)網(wǎng)站建設(shè),蒙城網(wǎng)站建設(shè)費(fèi)用合理。

Q: 什么是混淆器?
A: 由于Java程序運(yùn)行時(shí)是動(dòng)態(tài)連接的,因此編譯成的目標(biāo)文件中包含有符號(hào)表,使得Java程序很容易被反編譯,混淆器可以打亂class文件中的符號(hào)信息,使反向工程變得非常困難。

Q: 現(xiàn)有的混淆器有什么問題?
A: 現(xiàn)有的混淆器都是對(duì)編譯好的class文件進(jìn)行混淆,這樣就需要編譯和混淆兩個(gè)步驟。并不是所有的符號(hào)都需要混淆,如果你開發(fā)的是一個(gè)類庫,或者某些類需要?jiǎng)討B(tài)裝載,那些公共API就必須保留符號(hào)不變,這樣別人才能使用你的類庫?,F(xiàn)有的混淆器提供了GUI或腳本的方式來對(duì)那些需要保留的符號(hào)名稱進(jìn)行配置,如果程序較大時(shí)配置工作變得很復(fù)雜,而程序一旦修改配置工作又要重新進(jìn)行。某些混淆器能夠調(diào)整字節(jié)碼的順序,使反編譯更加困難,但我經(jīng)歷過混淆之后的程序運(yùn)行出錯(cuò)的情況。

Q: Java混淆編譯器是如何工作的?
A: Java混淆編譯器是在Sun JDK中提供的Java編譯器(javac)的基礎(chǔ)上完成的,修改了代碼生成過程,對(duì)編譯器生成的中間代碼進(jìn)行混淆,最后再生成class文件,這樣編譯和混淆只需要一個(gè)步驟就可以完成。另外可以在源程序中插入符號(hào)保留指令來控制哪些符號(hào)需要保留,不需要單獨(dú)的配置。

Q: 如何安裝和運(yùn)行JOC?
A: 下載joc.jar ,運(yùn)行java -jar joc.jar就可以啟動(dòng)Java混淆編譯器,joc的命令行參數(shù)和javac完全相同,但增加了一個(gè)新的參數(shù)-Xobfuscate,它的用法如下:
-Xobfuscate:


其中指定混淆級(jí)別,可以是以下幾種級(jí)別:
-Xobfuscate:none 不進(jìn)行混淆
-Xobfuscate:private 對(duì)所有private訪問級(jí)別的元素進(jìn)行混淆
-Xobfuscate:package 對(duì)所有private或package private元素進(jìn)行混淆
-Xobfuscate:protected 對(duì)所有private, package private, protected元素進(jìn)行混淆
-Xobfuscate:public 對(duì)所有的元素都進(jìn)行混淆
-Xobfuscate:all 相當(dāng)于-Xobfuscate:public
如果使用-Xobfuscate不帶級(jí)別參數(shù),則相當(dāng)于-Xobfuscate:package

Q: 如何使用符號(hào)保留指令?
A: 除了在命令行用-Xobfuscate參數(shù)控制符號(hào)混淆級(jí)別外,還可以在源代碼中使用符號(hào)保留指令來控制那些符號(hào)需要保留,符號(hào)保留指令是一個(gè)Java文檔注釋指令,可以插入在類和類成員的文檔注釋中,例如:
/**
* This class should preserve.
* @preserve
*/
public class Foo {
/**
* You can specify which field should be preserved.
* @preserve
*/
private int x;


/**
* This field is not preserved.
*/
private int y;


/**
* You can also preserve methods.
* @preserve
*/
public void hello() {}


/**
* This method is not preserved.
*/
private void collect() {}
}
如果沒有@preserve指令,則根據(jù)混淆級(jí)別及成員的訪問級(jí)別來確定符號(hào)是否保留。

對(duì)于類的符號(hào)保留指令可以附帶一個(gè)保留級(jí)別參數(shù),來控制類成員的符號(hào)保留,包括:
@preserve 僅對(duì)類名進(jìn)行保留,類成員的保留根據(jù)-Xobfuscate命令行參數(shù)決定
@preserve public 保留所有public成員
@preserve protected 保留所有public和protected成員
@preserve package 保留所有public, protected, package private成員
@preserve private 保留所有成員
@preserve all 相當(dāng)于@preserve private

Q: JOC有哪些限制?
A: 不支持分別編譯,必須對(duì)所有的源文件進(jìn)行混淆編譯。

源文件:
import java.awt.event.*;
import javax.swing.*;
public class AboutBox extends JDialog
{
public AboutBox()
{
initForm();
}
JPanel panel1 = new JPanel();
JButton button1 = new JButton();
JLabel jLabel2 = new JLabel();
JTextArea jTextArea1 = new JTextArea();

/**
* NOTE: The following code is required by the form designer.
* It can be modified using the form editor. Do not
* modify it using the code editor.
*/


private void initForm()
{
this.setDefaultCloseOperation( WindowConstants.DISPOSE_ON_CLOSE );
this.getContentPane().setLayout( new java.awt.CardLayout());
this.setModal( true );
this.setResizable( false );
this.setTitle( "About..." );
panel1.setLayout( null );
button1.setText( "OK" );
button1.setBounds( 272, 168, 88, 24 );
panel1.add( button1 );
jLabel2.setText( "File System Viewer for Swing 1.1.1" );
jLabel2.setVerticalAlignment( SwingConstants.TOP );
jLabel2.setBounds( 64, 32, 240, 56 );
panel1.add( jLabel2 );
jTextArea1.setFont( new java.awt.Font( "Dialog", 0, 10 ));
jTextArea1.setLineWrap( true );
jTextArea1.setOpaque( false );
jTextArea1.setText( "This computer program is protected by copyright law." );
jTextArea1.setWrapStyleWord( true );
jTextArea1.setBounds( 8, 112, 256, 80 );
panel1.add( jTextArea1 );
this.getContentPane().add( panel1, "Card1" );
this.setSize( 376, 228 );
button1.addActionListener( new java.awt.event.ActionListener(){
public void actionPerformed( java.awt.event.ActionEvent ev ){
button1_actionPerformed( ev );
}});
}
private void button1_actionPerformed(ActionEvent ev)
{
this.dispose();
}
}

經(jīng)Javac編譯后用JAD反編譯的結(jié)果:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.text.JTextComponent;

public class AboutBox extends JDialog
{

JPanel panel1;
JButton button1;
JLabel jLabel2;
JTextArea jTextArea1;

public AboutBox()
{
panel1 = new JPanel();
button1 = new JButton();
jLabel2 = new JLabel();
jTextArea1 = new JTextArea();
initForm();
}

private void initForm()
{
setDefaultCloseOperation(2);
getContentPane().setLayout(new CardLayout());
setModal(true);
setResizable(false);
setTitle("About...");
panel1.setLayout(null);
button1.setText("OK");
button1.setBounds(272, 168, 88, 24);
panel1.add(button1);
jLabel2.setText("File System Viewer for Swing 1.1.1");
jLabel2.setVerticalAlignment(1);
jLabel2.setBounds(64, 32, 240, 56);
panel1.add(jLabel2);
jTextArea1.setFont(new Font("Dialog", 0, 10));
jTextArea1.setLineWrap(true);
jTextArea1.setOpaque(false);
jTextArea1.setText("This computer program is protected by copyright law.");
jTextArea1.setWrapStyleWord(true);
jTextArea1.setBounds(8, 112, 256, 80);
panel1.add(jTextArea1);
getContentPane().add(panel1, "Card1");
setSize(376, 228);
button1.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent actionevent)
{
button1_actionPerformed(actionevent);
}

});
}

private void button1_actionPerformed(ActionEvent actionevent)
{
dispose();
}
}

經(jīng)JOC混淆編譯后用JAD反編譯的結(jié)果:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import javax.swing.text.JTextComponent;


public class AboutBox extends JDialog
{

JPanel _$1;
JButton _$2;
JLabel _$3;
JTextArea _$4;

public AboutBox()
{
_$1 = new JPanel();
_$2 = new JButton();
_$3 = new JLabel();
_$4 = new JTextArea();
_$1();
}

private void _$1()
{
2;
this;
JVM INSTR swap ;
setDefaultCloseOperation();
getContentPane().setLayout(new CardLayout());
true;
this;
JVM INSTR swap ;
setModal();
false;
this;
JVM INSTR swap ;
setResizable();
"About...";
this;
JVM INSTR swap ;
setTitle();
_$1.setLayout(null);
_$2.setText("OK");
_$2;
168;
272;
JVM INSTR swap ;
24;
88;
JVM INSTR swap ;
setBounds();
_$1.add(_$2);
_$3.setText("File System Viewer for Swing 1.1.1");
_$3.setVerticalAlignment(1);
_$3;
32;
64;
JVM INSTR swap ;
56;
240;
JVM INSTR swap ;
setBounds();
_$1.add(_$3);
_$4;
JVM INSTR new #13;
JVM INSTR dup ;
0;
"Dialog";
JVM INSTR swap ;
10;
Font();
setFont();
_$4.setLineWrap(true);
_$4.setOpaque(false);
_$4.setText("This computer program is protected by copyright law.");
_$4.setWrapStyleWord(true);
_$4;
112;
8;
JVM INSTR swap ;
80;
256;
JVM INSTR swap ;
setBounds();
_$1.add(_$4);
getContentPane().add(_$1, "Card1");
376;
this;
JVM INSTR swap ;
228;
setSize();
_$2.addActionListener(new IIlIlIIIIlllIIII(this));
return;
}

private void _$1(ActionEvent actionevent)
{
dispose();
}

/*
static void access$0(AboutBox aboutbox, ActionEvent actionevent)
{
actionevent;
aboutbox;
JVM INSTR swap ;
_$1();
return;
}

*/

// Unreferenced inner classes:

/* anonymous class */
final class IIlIlIIIIlllIIII
implements ActionListener
{
public void actionPerformed(ActionEvent actionevent)
{
AboutBox.access$0(AboutBox.this, actionevent);
}

{
AboutBox.this;
this;
JVM INSTR swap ;
this$0;
}
}
}

到此,相信大家對(duì)“Java混淆編譯器怎么實(shí)現(xiàn)”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

文章名稱:Java混淆編譯器怎么實(shí)現(xiàn)
URL地址:http://jinyejixie.com/article40/gcsjeo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、自適應(yīng)網(wǎng)站、網(wǎng)站收錄、建站公司網(wǎng)頁設(shè)計(jì)公司、品牌網(wǎng)站設(shè)計(jì)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)
古蔺县| 通化县| 澄江县| 鄱阳县| 中江县| 泸水县| 桂阳县| 泰安市| 汽车| 克拉玛依市| 司法| 武功县| 西安市| 浦城县| 宕昌县| 红安县| 泽库县| 永泰县| 黔西县| 张北县| 长乐市| 江北区| 肥东县| 沁阳市| 镇雄县| 易门县| 西乌珠穆沁旗| 军事| 临城县| 鄂伦春自治旗| 库车县| 清河县| 中西区| 萨迦县| 东兰县| 南乐县| 鄂托克旗| 五寨县| 景洪市| 开化县| 德令哈市|