Hack. Eat. Sleep. Repeat!!!
adb shell pm list packages
to list packagesadb shell pm path <path>
to get pathadb pull <path> <destination>
to copy it.31415
drozer console connect --server <ip-addr>
nox-player
,you should portforward with adb
or Android Debug Bridge
.Syntax-: adb forward tcp:<port> tcp:<port>
app.package.list
Syntax-:run app.package.list -f <package>
app.package.info
Syntax-:run app.package.info -a <package's identifier>
app.package.attacksurface
, if an app is debuggable,we can add adb and step through the code.Syntax-:run app.package.attacksurface <identifier>
app.activity.info
Syntax-:run app.activity.info -a <identifier>
help [module]
to check on more info on a module.app.package.info
, an exported activity com.mwr.example.sieve.PWList
can be carried without authorization or permission.We will use app.package.start
to start it and exploit the activity.Syntax-: run app.activity.start --component [identifier] [activity]
app.provider.info
can be used to gather the content information exported from the app.Syntax-:run app.provider.info -a [identifier]
scanner.provider.finduris
to scan for multiple urls and define a list of possible urlsSyntax-:run scanner.provider.finduris -a [identifier]
app.provider.query
to grab the secretsSyntax-:run app.provider.query content://[url]
run app.provider.insert <content uris> --string pin 1111 --string Password H4ck3d
run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Keys/
scanner.provider.sqltables
to view the sql tables of a server.Syntax-:run scanner.provider.sqltables -a <identifier>
app.provider.query
Syntax-:run app.provider.query <content uri> --projection "* FROM SQLITE_MASTER where type=âtableâ;--"
run app.provider.query content://com.mwr.example.sieve.DBContentProvider/Keys/ --selection "1 or 1=1"
Syntax-:run app.provider.read content://com.mwr.example.sieve.FileBackupProvider/etc/hosts
apktool d -rs <apk>
d2j-dex2jar <classes.dex>
jadx-gui <classes.jar>
Zygote
and its role in firing up an application.app_process()
launches the Zygote, first a VM instance is created and then a call to Zygoteâs main()
is made.Android_servers
that provides interfaces to native functionalities.Check this repo to install android-sdk.
Syntax-:objection patchapk -s <apk's name>
On linux, if you noticed an error mostly in red
,download apktool from the source and install.It is due to the dirty
version.
Newly signed apk
adb install <apk>
ART
or Android Runtime
.Android users had the opportunity to choose between Dalvik
and ART
in Android 4.4.The .class
generated contains the JVM class bytecodes.Android has its own optimized bytecode fromat called the Dalvik
from version 1.0 to 4.4.Dalvik bytecodes are instructions set for a processor..class
and .jar
libraries into a single .dex
file containing dalvik byte codes.This is possible with the dx command.DEX
means Dalvik Executable
.ART
in Android 4.4
.This execution environment executes dex properly.The benefit of ART over Dalvik is that the app runs and launches faster on ART, this is because DEX bytecode has been translated into machine code during installation, no extra time is needed to compile it during the runtime.The JIT based compilation in the previously used Dalvik has disadvantages of poor battery life, application lag, and performance.ART is based on the Ahead-of-Time
compilaton process where compilation begins before a process starts.In ART, the compilation process happens during the app installation process itself. Even though this leads to higher app installation time, it reduces app lag, increases battery usage efficiency, etc.In Android version 7.0, JIT came back. The hybrid environment combining features from both a JIT compiler and ART was introduced.src
folders stores the java and kotlin source codeAndroid Interface Definition Language [AIDL]
allows you to define the programming interface for client and service communication using IPC
.IPC
is inter process communication.AIDL can be used between any process in Android.Library modules
contains java or kotlin classes, Android Components and resoures, although assets are not supported.The codes and resources of the library project are compiled and packaged with the application.Therefore, an library module can be a compile time artifact.Android library
compiles into an Android Archive (AAR)
file that you can use as a dependency for an Android app module.AAR files can contain Android resources and a manifest file, which allows you to bundle in shared resources like layouts and drawables in addition to Java or Kotlin classes and methods.JAR Libraries
is a Java library and unlike AAR it cannot contain Android resources and manifests.Android Asset Packaging Tool (aapt2)
compiles the AndroidManifest and resource files into a single apk.It is divided into two steps compiling
and linking
.It improves performance since it is only one file changes.You only need to compile one file and link with the intermediate files.It also support android file resources like drawables and xml.When you invoke AAPT2 for compilation, you should pass a single resource file as an input per invocation.AAPT2 then parses the file and generates an intermediate binary file with a .flat extension.The link phase merges all the intermediate files generated in the compile phase and outputs one .apk file. You can also generate R.java and proguard-rules at this time.Resources.arsc
: The output .apk file does not include the DEX file, so the DEX file is not included, and since it is not signed, it is an APK that cannot be executed.It contains the metadata information of the resourses such as the index of all resources in the packages.An apk is a binary file,and the APK that can be actually executed, and the APK that you often build and execute are uncompressed and can be used simply by expanding it in memory.The R.java that is output with the APK is assigned a unique ID, which allows the Java code to use the resource during compilation as seen below.Arsc
is the index of the resource used when executing the application.Dex and Multidex
-:R8
compiles one file known as the classes.dex
.If you are using Multidex, that is not the case, but multiple DEX files will appear, but for the time being, classes.dex will be created.If the number of application method exceeeds 65536
including the reference libraries, a build error will occur.The method ID range is 0 to 0xFFFF[0 to 65535].In order to avoid this, it is useful to review the dependency of the application and use R8 to remove unused code or use Multidex.e.gHello world
code in java-:public class Hello {
public static void main(String[] args){
System.out.println("Hello world!!");
}
}
//
//TODO-:
java file.java
public class Hello {
public static void main(String[] args){
System.out.println("Hello world!!");
//Number
int number = -5;
System.out.println(number);
}
}
long
keyword can also be used to store integers and can store up 2 ^ 63
.long number = 5;
System.out.println(num);
float
or double
public class Hello {
public static void main(String[] args){
System.out.println("Hello world!!");
//Number
int number = -5;
System.out.println(number);
long num = 5;
System.out.println(num);
double myDouble = 2.5;
//float
float myFloat = (float) 2.9;
System.out.println(myDouble);
System.out.println(myFloat);
}
}
char
to store unicode valueschar myUnicodeChar = '\u00A9';
System.out.println(myChar);
System.out.println(myUnicodeChar);
String
for charactersString myString = "Meisma";
Boolean
for true
or false
Boolean myBool = true;
int
or long
to hold huge numbers, double
can also be used.int a = 5;
int b = 10;
double answer = (double) a / b ;
System.out.println(answer);
String
in javaString string1 = "Man";
String string2 = "go";
System.out.println(string1 + string2);
int num = 9;
if (num>10) {
System.out.println("Greater than 10");
} else {
Systemm.out.println("Lesser thn 10");
}
switch (num) {
case 10:
System.out.println("Wrong");
break;
case 9:
System.out.println("Correct");
break;
default:
System.out.println("LMAO!!!");
break;
}
public class Main {
public static void main(String[] args) {
int num = 0;
while (true) {
num+=1;
System.out.println("Hello");
if (num == 7) {
System.out.println("Life is hard");
break;
}
}
}
}
break
and continue
in a while
loopdo
statementdo{
System.out.println("Milk");
} while (x<5);
scanner
is used to input a number.You have to import the class Scanner
from java.util.Scanner
.import java.util.Scanner;
public class Main {
public static void main(String[] args) {
System.out.println("Enter a number: ");
Scanner myScanner = Scanner(System.in);
int answer = new myScanner.nextInt(); //nextInt() should be used for a number
System.out.println("The answer is :" + answer);
}
}
String string = new myScanner.next();
JOptionPane
class.Import withimport javax.swing.JOptionPane;
showInputDialog
method -:import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String first_name;
first_name = JOptionPane.showInputDialog("FirstName");//showInputDialog
System.out.println(first_name);
}
}
showMessageDialog
method to display the resultimport javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
String first_name,second_name,full_name;
first_name = JOptionPane.showInputDialog("FirstName-: ");//showInputDialog
second_name = JOptionPane.showInputDialog("SecondName-: ");
//full_name
full_name = "Your name is "+ first_name + " " + second_name;
JOptionPane.showMessageDialog(null,full_name);
System.exit(0);
}
}
showMessageDialog
.Syntax-:JOptionPane.showMessageDialog(null,full_name,"Name",JOptionPane.INFORMATION_MESSAGE);
ERROR_MESSAGE
PLAIN_MESSAGE
QUESTION_MESSAGE
WARNING_MESSAGE
Random
.import java.util.Random;
public class Main {
public static void main(String[] args){
System.out.println("Random numbers");
Random random = new Random();
int number = random.nextInt();
System.out.println(number);
}
}
int number = random.nextInt(20); //The argument 20 is the limit
Simple Arrays
-:public class Main {
public static void main(String[] args) {
//Arrays in java
String[] students = {"Meisam","Zombies","Daddy","Great","Deadbeat"};
System.out.println(students[0]);
}
}
public class Main {
public static void main(String[] args) {
//Arrays in java
String[] students = new String[5]; //Defining the amount of memory
students[0] = "Meisam";
students[1] = "Sarah";
System.out.println(students[0]);
}
}
for
looppublic class Main {
public static void main(String[] args) {
//Arrays in java
String[] students = new String[5];
students[0] = "Meisam";
students[1] = "Sarah";
students[2] = "Sarah";
students[3] = "Sarah";
students[4] = "Sarah";
for (int i=0; i<5; i++) {
System.out.println(students[i]);
}
}
}
length
classpublic class Main {
public static void main(String[] args) {
//Arrays in java
String[] students = new String[5];
students[0] = "Meisam";
students[1] = "Sarah";
students[2] = "Sarah";
students[3] = "Sarah";
students[4] = "Sarah";
System.out.println("[+] Array's length is : " + students.length);
for (int i=0; i<students.length; i++) {
System.out.println(students[i]);
}
}
}
Phone.java
public class Phone {
String name;
int phoneNumber;
int userSignature;
String userModel;
String imeiString;
}
main
classpublic class Main {
public static void main(String[] args) {
Phone iphone = new Phone();//Creating an instance of a class
//Attributes
iphone.name = "Iphone 11";
iphone.phoneNumber = "08109978500";
//Accessing the field of a class
System.out.println(iphone.name);
}
}
public void Name(String me)
public class Phone {
String name;
String phoneNumber;
//Creating a methodd
//If you don't want to return any value, use the keyword void as seen below
public void printString(String trackName) {
System.out.println("Playing track :" + trackName);
}
}
iphone.printString("Bahubali");
Access modifiers
helps to restrict the scope of a class, constructor, variable, method, or data member. It provides security, accessibility, etc. to the user depending upon the access modifier used with the element.It can be public
, private
, default
and protected
.If you donât use anything as the modifier,it is public
.public class Phone {
String name;
String phoneNumber;
//Use of access modifiers
public String model = "SM-1234";
System.out.println(iphone.model);
private
fields can be accessed by a method in the classpublic class Phone {
String name;
String phoneNumber;
//Use of access modifiers
private String model = "SM-1234";
//Creating a methodd
//If you don't want to return any value, use the keyword void as seen below
public void printString(String trackName) {
System.out.println("Playing track :" + trackName);
}
public void accessPrivateField() {
System.out.println(model);
}
}
public class Phone {
private String name;
String phoneNumber;
//Use of access modifiers
private String model = "SM-1234";
//Creating a methodd
//If you don't want to return any value, use the keyword void as seen below
public void printString(String trackName) {
System.out.println("Playing track :" + trackName);
}
public void accessPrivateField() {
System.out.println(model);
}
//set class field 'name'
public void setName(String name){
this.name = name;
}
//return class field name
public String getName() {
return this.name;
}
}
public class Main {
public static void main(String[] args) {
Phone iphone = new Phone();//Creating an instance of a class
//Attributes
//iphone.name = "Iphone 11";
iphone.phoneNumber = "08109484844978500";
//Accessing the field of a class
//System.out.println(iphone.name);
iphone.accessPrivateField();
iphone.printString("Bahubali");
iphone.setName("Iphone 22");
//System.out.println(iphone.name);
System.out.println(iphone.getName());
}
}
public Phone(String name,String phoneNumber) {
this.name = this.name;
this.phoneNumber = phoneNumber;
this.model = "SM-1234";
}
SuperClass Animal-:
public class Animal {
private String name;
private String typeA;
private int legNumbers;
private Boolean hasTail;
public Animal(String name,String typeA,int legNumber,Boolean hasTail) {
this.name = name;
this.typeA = typeA;
this.legNumbers = legNumber;
this.hasTail = hasTail;
}
public void setName(String name) {
this.name = name;
}
public void setTypeA(String name) {
this.typeA = typeA;
}
}
Bird
-:Fields are passed to the super class Animal
with super()
objectpublic class Bird extends Animal {
public Bird(String name,String typeA,int legNumber,Boolean hasTail){
super(name,typeA,legNumber,hasTail);
}
}
Bird
//Bird
public class Main{
public static void main(String[] args) {
//Instatiating our Bird class
Bird phoenix = new Bird("Bangis","Parrot",10,true);
//Setting a Name
phoenix.setName("Hawk");
//Accessing the superclass function
System.out.println(phoenix.getName());
}
}
public class Bird extends Animal {
private int wings;
public Bird (String name,String typeA,int legNumber,Boolean hasTail,int wings){
super(name,typeA,legNumber,hasTail);
this.wings = wings;
}
public void canFly() {
if (this.wings > 0) {
System.out.println("[+]Can fly");
} else {
System.out.println("[+]Cannot fly");
}
}
public void setWings(int wings) {
this.wings = wings;
}
public int getWings() {
return this.wings;
}
}
@Override
keyword.Animal class-:
public void eat(String food) {
System.out.println(this.name + " eats " + food);
}
Bird Class-:
@Override
public void eat(String food) {
super.eat(food);
}
public void canFly() {
if (this.wings > 0) {
System.out.println("[+]Can fly");
} else {
System.out.println("[+]Cannot fly");
}
}
public void canFly(int wings){
if (wings > 0) {
System.out.println("[+]Can fly");
} else {
System.out.println("[+]Cannot fly");
}
}
Null
keywordfinal
keyword is used to create a constant.final String x = "Sleep";
x = "sleep";
System.out.println(x);
import java.util.ArrayList
Arraylist
ArrayList<String> names = new ArrayList<>();
names.add("Meisam");
names.add("Sarah");
get()
names.get(0);
ArrayList
names.size();
contains
to check if an Arraylist
contains a value,It will return a boolean
.names.contains("Shayla");
remove()
names.remove("Value");
names.indexOf("Shayla");
isEmpty
functionnames.isEmpty()
Map
import java.util.Map;
map
but to instantiate object HashMap
, use import java.util.HashMap
//<> contains the data type for the key and value
Map<String,String> contacts = new HashMap<String, String>();
put()
contacts.put("Meisam","08109978500");
get()
contacts.get("Meisam");
contacts.size()
contacts.remove("Meisam");
containsKey()
and containsValue()
contacts.containsKey("Me");
contacts.containsValue("08109978585858558");
for (type var : array) {
statements using var;
}
static
keyword is a dded to a field, it does work for instance of the object but the object itself.It should not be added to the constructor the class.e.gpublic class Student {
public static String name;
private int id;
private String falseName;
public Student(int id,String falseName) {
this.id = id;
}
public void setName(String name){
this.name = name;
}
public void setId(int id){
this.id = id;
}
public void setFalseName(String falseName) {
this.falseName = falseName;
}
public String getName(){
return this.name;
}
public int getId(){
return this.id;
}
public String getFalseName(){
return this.falseName;
}
}
public class Main {
public static void main(String[] args) {
Student student = new Student(10,"Sarah");
student.setName("Lame");
System.out.println(student.getName());
}
}
static
keyword can be changed by calling the Class directly.The static
method is memory friendly and can be ensure memory handling.Student.name = "Kris";
public class Student {
private int id;
private String name;
public class innerClass {
private int innerId;
private String innerName;
public innerClass(int innerId,String innerName) {
this.innerId = innerId;
this.innerName = innerName;
}
}
}
Student.innerClass inner = new Student().new innerClass(1,"Name");
frida --codeshare sahabrifki/okhttp3-obfuscated---ssl-pinning-bypass -f "package-name" -U
frida --codeshare akabe1/frida-multiple-unpinning -f "package-name" -U
adb push cacert.cer /data/local/tmp/root.cer
C:\Program Files (x86)\Nox\bin\nox_adb.exe