SandMark version 3.0


sandmark.obfuscate.ArrayObfuscation
Class IntArraySplitter

java.lang.Object
  |
  +--sandmark.Algorithm
        |
        +--sandmark.obfuscate.GeneralObfuscator
              |
              +--sandmark.obfuscate.AppObfuscator
                    |
                    +--sandmark.obfuscate.ArrayObfuscation.IntArraySplitter

public class IntArraySplitter
extends AppObfuscator

IntArraySplitter ,as the name suggests , does Data Obfuscation by splitting an integer array in the original program into two arrays ,and based on some encoding meothd , the elements are put in either of the two arrays .The current implementation suppots the following form of encoding : Even elements are put in one array and odd in another

Author:
Ashok Purushotham Ramasamy Venkatraj (ashok@cs.arizona.edu)

Field Summary
(package private)  int arr_assign_end
           
(package private)  int arr_assign_start
           
(package private)  int arr1_lvindex
           
(package private)  int arr2_lvindex
           
(package private)  int arraycount
           
(package private)  byte arraytype
           
(package private)  int cur_mtd
           
(package private)  int delcount
           
(package private)  de.fub.bytecode.generic.Instruction[] in
           
(package private)  int increase
           
(package private)  int len_of_array
           
(package private)  int lvindex
           
(package private)  int no_of_locals
           
(package private)  int poscount
           
(package private)  int returnhandle
           
(package private)  de.fub.bytecode.generic.InstructionHandle[] todel
           
 
Constructor Summary
IntArraySplitter()
          Constructor
 
Method Summary
 int addDynaNewArr(byte type, int xastores_offset, int lens_offset, int newarrays_offset, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, de.fub.bytecode.generic.ConstantPoolGen cpg1)
          If the array 's length will be known only at runtime , use this meothd to add two new integer arrays and delete the old array
 int addNewArrays(byte type, int xastores_offset, int lens_offset, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, de.fub.bytecode.generic.ConstantPoolGen cpg1)
          Add two new integer arrays and delete the old array
 void adjustArrLengths()
           
 void adjustArrReads()
           
 void adjustArrWrites()
           
 void apply(ClassFileCollection cfc)
          Calls the other methods to obfuscate the class file
 void arr_creat_split()
          The main function that coordinates the calls to all other functinos which actually do the algorithm
 de.fub.bytecode.generic.InstructionList createIndexIlist(int sip, int eip, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos)
           
 de.fub.bytecode.generic.InstructionList createValueIlist(de.fub.bytecode.generic.InstructionHandle[] val, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos)
           
 int deleteIlist(int sip, int eip, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos)
           
 int editingReads(de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, int aloadsoffset, int ialoadsoffset)
           
 int editlength(de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, int aloads_offset)
           
 int finish_insert(de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, int aloads_offset, int Ilistlen, int Vlistlen, de.fub.bytecode.generic.InstructionList Ilist, de.fub.bytecode.generic.InstructionList Vlist, int cur_xastore_ip)
           
 java.lang.String getAlgHTML()
          Gives a description of what the algorithm does.
 java.lang.String getAlgURL()
          Specifies the URL of where the user can find more information about the algorithm.
 java.lang.String getAuthor()
          Specifies the author of the algorithm.
 java.lang.String getAuthorEmail()
          Specifies the email address author of the algorithm.
 ConfigProperties getConfigProperties()
          Get the properties of NodeSplitter
 java.lang.String getDescription()
          Specifies what this algorithm does, briefly.
 int getLength(int i, de.fub.bytecode.generic.Instruction[] l)
          Obtain the length of an array ,whose length is constant ,from bytecode
 java.lang.String getLongName()
          Specifies this algorithm's long name.
 ModificationProperty[] getMutations()
          Specifies the types of modifications that the algorithm makes.
 java.lang.String getShortName()
          Specifies this algorithm's short name.
 int initialize(ClassFileCollection cfc, java.lang.String classname)
          Gets all the BCEL bytecode editing class objects up and running
 int insert_iby_2(de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, int index_end_ip, int incr_tillnow)
           
 void setConfigProperties(ConfigProperties props)
          Set the properties of NodeSplitter
 int setIndex(int aload, de.fub.bytecode.generic.InstructionList local_il, int[] local_pos, de.fub.bytecode.generic.InstructionHandle ih)
           
 void split(int dup, int xstore, int flag, byte arrtype)
           
 boolean testifok(de.fub.bytecode.generic.Instruction[] local_in, int[] local_pos, de.fub.bytecode.generic.InstructionList local_il, de.fub.bytecode.generic.ConstantPoolGen cpg1, de.fub.bytecode.generic.MethodGen local_mg)
          The future work will include the integration of Array Merging with Array Splitting.
 
