Edit ex2, not working yet

This commit is contained in:
Mariano Sciacco
2021-03-04 15:10:52 +01:00
parent bfa55c2c94
commit 6ddfaf5d97
4 changed files with 13 additions and 17 deletions

View File

@@ -12,7 +12,7 @@
<activity android:name=".HashfileActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<action android:name="com.mobisec.intent.action.HASHFILE" />
<action android:name="com.mobiotsec.intent.action.HASHFILE" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

View File

@@ -25,8 +25,9 @@ public class HashfileActivity extends AppCompatActivity {
Intent intent = getIntent();
Log.d("MOBIOTSEC", "PROVA 1");
Log.d("MOBIOTSEC", intent.getAction());
//if(intent.getAction() == "com.mobiotsec.intent.action.HASHFILE") {
if(intent.getAction() == "com.mobiotsec.intent.action.HASHFILE") {
String filePath = intent.getData().getPath();
Log.d("MOBIOTSEC", filePath);
@@ -36,8 +37,6 @@ public class HashfileActivity extends AppCompatActivity {
hash = calcHash(filePath);
// return the hash in a "result" intent
Intent resultIntent = new Intent();
resultIntent.putExtra("hash", hash);
@@ -48,18 +47,15 @@ public class HashfileActivity extends AppCompatActivity {
e.printStackTrace();
}
//}
}
}
static public String calcHash(String filePath) throws IOException {
File file = new File(filePath);
if(file.exists()) {
Log.d("MOBIOTSEC", "PROVA 3");
return DigestUtils.sha256Hex(FileUtils.readFileToByteArray(file));
}
else
Log.d("MOBIOTSEC", "Errore");
Log.d("MOBIOTSEC", "PROVA 3");
byte[] bytes = FileUtils.readFileToByteArray(file);
Log.d("MOBIOTSEC", "PROVA 4");
return DigestUtils.sha256Hex(bytes);
return "prova";
}
}

3
mobiotsec2filehasher/filehasher/filehasher_checker.py Normal file → Executable file
View File

@@ -4,6 +4,8 @@
# ~/Android/Sdk/tools/avdmanager create avd --force --name mobiotsec --abi google_apis/x86 --package 'system-images;android-26;google_apis;x86'
# ~/Android/Sdk/emulator/emulator -avd mobiotsec -no-audio -no-boot-anim -accel on -gpu swiftshader_indirect &
# TODO check if the emulator is already running
import argparse
import os
import shutil
@@ -62,6 +64,7 @@ def main(args):
uninstall(malApk)
install(malApk)
launch_app(victimApk)
#time.sleep(2)
print_logs()
if __name__ == "__main__":

View File

@@ -1,8 +1,5 @@
--------- beginning of main
--------- beginning of system
--------- beginning of kernel
03-04 12:36:43.827 13072 13072 I MOBIOTSEC: /storage/emulated/0/YM3oPnYG.dat
03-04 12:36:45.489 13095 13095 D MOBIOTSEC: PROVA 0
03-04 12:36:45.489 13095 13095 D MOBIOTSEC: PROVA 1
03-04 12:36:45.489 13095 13095 D MOBIOTSEC: /storage/emulated/0/YM3oPnYG.dat
03-04 12:36:45.489 13095 13095 D MOBIOTSEC: PROVA 3
03-04 14:10:11.909 15435 15435 I MOBIOTSEC: /storage/emulated/0/YM3oPnYG.dat
--------- beginning of crash