SandMark version 2.0


sandmark.obfuscate.nameoverloading
Class NameOverloading

java.lang.Object
  |
  +--sandmark.Algorithm
        |
        +--sandmark.obfuscate.GeneralObfuscator
              |
              +--sandmark.obfuscate.AppObfuscator
                    |
                    +--sandmark.obfuscate.nameoverloading.NameOverloading

public class NameOverloading
extends AppObfuscator

Obfuscation - Layout Transformation name: MethodOverloadingObfuscator input := jar containing class files Algorithm: graph <- collectMethodNode(input) # foreach class file, create a MethodNode # representing the class name it came from, # the name of the method, and the signuture # of the method. # # [important] if the method is not related # to the Java 2 SDK, add it to # the set representing the # "graph" connectGraph(graph) # determine which nodes should be connected # and created edges between them. # def: given a MethodNode n1 and a # MethodNode n2, they are connected # iff they have the same signature. colorGraph() # assign names to the nodes, a node cannot # share the same name with any node that # it is connected to. createLookup() # defining a mapping of old name to new name commitNameChanges() # traverse the methods of each classfile, # use the lookup to determine the new name # of a given method, encode the name, set # the index in the constant pool, mark the # index as changed, and dump the classfile save changes to jar # each classfile had its changed dumped into # it, save the jar to make all changes final end


Constructor Summary
NameOverloading()
          creates an obfuscator
 
Method Summary
 void apply(ClassFileCollection cfc)
          applies the given obfuscation to the ClassFileCollection passed as an argument (overrides abstract method defined in superclass, AppObfuscator)
 void apply(java.lang.String[] classes, ClassFileCollection cfc)
          applies the given obfuscation to the array of JavaClass objects is passed as parameters.
protected  boolean commitNameChanges(java.lang.String[] classes, ClassFileCollection cfc)
          performs that actual changes of the methods names
 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.
 ConfigProperties getConfigProperties()
          Gets the ConfigProperties object which specifies the parameters for this run of the algorithm.
 java.lang.String getLongName()
          Returns this obfuscator's long name.
 java.lang.String getShortName()
          Returns this obfuscator's short name.
static void main(java.lang.String[] andy)
           
static java.lang.String parseSignature(java.lang.String sig)
          parses the String passed as a method, the String represents the signature of a method.
 void setConfigProperties(ConfigProperties props)
          Sets the ConfigProperties object which specifies the parameters for this run of the algorithm.
 java.lang.String toString()
          Returns a string representation of this obfuscator.
 
Methods inherited from class sandmark.Algorithm
getAuthor, getAuthorEmail, getDescription, getMutations, getPostprohibited, getPostrequisites, getPostsuggestions, getPreprohibited, getPrerequisites, getPresuggestions, getReferences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NameOverloading

public NameOverloading()
creates an obfuscator

Method Detail

getShortName

public java.lang.String getShortName()
Returns this obfuscator's short name.

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

getLongName

public java.lang.String getLongName()
Returns this obfuscator's long name.

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

getConfigProperties

public ConfigProperties getConfigProperties()
Description copied from class: Algorithm
Gets the ConfigProperties object which specifies the parameters for this run of the algorithm.

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

setConfigProperties

public void setConfigProperties(ConfigProperties props)
Description copied from class: Algorithm
Sets the ConfigProperties object which specifies the parameters for this run of the algorithm.

Specified by:
setConfigProperties in class Algorithm
Parameters:
props - the parameters for this run of the 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

apply

public void apply(ClassFileCollection cfc)
applies the given obfuscation to the ClassFileCollection passed as an argument (overrides abstract method defined in superclass, AppObfuscator)

Specified by:
apply in class AppObfuscator
Parameters:
cfc - ClassFileCollection contianing the applications classfiles

apply

public void apply(java.lang.String[] classes,
                  ClassFileCollection cfc)
applies the given obfuscation to the array of JavaClass objects is passed as parameters.

Parameters:
classes - JavaClass objects that make up the application being obfuscated.

commitNameChanges

protected boolean commitNameChanges(java.lang.String[] classes,
                                    ClassFileCollection cfc)
performs that actual changes of the methods names

Parameters:
classes - JavaClass objects that make up the application being obfuscated

parseSignature

public static java.lang.String parseSignature(java.lang.String sig)
parses the String passed as a method, the String represents the signature of a method. The format of the String is (parameter, parameter, ...) return type. Return types to do not uniquely identify methods, so this information needs to be stripped off.

Parameters:
sig - String representing a method signature
Returns:
String a String presenting the signature of a method with the return type stripped off.

toString

public java.lang.String toString()
Description copied from class: AppObfuscator
Returns a string representation of this obfuscator.

Overrides:
toString in class AppObfuscator
Returns:
the string AppObfuscator(shortname)

main

public static void main(java.lang.String[] andy)

SandMark version 2.0

Mon Jun 17 12:30:47 MST 2002