All pastes #830486 Raw Edit

Anonymous

public python v1 · immutable
#830486 ·published 2007-12-24 00:21 UTC
rendered paste body
from System.CodeDom import *from System.CodeDom.Compiler import CodeDomProvider, CodeGeneratorOptionsfrom System.IO import StringWriterimport System.String, System.Int16from Decoder import Decoderclass Decompiler(object):	ARITH_ADD = CodeBinaryOperatorType.Add	ARITH_SUB = CodeBinaryOperatorType.Subtract	ARITH_MUL = CodeBinaryOperatorType.Multiply	ARITH_DIV = CodeBinaryOperatorType.Divide	ARITH_XOR = '^'	ARITH_LSL = '<<'	ARITH_LSR = '>>'		def compileExpr(expr):		provider = CodeDomProvider.CreateProvider('CSharp')		options = CodeGeneratorOptions()		options.BracingStyle = 'Block'		writer = StringWriter()		provider.GenerateCodeFromExpression(expr, writer, options)		ret = writer.ToString()		writer.Close()		return ret		def arith(op, A, B):		if isinstance(op, CodeBinaryOperatorType):			return CodeBinaryOperatorExpression(				A,				op,				B			)		else:			return CodeSnippetExpression(					'%s %s %s' % (						compileExpr(A),						oper,						compileExpr(B)					)				)	add = lambda A, B: Arith(ARITH_ADD, A, B)	sub = lambda A, B: Arith(ARITH_SUB, A, B)	mul = lambda A, B: Arith(ARITH_MUL, A, B)	div = lambda A, B: Arith(ARITH_DIV, A, B)	xor = lambda A, B: Arith(ARITH_XOR, A, B)	lsl = lambda A, B: Arith(ARITH_LSL, A, B)	lsr = lambda A, B: Arith(ARITH_LSR, A, B)		move = CodeAssignStatement		def branch(L, C=None, cond=None, hintTaken=False):		pass		def comp(op, A, B):		pass		opcodes = {		0x33 : ('Gv,Ev', lambda D, S: move(D, xor(D, S))),	}