Other edits ex2
This commit is contained in:
1
mobiotsec2filehasher/.idea/gradle.xml
generated
1
mobiotsec2filehasher/.idea/gradle.xml
generated
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
||||
@@ -10,17 +10,19 @@
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/Theme.Mobiotsec2filehasher">
|
||||
<activity android:name=".HashfileActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<action android:name="com.mobiotsec.intent.action.HASHFILE" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="com.mobiotsec.intent.action.HASHFILE"/>
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/plain" />
|
||||
<data android:scheme="file" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -20,22 +20,11 @@ public class HashfileActivity extends AppCompatActivity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_hashfile);
|
||||
|
||||
Log.d("MOBIOTSEC", "PROVA 0");
|
||||
|
||||
Intent intent = getIntent();
|
||||
|
||||
Log.d("MOBIOTSEC", "PROVA 1");
|
||||
Log.d("MOBIOTSEC", intent.getAction());
|
||||
|
||||
if(intent.getAction() == "com.mobiotsec.intent.action.HASHFILE") {
|
||||
|
||||
String filePath = intent.getData().getPath();
|
||||
Log.d("MOBIOTSEC", filePath);
|
||||
// calculate hash
|
||||
String hash = null;
|
||||
try {
|
||||
|
||||
hash = calcHash(filePath);
|
||||
// calculate hash
|
||||
String hash = calcHash(filePath);
|
||||
|
||||
// return the hash in a "result" intent
|
||||
Intent resultIntent = new Intent();
|
||||
@@ -43,18 +32,18 @@ public class HashfileActivity extends AppCompatActivity {
|
||||
setResult(Activity.RESULT_OK, resultIntent);
|
||||
finish();
|
||||
|
||||
|
||||
}
|
||||
|
||||
static public String calcHash(String filePath) {
|
||||
File file = new File(filePath);
|
||||
byte[] bytes = new byte[0];
|
||||
Log.d("MOBIOTSEC", "HELLOOOOO");
|
||||
try {
|
||||
bytes = FileUtils.readFileToByteArray(file);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static public String calcHash(String filePath) throws IOException {
|
||||
File file = new File(filePath);
|
||||
Log.d("MOBIOTSEC", "PROVA 3");
|
||||
byte[] bytes = FileUtils.readFileToByteArray(file);
|
||||
Log.d("MOBIOTSEC", "PROVA 4");
|
||||
return DigestUtils.sha256Hex(bytes);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.example.maliciousapp;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
public class MainActivity extends AppCompatActivity {
|
||||
|
||||
@@ -10,5 +11,7 @@ public class MainActivity extends AppCompatActivity {
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
Log.d("MOBIOTSEC", "123 HELLOOOOO");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,3 @@
|
||||
--------- beginning of main
|
||||
--------- beginning of system
|
||||
--------- beginning of kernel
|
||||
03-04 14:10:11.909 15435 15435 I MOBIOTSEC: /storage/emulated/0/YM3oPnYG.dat
|
||||
--------- beginning of crash
|
||||
|
||||
Reference in New Issue
Block a user