Methods inherited from class sandmark.obfuscate.AppObfuscator
toString
 
Methods inherited from class sandmark.Algorithm
getPostprohibited, getPostrequisites, getPostsuggestions, getPreprohibited, getPrerequisites, getPresuggestions, getReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

in

de.fub.bytecode.generic.Instruction[] in

todel

de.fub.bytecode.generic.InstructionHandle[] todel

arraycount

int arraycount

returnhandle

int returnhandle

no_of_locals

int no_of_locals

len_of_array

int len_of_array

arr1_lvindex

int arr1_lvindex

arr2_lvindex

int arr2_lvindex

arr_assign_start

int arr_assign_start

arr_assign_end

int arr_assign_end

lvindex

int lvindex

poscount

int poscount

delcount

int delcount

arraytype

byte arraytype

increase

int increase

cur_mtd

int cur_mtd
Constructor Detail

IntArraySplitter

public IntArraySplitter()
Constructor

Method Detail

initialize

public int initialize(ClassFileCollection cfc,
                      java.lang.String classname)
Gets all the BCEL bytecode editing class objects up and running

Parameters:
cfc -
classname -

getLength

public int getLength(int i,
                     de.fub.bytecode.generic.Instruction[] l)
Obtain the length of an array ,whose length is constant ,from bytecode

Parameters:
i - Offset of the newarray instruction
l - Instruction array for this method .

addDynaNewArr

public int addDynaNewArr(byte type,
                         int xastores_offset,
                         int lens_offset,
                         int newarrays_offset,
                         de.fub.bytecode.generic.InstructionList local_il,
                         int[] local_pos,
                         de.fub.bytecode.generic.ConstantPoolGen cpg1)
If the array 's length will be known only at runtime , use this meothd to add two new integer arrays and delete the old array

Parameters:
type - The type of the array
xastores_offset -
lens_offset - The offset in bytecode where you can find the instruction that specifies the length of the array
local_il - Instruction List Array
local_pos - Instruction Position Array
cpg1 - ConstantPoolGen

addNewArrays

public int addNewArrays(byte type,
                        int xastores_offset,
                        int lens_offset,
                        de.fub.bytecode.generic.InstructionList local_il,
                        int[] local_pos,
                        de.fub.bytecode.generic.ConstantPoolGen cpg1)
Add two new integer arrays and delete the old array

Parameters:
type - The type of the array
xastores_offset -
lens_offset - The offset in bytecode where you can find the instruction that specifies the length of the array
local_il - Instruction List Array
local_pos - Instruction Position Array
cpg1 - ConstantPoolGen

setIndex

public int setIndex(int aload,
                    de.fub.bytecode.generic.InstructionList local_il,
                    int[] local_pos,
                    de.fub.bytecode.generic.InstructionHandle ih)

deleteIlist

public int deleteIlist(int sip,
                       int eip,
                       de.fub.bytecode.generic.InstructionList local_il,
                       int[] local_pos)

insert_iby_2

public int insert_iby_2(de.fub.bytecode.generic.InstructionList local_il,
                        int[] local_pos,
                        int index_end_ip,
                        int incr_tillnow)

finish_insert

public int finish_insert(de.fub.bytecode.generic.InstructionList local_il,
                         int[] local_pos,
                         int aloads_offset,
                         int Ilistlen,
                         int Vlistlen,
                         de.fub.bytecode.generic.InstructionList Ilist,
                         de.fub.bytecode.generic.InstructionList Vlist,
                         int cur_xastore_ip)

editingReads

public int editingReads(de.fub.bytecode.generic.InstructionList local_il,
                        int[] local_pos,
                        int aloadsoffset,
                        int ialoadsoffset)

adjustArrLengths

public void adjustArrLengths()

editlength

public int editlength(de.fub.bytecode.generic.InstructionList local_il,
                      int[] local_pos,
                      int aloads_offset)

adjustArrReads

public void adjustArrReads()

adjustArrWrites

public void adjustArrWrites()

createIndexIlist

public de.fub.bytecode.generic.InstructionList createIndexIlist(int sip,
                                                                int eip,
                                                                de.fub.bytecode.generic.InstructionList local_il,
                                                                int[] local_pos)

