Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Verified Commit af166696 authored by Marvin W.'s avatar Marvin W. 🐿️
Browse files

Update droidguasso



Includes parts of #29

Co-authored-by: default avatartacticalDevC <tacticaldevc@tutanota.com>
parent b9b273ce
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -9,3 +9,5 @@ build/
user.gradle
local.properties
.directory
.idea/
/scripts/decrypt.class
(12.8 KiB)

File changed.

No diff preview for this file type.

scripts/decrypt.java

0 → 100644
+48 −0
Original line number Diff line number Diff line
/*
 * SPDX-FileCopyrightText: 2016, microG Project Team
 * SPDX-License-Identifier: Apache-2.0
 */

import java.io.InputStream;
import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.security.spec.AlgorithmParameterSpec;
import java.security.Key;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import javax.crypto.Cipher;
import java.io.File;
import java.io.IOException;

public class decrypt {
  public static void main(String[] args) throws Exception {
    IvParameterSpec iv = new IvParameterSpec(new byte[] { 1, 33, 13, 28, 87, 122, 25, 5, 4, 30, 22, 101, 5, 50, 12, 0 });
    byte[] key = new byte[16];
    byte[] bytes = "96a176a2e35d8ae4".getBytes();
    for (int n = 0; n < 16 && n < bytes.length; ++n) {
      key[n] = bytes[n];
    }
    SecretKeySpec k = new SecretKeySpec(key, "AES");
    Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
    c.init(2, k, iv);
    byte[] res = c.doFinal(readStreamToEnd(new FileInputStream(new File(args[0]))));
    FileOutputStream fos = new FileOutputStream(new File(args[1]));
    fos.write(res);
    fos.close();
  }

  public static byte[] readStreamToEnd(final InputStream is) throws IOException {
    final ByteArrayOutputStream bos = new ByteArrayOutputStream();
    if (is != null) {
      final byte[] buff = new byte[1024];
      int read;
      do {
        bos.write(buff, 0, (read = is.read(buff)) < 0 ? 0 : read);
      } while (read >= 0);
      is.close();
    }
    return bos.toByteArray();
  }
}
+48 −0
Original line number Diff line number Diff line
#!/bin/sh
# SPDX-FileCopyrightText: 2016, microG Project Team
# SPDX-License-Identifier: Apache-2.0

SCRIPT=`readlink -f "$0"`
SCRIPTPATH=`dirname "$SCRIPT"`
DG=`readlink -f "$1"`

D2J_NAMES="d2j-dex2jar.sh d2j-dex2jar dex2jar.sh dex2jar"
for i in $D2J_NAMES; do
  d2j=`which d2j-dex2jar.sh`
  if [ "$d2j" = "" ]; then break; fi
done
if [ "$d2j" = "" ]; then
  echo "dex2jar not found, please make sure dex2jar is in \$PATH with one of these names: $D2J_NAMES"
  exit 1
fi
echo "Found dex2jar: $d2j"

javac=`which javac`
if [ "$javac" = "" ]; then
  echo "javac not found, please make sure javac is in \$PATH"
  exit 1
fi
echo "Found javac: $javac"

java=`which java`
if [ "$java" = "" ]; then
  echo "java not found, please make sure java is in \$PATH"
  exit 1
fi
echo "Found java: $java"

faketime=`which faketime`
if [ "$faketime" = "" ]; then
  echo "faketime not found, please make sure faketime is in \$PATH"
  exit 1
fi
echo "Found faketime: $faketime"

TMPDIR=`mktemp -d`
cd $SCRIPTPATH
echo "Compiling decryptor"
$javac decrypt.java
echo "Decrypting $DG to $TMPDIR/droidguasso.apk"
$java decrypt "$DG" "$TMPDIR/droidguasso.apk"
$faketime -f '1970-01-01 01:00:00' $d2j -f -o "../app/libs/droidguasso.jar" "$TMPDIR/droidguasso.apk"
rm -rf "$TMPDIR"