-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*.iml | ||
.gradle | ||
/local.properties | ||
/.idea/workspace.xml | ||
/.idea/libraries | ||
.DS_Store | ||
/build | ||
/captures |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 23 | ||
buildToolsVersion "23.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.jni.anto.kalip" | ||
minSdkVersion 19 | ||
targetSdkVersion 23 | ||
versionCode 1 | ||
versionName "1.0" | ||
} | ||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
testCompile 'junit:junit:4.12' | ||
compile 'com.android.support:appcompat-v7:23.3.0' | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Add project specific ProGuard rules here. | ||
# By default, the flags in this file are appended to flags specified | ||
# in /Users/anto/Library/Android/sdk/tools/proguard/proguard-android.txt | ||
# You can edit the include path and order by changing the proguardFiles | ||
# directive in build.gradle. | ||
# | ||
# For more details, see | ||
# http://developer.android.com/guide/developing/tools/proguard.html | ||
|
||
# Add any project specific keep options here: | ||
|
||
# If your project uses WebView with JS, uncomment the following | ||
# and specify the fully qualified class name to the JavaScript interface | ||
# class: | ||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview { | ||
# public *; | ||
#} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.jni.anto.kalip; | ||
|
||
import android.app.Application; | ||
import android.test.ApplicationTestCase; | ||
|
||
/** | ||
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> | ||
*/ | ||
public class ApplicationTest extends ApplicationTestCase<Application> { | ||
public ApplicationTest() { | ||
super(Application.class); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.jni.anto.kalip"> | ||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> | ||
|
||
<application | ||
android:allowBackup="true" | ||
android:icon="@mipmap/ic_launcher" | ||
android:label="@string/app_name" | ||
android:supportsRtl="true" | ||
android:theme="@style/AppTheme"> | ||
<activity android:name=".MainActivity"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
|
||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
package com.jni.anto.kalip; | ||
|
||
import android.os.Bundle; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.view.View; | ||
import android.widget.Button; | ||
import android.widget.Toast; | ||
import android.content.Context; | ||
import android.telephony.TelephonyManager; | ||
import java.io.File; | ||
import android.util.Log; | ||
import javax.crypto.Cipher; | ||
import javax.crypto.spec.SecretKeySpec; | ||
import javax.crypto.*; | ||
import java.security.*; | ||
|
||
|
||
public class MainActivity extends AppCompatActivity { | ||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.activity_main); | ||
|
||
Button device_id = (Button) findViewById(R.id.button); | ||
device_id.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
public void onClick(View v) { | ||
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); | ||
Toast.makeText(getApplicationContext(), tm.getDeviceId(), Toast.LENGTH_SHORT).show(); | ||
//get The Phone Number | ||
//String phone = tm.getLine1Number(); | ||
} | ||
|
||
}); | ||
|
||
Button filecheck = (Button) findViewById(R.id.button2); | ||
filecheck.setOnClickListener(new View.OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
|
||
File file = new File("/sdcard/test"); | ||
if (file.exists()) { | ||
Toast.makeText(getApplicationContext(), "File Exist", Toast.LENGTH_SHORT).show(); | ||
} else { | ||
Toast.makeText(getApplicationContext(), "File Doesnt Exist", Toast.LENGTH_SHORT).show(); | ||
} | ||
} | ||
}); | ||
|
||
Button rootdetect = (Button) findViewById(R.id.button3); | ||
rootdetect.setOnClickListener(new View.OnClickListener() { | ||
|
||
@Override | ||
public void onClick(View v) { | ||
if (isPhoneRooted()) { | ||
Toast.makeText(getApplicationContext(), "Phone Rooted", Toast.LENGTH_LONG).show(); | ||
}else{ | ||
Toast.makeText(getApplicationContext(),"Phone Not Rooted",Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
} | ||
|
||
}); | ||
|
||
|
||
Button stringDude = (Button) findViewById(R.id.button4); | ||
stringDude.setOnClickListener(new View.OnClickListener(){ | ||
@Override | ||
public void onClick(View v){ | ||
dude("yaay from string args !"); | ||
|
||
} | ||
}); | ||
|
||
|
||
Button charDude = (Button) findViewById(R.id.button5); | ||
charDude.setOnClickListener(new View.OnClickListener(){ | ||
@Override | ||
public void onClick(View v){ | ||
char[] array = new char[26]; | ||
int index = 0; | ||
for (char c = 'a'; c <= 'z'; c++) { | ||
array[index++] = c; | ||
} | ||
dude(array); | ||
|
||
} | ||
}); | ||
|
||
|
||
Button encrypt = (Button) findViewById(R.id.button6); | ||
encrypt.setOnClickListener(new View.OnClickListener(){ | ||
@Override | ||
public void onClick(View v){ | ||
try{ | ||
|
||
|
||
byte[] b = "hahaha".getBytes(); | ||
|
||
byte[] keyStart = "this is a key".getBytes(); | ||
KeyGenerator kgen = KeyGenerator.getInstance("AES"); | ||
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); | ||
sr.setSeed(keyStart); | ||
kgen.init(128, sr); // 192 and 256 bits may not be available | ||
SecretKey skey = kgen.generateKey(); | ||
byte[] key = skey.getEncoded(); | ||
|
||
// encrypt | ||
encrypt(key,b); | ||
|
||
|
||
}catch (Exception e){ | ||
Log.d("BUGG",e.toString()); | ||
} | ||
|
||
} | ||
}); | ||
} | ||
|
||
public static boolean isPhoneRooted() { | ||
|
||
// get from build info | ||
String buildTags = android.os.Build.TAGS; | ||
if (buildTags != null && buildTags.contains("test-keys")) { | ||
return true; | ||
} | ||
|
||
// check if /system/app/Superuser.apk is present | ||
try { | ||
File file = new File("/system/app/Superuser.apk"); | ||
if (file.exists()) { | ||
return true; | ||
} | ||
} catch (Throwable e1) { | ||
// ignore | ||
} | ||
|
||
return false; | ||
} | ||
|
||
|
||
public void dude(String a){ | ||
Toast.makeText(getApplicationContext(),a.toString(),Toast.LENGTH_LONG).show(); | ||
} | ||
public void dude(char[] a){ | ||
|
||
Toast.makeText(getApplicationContext(),new String(a),Toast.LENGTH_LONG).show(); | ||
} | ||
|
||
public void encrypt(byte[] raw, byte[] clear) throws Exception { | ||
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); | ||
Cipher cipher = Cipher.getInstance("AES"); | ||
cipher.init(Cipher.ENCRYPT_MODE, skeySpec); | ||
byte[] encrypted = cipher.doFinal(clear); | ||
Toast.makeText(getApplicationContext(),new String(encrypted),Toast.LENGTH_SHORT).show(); | ||
} | ||
|
||
public byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { | ||
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES"); | ||
Cipher cipher = Cipher.getInstance("AES"); | ||
cipher.init(Cipher.DECRYPT_MODE, skeySpec); | ||
byte[] decrypted = cipher.doFinal(encrypted); | ||
return decrypted; | ||
} | ||
} |