minor fix

This commit is contained in:
Anthony Desnos 2010-11-17 16:43:43 +01:00
parent 5d26e020e4
commit 94b353fdbe
6 changed files with 42 additions and 14 deletions

View File

@ -79,9 +79,9 @@ class VM_int :
method.show()
WM_L1 = wm.WM_L1
WM_L3 = wm.WM_L3
WM_L4 = wm.WM_L4
class WM :
def __init__(self, andro, class_name, wm_type, output_file) :

View File

@ -111,8 +111,8 @@ class JVMBreakBlock :
desc = getattr(self.__vm, self.__info[t][0])( o[0], o[1], o[2] )
# It's an external
if desc == None :
desc = ExternalFM( o[0], o[1], o[2] )
if desc[0] == None :
desc = ( ExternalFM( o[0], o[1], o[2] ), self.__vm )
if desc not in self.__info[t][1] :
self.__info[t][1][desc] = []
@ -166,7 +166,9 @@ class JVMBreakBlock :
return "F" + i.get_operands()[2]
def show(self) :
print self.__fields
for i in self.__ins :
print "\t\t",
i.show(0)
class GVM_BCA :
def __init__(self, _vm, _method) :
@ -212,7 +214,12 @@ class GVM_BCA :
def show(self) :
print "METHOD", self.__method.get_class_name(), self.__method.get_name(), self.__method.get_descriptor()
#self.__method.show()
# self.__method.show()
for i in self.__bb :
print "\t", i
i.show()
self.show_fields()
self.show_methods()
@ -230,7 +237,7 @@ class GVM_BCA :
for i in self.__bb :
fields = i.get_fields()
for field in fields :
print "\t\t-->", field.get_class_name(), field.get_name(), field.get_descriptor()
print "\t\t-->", field[0].get_class_name(), field[0].get_name(), field[0].get_descriptor()
for context in fields[field] :
print "\t\t\t |---|", context.mode, context.details
@ -240,7 +247,7 @@ class GVM_BCA :
for i in self.__bb :
methods = i.get_methods()
for method in methods :
print "\t\t-->", method.get_class_name(), method.get_name(), method.get_descriptor()
print "\t\t-->", method[0].get_class_name(), method[0].get_name(), method[0].get_descriptor()
for context in methods[method] :
print "\t\t\t |---|", context.details
@ -254,7 +261,7 @@ class VMBCA :
self.__hmethods[ i ] = x
def show(self) :
for i in self.l :
for i in self.__methods :
i.show()
def get(self, method) :

View File

@ -2,12 +2,14 @@ import os, sys, hashlib, random, types, itertools, hashlib
import analysis, misc
import wm_l3, wm_l4
import wm_l1, wm_l3, wm_l4
WM_L3 = 0
WM_L4 = 1
WM_L1 = 0
WM_L3 = 1
WM_L4 = 2
WM_BIND = {
WM_L1 : wm_l1.INIT(),
WM_L3 : wm_l3.INIT(),
WM_L4 : wm_l4.INIT(),
}

19
core/wm/wm_l1.py Normal file
View File

@ -0,0 +1,19 @@
def INIT() :
return WM_L1
class WM_L1 :
def __init__(self, vm, method, analysis) :
x = analysis.get(method)
self.set_context( )
raise("ooops")
def get(self) :
return [ ]
def set_context(self, values) :
pass

View File

@ -7,8 +7,8 @@ sys.path.append(PATH_INSTALL + "./")
import androguard, analysis
TEST = 'examples/java/test/orig/Test1.class'
TEST = 'examples/java/Demo1/orig/DES.class'
TEST = 'examples/java/Demo1/orig/Util.class'
#TEST = 'examples/java/Demo1/orig/DES.class'
#TEST = 'examples/java/Demo1/orig/Util.class'
a = androguard.AndroguardS( TEST )

View File

@ -12,7 +12,7 @@ TEST_ANDRO = './examples/android/Test/bin/classes.dex'
_a = androguard.AndroguardS( TEST )
wm = androguard.WM( _a, "org.t0t0.android.Test1", [ androguard.WM_L4 ], "./wm.xml" )
wm = androguard.WM( _a, "org.t0t0.android.Test1", [ androguard.WM_L1 ], "./wm.xml" )
_b = androguard.AndroguardS( TEST_ANDRO )
androguard.WMCheck( _b, "./wm.xml" )