about summary refs log tree commit diff stats
path: root/example/asm
diff options
context:
space:
mode:
Diffstat (limited to 'example/asm')
-rwxr-xr-xexample/asm/shellcode.py15
-rw-r--r--example/asm/simple.py2
2 files changed, 9 insertions, 8 deletions
diff --git a/example/asm/shellcode.py b/example/asm/shellcode.py
index 331e4d69..9be5b517 100755
--- a/example/asm/shellcode.py
+++ b/example/asm/shellcode.py
@@ -71,11 +71,12 @@ loc_db = LocationDB()
 asmcfg, loc_db = parse_asm.parse_txt(machine.mn, attrib, source, loc_db)
 
 # Fix shellcode addrs
-loc_db.set_offset(loc_db.getby_name("main"), addr_main)
+loc_db.set_location_offset(loc_db.get_name_location("main"), addr_main)
 
 if args.PE:
-    loc_db.set_offset(loc_db.getby_name_create("MessageBoxA"),
-                           pe.DirImport.get_funcvirt('USER32.dll', 'MessageBoxA'))
+    loc_db.set_location_offset(loc_db.get_or_create_name_location("MessageBoxA"),
+                               pe.DirImport.get_funcvirt('USER32.dll',
+                                                         'MessageBoxA'))
 
 # Print and graph firsts blocks before patching it
 for block in asmcfg.blocks:
@@ -89,10 +90,10 @@ patches = asmblock.asm_resolve_final(machine.mn,
                                     dst_interval)
 if args.encrypt:
     # Encrypt code
-    loc_start = loc_db.getby_name_create(args.encrypt[0])
-    loc_stop = loc_db.getby_name_create(args.encrypt[1])
-    ad_start = loc_db.loc_key_to_offset(loc_start)
-    ad_stop = loc_db.loc_key_to_offset(loc_stop)
+    loc_start = loc_db.get_or_create_name_location(args.encrypt[0])
+    loc_stop = loc_db.get_or_create_name_location(args.encrypt[1])
+    ad_start = loc_db.get_location_offset(loc_start)
+    ad_stop = loc_db.get_location_offset(loc_stop)
 
     new_patches = dict(patches)
     for ad, val in patches.items():
diff --git a/example/asm/simple.py b/example/asm/simple.py
index 068d3627..5480e2f5 100644
--- a/example/asm/simple.py
+++ b/example/asm/simple.py
@@ -22,7 +22,7 @@ loop:
 ''')
 
 # Set 'main' loc_key's offset
-loc_db.set_offset(loc_db.getby_name("main"), 0x0)
+loc_db.set_location_offset(loc_db.get_name_location("main"), 0x0)
 
 # Spread information and resolve instructions offset
 patches = asmblock.asm_resolve_final(mn_x86, asmcfg, loc_db)