Git Product home page Git Product logo

lawu's People

Contributors

fonkap avatar imgbot[bot] avatar nickelpro avatar pokechu22 avatar pombredanne avatar tktech avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

lawu's Issues

MethodTable.find's 'args' and 'returns' arguments don't work

MethodTable.find's 'args' and 'returns' arguments are ignored.

From here:

args = descriptor[1:end_para]
if args is not None and args != args:
    continue
returns = descriptor[end_para + 1:]
if returns is not None and returns != returns:
    continue

args and returns need to be named something different than their respective parameters, as otherwise the if condition will never be true.

Stack Map Support In Assembler

The assembler currently lacks support for stack maps, a newly required feature for targeting Java 7 and above.

  • Reading
  • Writing (uncompressed, simple frames)
  • Writing (compressed frames)

Support for Python2?

There is a program created by a guy named Pokechu22 and he used this program in conjunction with his Python2 scripts. When I try to use his program in Python 2, it hitches here as this program is in Python 3. I'm sure there has to be Python 2 version of this somewhere, as his program would not have worked back then. Please let me know :)

Java 7/8 Support (including tests)

Jawa is currently only thoroughly tested up to Java 6. We should implement tests for 7 and 8, then implement any missing parts of the new specifications.

No longer works on python 2.7. Should be marked on pip as such.

The new version no long runs on python 2.7

>>> from jawa.classloader import ClassLoader
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\jawa\classloader.py", line 41
    def __init__(self, *sources, max_cache: int=50, klass=ClassFile,
                                         ^
SyntaxError: invalid syntax

JarFile.class_count fails

JarFile.class_count attempts to take the len() of a generator object.

$ python
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from jawa.jf import JarFile
>>> JarFile().class_count
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\Python27\lib\site-packages\jawa\jf.py", line 54, in class_count
    return len(p for p in self.namelist if p.endswith('.class'))
TypeError: object of type 'generator' has no len()

Suggestion: replace line 54 of jf.py with:
return len([p for p in self.namelist if p.endswith('.class')])

Transform bytecode.yaml into bytecode.py

Our current process is to update bytecode.yaml, run a small transform on it to fill in some defaults and convert it to JSON (so we don't add pyyaml as a distribution dependency). At runtime this JSON file is loaded and used as the bytecode reference.

Instead, lets transform bytecode.yaml directly into python. The primary reasoning for this is to support autocomplete, help tags and type hinting for operand values. For example in our yaml file we have ->

aaload:
    op: 0x32
    desc: load onto the stack a reference from an array
    stack:
        before:
            - ArrayRef
            - Index
        after:
            - Value
    runtime:
        - NullPointerException
        - ArrayIndexOutOfBoundsException

We can turn this into ->

class aaload(Instruction):
    """load onto the stack a reference from an array"""
    __slots__ = ('op', 'mnemonic', 'stack', 'runtime', 'operands')
    op = 0x32
    mnemonic = 'aaload'
    ...

So that we can do for example...

import jawa.bytecode as I

method.code.assemble((
    I.aaload,
    I.bipush(6),
    I.return_
))

Missing Attribute Tests

  • BootstrapMethods - Added in: 7 (J2SE_7)
  • Code - Added in: 1.0.2 (JDK1_1)
  • ConstantValue - Added in: 1.0.2 (JDK1_1)
  • Deprecated - Added in: 1.1.0 (JDK1_1)
  • EnclosingMethod - Added in: 5.0.0 (J2SE_5)
  • Exceptions - Added in: 1.0.2 (JDK1_1)
  • InnerClasses - Added in: 1.1.0 (JDK1_1)
  • LineNumberTable - Added in: 1.0.2 (JDK1_1)
  • LocalVariableTable - Added in: 1.0.2 (JDK1_1)
  • LocalVariableTypeTable - Added in: 1.0.2 (JDK1_1)
  • Signature - Added in: 5.0.0 (J2SE_5)
  • SourceFile - Added in: 1.0.2 (JDK1_1)
  • StackMapTable - Added in: 6.0.0 (J2SE_6)
  • Synthetic - Added in: 5.0.0 (J2SE_5)

Not sure if this is a bug...

So recently have been using Jawa in my tool to deobfuscate MC.

Today I found that it was erroring on a class file. Which I found that even eclipses resource loader thinks its not right.

But reporting it here anyways.

The following class causes

https://minecraft16.ml/mr.class

 File "C:\Python27\lib\site-packages\jawa\cf.py", line 99, in __init__
    self._from_io(fio)
  File "C:\Python27\lib\site-packages\jawa\cf.py", line 158, in _from_io
    self._constants.unpack(fio)
  File "C:\Python27\lib\site-packages\jawa\constants.py", line 427, in unpack
    fmt, size = _constant_fmts[tag]
IndexError: tuple index out of range

I have another tool that outputted "com.sun.org.apache.bcel.internal.classfile.ClassFormatException: Invalid byte tag in constant pool: 15" as an error on the same class. So it might be a error because of java 8 or something.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.