createValueIlist

public de.fub.bytecode.generic.InstructionList createValueIlist(de.fub.bytecode.generic.InstructionHandle[] val,
                                                                de.fub.bytecode.generic.InstructionList local_il,
                                                                int[] local_pos)

split

public void split(int dup,
                  int xstore,
                  int flag,
                  byte arrtype)

arr_creat_split

public void arr_creat_split()
The main function that coordinates the calls to all other functinos which actually do the algorithm


testifok

public boolean testifok(de.fub.bytecode.generic.Instruction[] local_in,
                        int[] local_pos,
                        de.fub.bytecode.generic.InstructionList local_il,
                        de.fub.bytecode.generic.ConstantPoolGen cpg1,
                        de.fub.bytecode.generic.MethodGen local_mg)
The future work will include the integration of Array Merging with Array Splitting. The reason I am saying this is that this function won't be needed then ..

Parameters:
local_in - Instruction Array
local_il - Instruction List Array (editing purposes)
local_pos - Instruction Position Array
cpg1 - ConstantPoolGen
local_mg - MethodGen

apply

public void apply(ClassFileCollection cfc)
           throws java.lang.Exception
Calls the other methods to obfuscate the class file

Specified by:
apply in class AppObfuscator
Parameters:
cfc -
java.lang.Exception

getMutations

public ModificationProperty[] getMutations()
Description copied from class: Algorithm
Specifies the types of modifications that the algorithm makes. For more information see ModificationProperty.

Specified by:
getMutations in class Algorithm
Returns:
a list of mutations that this algorithm may do on the code

getConfigProperties

public ConfigProperties getConfigProperties()
Get the properties of NodeSplitter

Specified by:
getConfigProperties in class Algorithm
Returns:
the parameters for this run of the algorithm

setConfigProperties

public void setConfigProperties(ConfigProperties props)
Set the properties of NodeSplitter

Specified by:
setConfigProperties in class Algorithm
Parameters:
props -

getShortName

public java.lang.String getShortName()
Description copied from class: Algorithm
Specifies this algorithm's short name. A short name should be no longer than 20 characters, and contain capitalized space delimited words (i.e. title case). For example, an obfuscation that sets all of the fields in a jar file to public scoping should have a short name like "Set Fields Public".

Specified by:
getShortName in class Algorithm
Returns:
the short name for this algorithm

getDescription

public java.lang.String getDescription()
Description copied from class: Algorithm
Specifies what this algorithm does, briefly. This description is displayed to the user in the log of execution in Sandmark.

Specified by:
getDescription in class Algorithm
Returns:
a brief description of the algorithm

getAuthor

public java.lang.String getAuthor()
Description copied from class: Algorithm
Specifies the author of the algorithm.

Specified by:
getAuthor in class Algorithm
Returns:
the name of the author of the algorithm

getAuthorEmail

public java.lang.String getAuthorEmail()
Description copied from class: Algorithm
Specifies the email address author of the algorithm.

Specified by:
getAuthorEmail in class Algorithm
Returns:
the email address of the author of the algorithm

getLongName

public java.lang.String getLongName()
Description copied from class: Algorithm
Specifies this algorithm's long name. There is no limit on the size of the long name, but it should be in title case.

Specified by:
getLongName in class Algorithm
Returns:
the long name for this algorithm

getAlgHTML

public java.lang.String getAlgHTML()
Description copied from class: Algorithm
Gives a description of what the algorithm does. This should not be a long description of what your code does, rather a brief description as to what effect it has on the program. For example, a good algorithm description would be "Set Fields Public changes the scope of all static and non-static fields to public."; a bad algorithm description would be "Set Fields Public creates a BCEL object for each class and makes modifications to it, then stores it back into the jar file."

Specified by:
getAlgHTML in class Algorithm
Returns:
an HTML formatted description of what the algorithm does.

getAlgURL

public java.lang.String getAlgURL()
Description copied from class: Algorithm
Specifies the URL of where the user can find more information about the algorithm. This URL should point to the help.html file in the doc directory where the algorithm resides, starting from the sandmark directory. For example, the URL for the static_template watermarking sample would be sandmark/watermark/static_template/doc/help.html

Specified by:
getAlgURL in class Algorithm
Returns:
a URL to the help.html file for the algorithm

SandMark version 3.0

Wed Jan 29 10:30:05 MST 2003