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"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
|
|||||||
@@ -10,17 +10,19 @@
|
|||||||
android:supportsRtl="true"
|
android:supportsRtl="true"
|
||||||
android:theme="@style/Theme.Mobiotsec2filehasher">
|
android:theme="@style/Theme.Mobiotsec2filehasher">
|
||||||
<activity android:name=".HashfileActivity">
|
<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>
|
||||||
<activity android:name=".MainActivity">
|
<activity android:name=".MainActivity">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
</intent-filter>
|
</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>
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
</manifest>
|
</manifest>
|
||||||
@@ -20,22 +20,11 @@ public class HashfileActivity extends AppCompatActivity {
|
|||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_hashfile);
|
setContentView(R.layout.activity_hashfile);
|
||||||
|
|
||||||
Log.d("MOBIOTSEC", "PROVA 0");
|
|
||||||
|
|
||||||
Intent intent = getIntent();
|
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();
|
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
|
// return the hash in a "result" intent
|
||||||
Intent resultIntent = new Intent();
|
Intent resultIntent = new Intent();
|
||||||
@@ -43,18 +32,18 @@ public class HashfileActivity extends AppCompatActivity {
|
|||||||
setResult(Activity.RESULT_OK, resultIntent);
|
setResult(Activity.RESULT_OK, resultIntent);
|
||||||
finish();
|
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) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
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);
|
return DigestUtils.sha256Hex(bytes);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.example.maliciousapp;
|
|||||||
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity {
|
public class MainActivity extends AppCompatActivity {
|
||||||
|
|
||||||
@@ -10,5 +11,7 @@ public class MainActivity extends AppCompatActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_main);
|
setContentView(R.layout.activity_main);
|
||||||
|
|
||||||
|
Log.d("MOBIOTSEC", "123 HELLOOOOO");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
--------- beginning of main
|
--------- beginning of main
|
||||||
--------- beginning of system
|
--------- beginning of system
|
||||||
--------- beginning of kernel
|
--------- 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