[antlr-interest] analysing java source code
Suma Venkatesh
sumav_99 at yahoo.com
Fri Oct 3 12:08:59 PDT 2003
hey
jim,
thanks for the info.Iam trying to build a small obfuscator on a single given java source
code.Its just a research model.I will have to implement several transformations like
chenging loops,data ,variables etc.To accomplish the same i will need a good parser like
java.g ,java.tree.g which can give me all the info abt the input program .But in order to
apply the trans as u said i will need a translator.Do u have any which is ready and I can
directly use it in my application to acheive the same.
There are several such in the byte code level but i want to do it in the high level i
mean on java source code and not on it's compiled class.
Could u please help ?
thanks in advance,
suma
--- Jim O'Connor <Jim.OConnor at microfocus.com> wrote:
> Hi Suma,
> The Cross Reference Tool is very raw. I have been working for the past
> month to enhance its recognition. It will be "more approachable" when I get
> done with it.
>
> More approachable
> 1. Users have different needs. Holes will be left to "plug in"
> different end results (see refMethod() in CodeProject.java).
> 2. A few examples, documentation and a "how to" would be helpful.
>
> I see all this being accomplished in about three months, real time.
>
> The obfuscator could be more or less complicated, depending on how much you
> plan to do. It will be more complicated, if you plan on using the Cross
> reference information. If you know all the files in the project, and just
> mangle consistantly, you just need a translator.
>
> "Mangle consistantly"
> even characters and odd characters
>
> voltage => otgvlae
> volume => ouevlm
>
> "name consistantly"
> cross reference information necessary to find all voltage reference and
> change them to v1
>
> voltage => v1
> volume => v2
> etc...
>
>
> Jim
>
> -----Original Message-----
> From: Suma Venkatesh [mailto:sumav_99 at yahoo.com]
> Sent: Friday, October 03, 2003 1:47 AM
> To: antlr-interest at yahoogroups.com
> Subject: RE: [antlr-interest] analysing java source code
>
>
> Hi
> Jim,
>
> Thank you so much for the help.I now kind of understand java.g,java.tree.g
> and main
> classes.I can now display the variable, types and methods etc..
> My next task is to change the names of the variables into less meaningfull
> ones like if
> variable name is voltage,it should become v1 and so on.
> I tried to experiment with the cross refererence tool.But i get compiler
> errors and also
> i dodnt understand how to use it to acheive my task.
>
> Can u help me on this ??
>
> thanks in advance,
> suma
> --- Jim O'Connor <Jim.OConnor at microfocus.com> wrote:
> > Hi Suma,
> > I assume you can "Tool" a grammar using antlr. I assume you understand
> > the role of the Main.java file in "running" the grammar. If you don't
> > understand either of those, I would recommend going to the getting started
> > section of antlr.org.
> > The printing of the variables and types for a java file should be half
> > hour exercise (being generous), assuming you already have java.g,
> > java.tree.g, and Main.java cranked up.
> >
> > Steps
> > 1. Tool java.g
> > 2. Tool java.tree.g
> > 3. compile all the *.java files, including Main.java.
> > 4. Execute Main.java given an input file.
> > I don't think it will output anything - no actions!
> > 5. To get your types and variables look at java.tree.g
> >
> > variableDef
> > : #(VARIABLE_DEF modifiers typeSpec variableDeclarator
> > varInitializer)
> > ;
> >
> > variableDeclarator
> > : IDENT
> > | LBRACK variableDeclarator
> > ;
> >
> > This section of the world should be very interesting to you. Rip off some
> > print methods from other grammars and you're set.
> >
> >
> > The obfuscator, minimally, is a translator that wants to make everything
> > less readable, rather than more. I haven't looked for translators, but
> > there are people here that have opinions/expertise on those.
> >
> > I am working on the Java Cross Referencing Tool. The obfuscator would
> want
> > to know this type of information to make consistant changes.
> >
> > Hope that helps.
> >
> > Jim
> >
> >
> >
> > -----Original Message-----
> > From: Suma Venkatesh
> > To: antlr-interest at yahoogroups.com
> > Sent: 10/1/03 6:14 PM
> > Subject: Re: [antlr-interest] analysing java source code
> >
> > Hi
> > Terence,
> >
> > I did look into that already but can you please give me some tips on
> > how to run it and
> > use it to achieve my task.I mean read a java file parse it and print
> > variables and their
> > types.some small sample will do for me.I need to start from here and
> > later learn to
> > analyse entire java code like control constructs etc.Our main idea is to
> > build an
> > obfuscation tool kit for java programs using antlr.
> >
> >
> > thanks in advance,
> > suma
> >
> >
> > --- Terence Parr <parrt at antlr.org> wrote:
> > > See the cross referencing headstart in the file sharing area.
> > >
> > > Terence
> > > On Wednesday, October 1, 2003, at 10:01 AM, Suma Venkatesh wrote:
> > >
> > > > Hi,
> > > >
> > > > Iam looking for parsing which can parse an input java source
> > code.I
> > > > mean the parser
> > > > should read the source code and identify the variable names and
> > types
> > > > and control
> > > > structures.I saw java.g example of antlr.But can anyone help me on
> > how
> > > > to use that for
> > > > getting specific results like below.ALso it should the read from an
> > > > input file ,parse it
> > > > and write the output in a file.
> > > >
> > > > Eg: Input is :
> > > > import java.util.*;
> > > >
> > > > public class HelloWorld{
> > > >
> > > > public static void main(String args[]) {
> > > >
> > > > String message = "Hello World";
> > > > int count =0;
> > > >
> > > > while(count <10) {
> > > > System.out.println(message);
> > > > count++;
> > > > }
> > > >
> > > > }
> > > >
> > > > Output should be :
> > > >
> > > > Variables: type name
> > > > int count
> > > > String message
> > > >
> > > > Can ANTLR do this and if so how ??
> > > >
> > > > PLEASE HELP ME!!
> > > >
> > > > thanks in advance,
> > > > suma
> > > >
> > > >
> > > >
> > > > __________________________________
> > > > Do you Yahoo!?
> > > > The New Yahoo! Shopping - with improved product search
> > > > http://shopping.yahoo.com
> > > >
> > > >
> > > >
> > > > Your use of Yahoo! Groups is subject to
> > > > http://docs.yahoo.com/info/terms/
> > > >
> > > >
> > > >
> > > --
> > > Professor Comp. Sci., University of San Francisco
> > > Creator, ANTLR Parser Generator, http://www.antlr.org
> > > Co-founder, http://www.jguru.com
> > > Co-founder, http://www.knowspam.net enjoy email again!
> > > Co-founder, http://www.peerscope.com pure link sharing
> > >
> > >
> > >
> > >
> > >
> > >
> > > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> > >
> > >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > The New Yahoo! Shopping - with improved product search
> > http://shopping.yahoo.com
> >
> >
> >
> > Your use of Yahoo! Groups is subject to
> > http://docs.yahoo.com/info/terms/
> >
> >
> >
> > ________________________________________________________________________
> > This e-mail has been scanned for viruses by MCI's Internet Managed
> > Scanning Services - powered by MessageLabs. For further information
> > visit http://www.mci.com
> > ________________________________________________________________________
> >
> >
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
>
>
> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
> ________________________________________________________________________
> This e-mail has been scanned for viruses by MCI's Internet Managed Scanning
> Services - powered by MessageLabs. For further information visit
> http://www.mci.com
> ________________________________________________________________________
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list