Java Code Examples for org.jf.dexlib2.dexbacked.DexBackedDexFile#getType()
The following examples show how to use
org.jf.dexlib2.dexbacked.DexBackedDexFile#getType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TypeListItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int typeListOffset) { if (typeListOffset == 0) { return ""; } StringBuilder sb = new StringBuilder(); int size = dexFile.readSmallUint(typeListOffset); for (int i=0; i<size; i++) { int typeIndex = dexFile.readUshort(typeListOffset + 4 + i*2); String type = dexFile.getType(typeIndex); sb.append(type); } return sb.toString(); }
Example 2
Source File: TypeListItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int typeListOffset) { if (typeListOffset == 0) { return ""; } StringBuilder sb = new StringBuilder(); int size = dexFile.readSmallUint(typeListOffset); for (int i=0; i<size; i++) { int typeIndex = dexFile.readUshort(typeListOffset + 4 + i*2); String type = dexFile.getType(typeIndex); sb.append(type); } return sb.toString(); }
Example 3
Source File: ProtoIdItem.java From HeyGirl with Apache License 2.0 | 6 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int protoIndex) { int offset = dexFile.getProtoIdItemOffset(protoIndex); StringBuilder sb = new StringBuilder(); sb.append("("); int parametersOffset = dexFile.readSmallUint(offset + PARAMETERS_OFFSET); sb.append(TypeListItem.asString(dexFile, parametersOffset)); sb.append(")"); int returnTypeIndex = dexFile.readSmallUint(offset + RETURN_TYPE_OFFSET); String returnType = dexFile.getType(returnTypeIndex); sb.append(returnType); return sb.toString(); }
Example 4
Source File: ProtoIdItem.java From zjdroid with Apache License 2.0 | 6 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int protoIndex) { int offset = dexFile.getProtoIdItemOffset(protoIndex); StringBuilder sb = new StringBuilder(); sb.append("("); int parametersOffset = dexFile.readSmallUint(offset + PARAMETERS_OFFSET); sb.append(TypeListItem.asString(dexFile, parametersOffset)); sb.append(")"); int returnTypeIndex = dexFile.readSmallUint(offset + RETURN_TYPE_OFFSET); String returnType = dexFile.getType(returnTypeIndex); sb.append(returnType); return sb.toString(); }
Example 5
Source File: ProtoIdItem.java From ZjDroid with Apache License 2.0 | 6 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int protoIndex) { int offset = dexFile.getProtoIdItemOffset(protoIndex); StringBuilder sb = new StringBuilder(); sb.append("("); int parametersOffset = dexFile.readSmallUint(offset + PARAMETERS_OFFSET); sb.append(TypeListItem.asString(dexFile, parametersOffset)); sb.append(")"); int returnTypeIndex = dexFile.readSmallUint(offset + RETURN_TYPE_OFFSET); String returnType = dexFile.getType(returnTypeIndex); sb.append(returnType); return sb.toString(); }
Example 6
Source File: MethodIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int methodIndex) { int methodOffset = dexFile.getMethodIdItemOffset(methodIndex); int classIndex = dexFile.readUshort(methodOffset + CLASS_OFFSET); String classType = dexFile.getType(classIndex); int protoIndex = dexFile.readUshort(methodOffset + PROTO_OFFSET); String protoString = ProtoIdItem.asString(dexFile, protoIndex); int nameIndex = dexFile.readSmallUint(methodOffset + NAME_OFFSET); String methodName = dexFile.getString(nameIndex); return String.format("%s->%s%s", classType, methodName, protoString); }
Example 7
Source File: TypeIdItem.java From HeyGirl with Apache License 2.0 | 5 votes |
@Nonnull public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int typeIndex) { try { String typeString = dexFile.getType(typeIndex); return String.format("type_id_item[%d]: %s", typeIndex, typeString); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("type_id_item[%d]", typeIndex); }
Example 8
Source File: MethodIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int methodIndex) { int methodOffset = dexFile.getMethodIdItemOffset(methodIndex); int classIndex = dexFile.readUshort(methodOffset + CLASS_OFFSET); String classType = dexFile.getType(classIndex); int protoIndex = dexFile.readUshort(methodOffset + PROTO_OFFSET); String protoString = ProtoIdItem.asString(dexFile, protoIndex); int nameIndex = dexFile.readSmallUint(methodOffset + NAME_OFFSET); String methodName = dexFile.getString(nameIndex); return String.format("%s->%s%s", classType, methodName, protoString); }
Example 9
Source File: DexlibWrapper.java From JAADAS with GNU General Public License v3.0 | 5 votes |
public void initialize() { try { int api = 1; // TODO: this.dexFile = DexFileFactory.loadDexFile(inputDexFile, api, false); } catch (Exception e) { throw new RuntimeException(e.toString()); } if (dexFile instanceof DexBackedDexFile) { DexBackedDexFile dbdf = (DexBackedDexFile)dexFile; for (int i = 0; i < dbdf.getTypeCount(); i++) { String t = dbdf.getType(i); Type st = DexType.toSoot(t); if (st instanceof ArrayType) { st = ((ArrayType) st).baseType; } Debug.printDbg("Type: ", t ," soot type:", st); String sootTypeName = st.toString(); if (!Scene.v().containsClass(sootTypeName)) { if (st instanceof PrimType || st instanceof VoidType || systemAnnotationNames.contains(sootTypeName)) { // dex files contain references to the Type IDs of void / primitive types - we obviously do not want them to be resolved /* * dex files contain references to the Type IDs of the system annotations. * They are only visible to the Dalvik VM (for reflection, see vm/reflect/Annotations.cpp), and not to * the user - so we do not want them to be resolved. */ continue; } SootResolver.v().makeClassRef(sootTypeName); } SootResolver.v().resolveClass(sootTypeName, SootClass.SIGNATURES); } } else { System.out.println("Warning: DexFile not instance of DexBackedDexFile! Not resolving types!"); System.out.println("type: "+ dexFile.getClass()); } }
Example 10
Source File: TypeIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Nonnull public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int typeIndex) { try { String typeString = dexFile.getType(typeIndex); return String.format("type_id_item[%d]: %s", typeIndex, typeString); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("type_id_item[%d]", typeIndex); }
Example 11
Source File: FieldIdItem.java From zjdroid with Apache License 2.0 | 5 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) { int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex); int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET); String classType = dexFile.getType(classIndex); int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET); String fieldType = dexFile.getType(typeIndex); int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET); String fieldName = dexFile.getString(nameIndex); return String.format("%s->%s:%s", classType, fieldName, fieldType); }
Example 12
Source File: TypeIdItem.java From zjdroid with Apache License 2.0 | 5 votes |
@Nonnull public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int typeIndex) { try { String typeString = dexFile.getType(typeIndex); return String.format("type_id_item[%d]: %s", typeIndex, typeString); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("type_id_item[%d]", typeIndex); }
Example 13
Source File: AnnotationItem.java From HeyGirl with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) { try { DexReader reader = dexFile.readerAt(annotationItemOffset); reader.readUbyte(); int typeIndex = reader.readSmallUleb128(); String annotationType = dexFile.getType(typeIndex); return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("annotation_item[0x%x]", annotationItemOffset); }
Example 14
Source File: AnnotationItem.java From ZjDroid with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) { try { DexReader reader = dexFile.readerAt(annotationItemOffset); reader.readUbyte(); int typeIndex = reader.readSmallUleb128(); String annotationType = dexFile.getType(typeIndex); return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("annotation_item[0x%x]", annotationItemOffset); }
Example 15
Source File: FieldIdItem.java From ZjDroid with Apache License 2.0 | 5 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int fieldIndex) { int fieldOffset = dexFile.getFieldIdItemOffset(fieldIndex); int classIndex = dexFile.readUshort(fieldOffset + CLASS_OFFSET); String classType = dexFile.getType(classIndex); int typeIndex = dexFile.readUshort(fieldOffset + TYPE_OFFSET); String fieldType = dexFile.getType(typeIndex); int nameIndex = dexFile.readSmallUint(fieldOffset + NAME_OFFSET); String fieldName = dexFile.getString(nameIndex); return String.format("%s->%s:%s", classType, fieldName, fieldType); }
Example 16
Source File: AnnotationItem.java From ZjDroid with Apache License 2.0 | 5 votes |
public static String getReferenceAnnotation(@Nonnull DexBackedDexFile dexFile, int annotationItemOffset) { try { DexReader reader = dexFile.readerAt(annotationItemOffset); reader.readUbyte(); int typeIndex = reader.readSmallUleb128(); String annotationType = dexFile.getType(typeIndex); return String.format("annotation_item[0x%x]: %s", annotationItemOffset, annotationType); } catch (Exception ex) { ex.printStackTrace(System.err); } return String.format("annotation_item[0x%x]", annotationItemOffset); }
Example 17
Source File: ClassDefItem.java From zjdroid with Apache License 2.0 | 4 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int classIndex) { int offset = dexFile.getClassDefItemOffset(classIndex); int typeIndex = dexFile.readSmallUint(offset + CLASS_OFFSET); return dexFile.getType(typeIndex); }
Example 18
Source File: ClassDefItem.java From ZjDroid with Apache License 2.0 | 4 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int classIndex) { int offset = dexFile.getClassDefItemOffset(classIndex); int typeIndex = dexFile.readSmallUint(offset + CLASS_OFFSET); return dexFile.getType(typeIndex); }
Example 19
Source File: ClassDefItem.java From HeyGirl with Apache License 2.0 | 4 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int classIndex) { int offset = dexFile.getClassDefItemOffset(classIndex); int typeIndex = dexFile.readSmallUint(offset + CLASS_OFFSET); return dexFile.getType(typeIndex); }
Example 20
Source File: ClassDefItem.java From ZjDroid with Apache License 2.0 | 4 votes |
@Nonnull public static String asString(@Nonnull DexBackedDexFile dexFile, int classIndex) { int offset = dexFile.getClassDefItemOffset(classIndex); int typeIndex = dexFile.readSmallUint(offset + CLASS_OFFSET); return dexFile.getType(typeIndex); }