Commit
- Loading branch information
There are no files selected for viewing
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.
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 |
---|---|---|
@@ -1 +1,3 @@ | ||
# LifeBoxApp | ||
# LifeBoxApp | ||
|
||
LifeBoxApp is a lifelogging and sousveillance app that captures audio 24/7 on your Android device and uploads it to your personal Dropbox account. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apply plugin: 'com.android.application' | ||
|
||
android { | ||
compileSdkVersion 16 | ||
buildToolsVersion "23.0.3" | ||
|
||
defaultConfig { | ||
applicationId "com.lifebox.lifeboxapp" | ||
minSdkVersion 16 | ||
targetSdkVersion 16 | ||
compileOptions { | ||
sourceCompatibility JavaVersion.VERSION_1_5 | ||
targetCompatibility JavaVersion.VERSION_1_5 | ||
} | ||
} | ||
|
||
buildTypes { | ||
release { | ||
minifyEnabled false | ||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' | ||
} | ||
} | ||
} | ||
|
||
dependencies { | ||
compile 'com.android.support:support-v4:18.0.0' | ||
compile files('libs/dropbox-android-sdk-1.5.1.jar') | ||
compile files('libs/httpclient-4.0.3.jar') | ||
compile files('libs/httpcore-4.0.1.jar') | ||
compile files('libs/httpmime-4.0.3.jar') | ||
compile files('libs/json_simple-1.1.jar') | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<lint> | ||
</lint> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.lifebox.lifeboxapp" | ||
android:versionCode="6" | ||
android:versionName="0.1.5" | ||
android:allowBackup="false" > | ||
|
||
<uses-sdk | ||
android:minSdkVersion="16" | ||
android:targetSdkVersion="16" /> | ||
|
||
<supports-screens | ||
android:smallScreens="true" | ||
android:normalScreens="true" | ||
android:largeScreens="true" | ||
android:xlargeScreens="true" | ||
android:anyDensity="true"/> | ||
|
||
<uses-permission android:name="android.permission.INTERNET" /> | ||
<uses-permission android:name="android.permission.RECORD_AUDIO" /> | ||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> | ||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | ||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | ||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
|
||
<uses-feature android:name="android.hardware.wifi" /> | ||
|
||
<application | ||
android:icon="@drawable/icon" | ||
android:label="@string/app_name" > | ||
<activity | ||
android:name="com.lifebox.lifeboxapp.LifeBoxAppMain" | ||
android:alwaysRetainTaskState="false" | ||
android:label="LifeBox" | ||
android:launchMode="standard" | ||
android:screenOrientation="portrait" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.lifebox.lifeboxapp.Settings" | ||
android:alwaysRetainTaskState="false" | ||
android:label="Settings" | ||
android:launchMode="standard" | ||
android:exported="false" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
</intent-filter> | ||
</activity> | ||
<activity | ||
android:name="com.dropbox.client2.android.AuthActivity" | ||
android:configChanges="orientation|keyboard" | ||
android:launchMode="singleTask" > | ||
<intent-filter> | ||
<data android:scheme="db-INSERT_APP_KEY" /> | ||
|
||
<action android:name="android.intent.action.VIEW" /> | ||
|
||
<category android:name="android.intent.category.BROWSABLE" /> | ||
<category android:name="android.intent.category.DEFAULT" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<service android:name=".RecordingService" > | ||
</service> | ||
|
||
<receiver | ||
android:name=".RecordingServiceBroadcastReceiver" | ||
android:enabled="true" | ||
android:exported="false" | ||
android:label="LifeBoxRecordingServiceBroadcastReciever" > | ||
<intent-filter> | ||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
</intent-filter> | ||
</receiver> | ||
</application> | ||
|
||
</manifest> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package com.lifebox.lifeboxapp; | ||
|
||
import android.util.Base64; | ||
|
||
import javax.crypto.Cipher; | ||
import javax.crypto.SecretKeyFactory; | ||
import javax.crypto.spec.PBEKeySpec; | ||
import javax.crypto.spec.SecretKeySpec; | ||
|
||
public class Crypto { | ||
private byte[] keyBytes; | ||
|
||
public Crypto(String key) throws Exception { | ||
keyBytes = Base64ToByte(key); | ||
} | ||
|
||
public byte[] encrypt(byte[] plainText) throws Exception { | ||
Cipher cipher = getCipher(Cipher.ENCRYPT_MODE); | ||
return cipher.doFinal(plainText); | ||
} | ||
|
||
public byte[] decrypt(byte[] encrypted) throws Exception { | ||
Cipher cipher = getCipher(Cipher.DECRYPT_MODE); | ||
return cipher.doFinal(encrypted); | ||
} | ||
|
||
private Cipher getCipher(int cipherMode) throws Exception { | ||
String encryptionAlgorithm = "AES"; | ||
SecretKeySpec keySpecification = new SecretKeySpec(keyBytes, encryptionAlgorithm); | ||
Cipher cipher = Cipher.getInstance(encryptionAlgorithm); | ||
cipher.init(cipherMode, keySpecification); | ||
return cipher; | ||
} | ||
|
||
public static String makeKey(String password, String salt) throws Exception { | ||
PBEKeySpec spec = new PBEKeySpec(password.toCharArray(), salt.getBytes("UTF-8"), 1000, 128); | ||
SecretKeyFactory skf; | ||
skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); | ||
byte[] key = skf.generateSecret(spec).getEncoded(); | ||
return ByteToBase64(key); | ||
} | ||
|
||
public static String ByteToBase64(byte[] input) { | ||
return Base64.encodeToString(input, Base64.DEFAULT); | ||
} | ||
|
||
public static byte[] Base64ToByte(String input) { | ||
return Base64.decode(input, Base64.DEFAULT); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// http://android-developers.blogspot.com.au/2011/03/identifying-app-installations.html | ||
|
||
package com.lifebox.lifeboxapp; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.RandomAccessFile; | ||
import java.util.UUID; | ||
|
||
import android.content.Context; | ||
|
||
public class Installation { | ||
private static String sID = null; | ||
private static final String INSTALLATION = "INSTALLATION"; | ||
|
||
public synchronized static String id(Context context) { | ||
if (sID == null) { | ||
File installation = new File(context.getFilesDir(), INSTALLATION); | ||
try { | ||
if (!installation.exists()) | ||
writeInstallationFile(installation); | ||
sID = readInstallationFile(installation); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
return sID; | ||
} | ||
|
||
private static String readInstallationFile(File installation) throws IOException { | ||
RandomAccessFile f = new RandomAccessFile(installation, "r"); | ||
byte[] bytes = new byte[(int) f.length()]; | ||
f.readFully(bytes); | ||
f.close(); | ||
return new String(bytes); | ||
} | ||
|
||
private static void writeInstallationFile(File installation) throws IOException { | ||
FileOutputStream out = new FileOutputStream(installation); | ||
String id = UUID.randomUUID().toString(); | ||
out.write(id.getBytes()); | ||
out.close(); | ||
} | ||
} |