Update to generate files
This commit is contained in:
parent
71840d79c1
commit
5251ebe0ee
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
KeyGeneratorMaven/target
|
3
KeyGeneratorMaven/.idea/.gitignore
vendored
Normal file
3
KeyGeneratorMaven/.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
13
KeyGeneratorMaven/.idea/compiler.xml
Normal file
13
KeyGeneratorMaven/.idea/compiler.xml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="CompilerConfiguration">
|
||||||
|
<annotationProcessing>
|
||||||
|
<profile name="Maven default annotation processors profile" enabled="true">
|
||||||
|
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||||
|
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||||
|
<outputRelativeToContentRoot value="true" />
|
||||||
|
<module name="KeyGeneratorMaven" />
|
||||||
|
</profile>
|
||||||
|
</annotationProcessing>
|
||||||
|
</component>
|
||||||
|
</project>
|
7
KeyGeneratorMaven/.idea/encodings.xml
Normal file
7
KeyGeneratorMaven/.idea/encodings.xml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
20
KeyGeneratorMaven/.idea/jarRepositories.xml
Normal file
20
KeyGeneratorMaven/.idea/jarRepositories.xml
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="RemoteRepositoriesConfiguration">
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Central Repository" />
|
||||||
|
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="central" />
|
||||||
|
<option name="name" value="Maven Central repository" />
|
||||||
|
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||||
|
</remote-repository>
|
||||||
|
<remote-repository>
|
||||||
|
<option name="id" value="jboss.community" />
|
||||||
|
<option name="name" value="JBoss Community repository" />
|
||||||
|
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||||
|
</remote-repository>
|
||||||
|
</component>
|
||||||
|
</project>
|
12
KeyGeneratorMaven/.idea/misc.xml
Normal file
12
KeyGeneratorMaven/.idea/misc.xml
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_22" project-jdk-name="17" project-jdk-type="JavaSDK" />
|
||||||
|
</project>
|
6
KeyGeneratorMaven/.idea/vcs.xml
Normal file
6
KeyGeneratorMaven/.idea/vcs.xml
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -3,10 +3,10 @@
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>org.example</groupId>
|
<groupId>org.example</groupId>
|
||||||
<artifactId>KeyGeneratorMaven</artifactId>
|
<artifactId>KeyGeneratorMaven</artifactId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>17</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
|
@ -19,13 +19,11 @@
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-jdk15on</artifactId>
|
<artifactId>bcprov-jdk15on</artifactId>
|
||||||
<version>1.70</version>
|
<version>1.70</version>
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.bouncycastle</groupId>
|
<groupId>org.bouncycastle</groupId>
|
||||||
<artifactId>bcprov-ext-jdk15on</artifactId>
|
<artifactId>bcprov-ext-jdk15on</artifactId>
|
||||||
<version>1.70</version>
|
<version>1.70</version>
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
@ -34,9 +32,26 @@
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<configuration>
|
||||||
<version>3.8.1</version>
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>org.example.Main</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id> <!-- this is used for inheritance merges -->
|
||||||
|
<phase>package</phase> <!-- bind to the packaging phase -->
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
|
|
|
@ -1,95 +1,48 @@
|
||||||
package org.example;
|
package org.example;
|
||||||
|
|
||||||
import javax.crypto.*;
|
import java.io.File;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import java.io.FileWriter;
|
||||||
import javax.crypto.spec.PBEKeySpec;
|
import java.io.IOException;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
|
||||||
import java.security.*;
|
import java.security.*;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Base64;
|
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
private static final byte[] iv = {-126, -30, -6, -75, -99, -117, -66, 117, 39, -65, -126, -27, -12, 38, -99, 86};
|
|
||||||
private static final byte[] salt = {-92, -102, -105, -123, 71, -33, 69, -39, -27, -32, 21, 33, 126, -81, 69, 59, 57, 29, -83, -15};
|
public static void WriteTxtFile(String txtFile, String txt){
|
||||||
|
try {
|
||||||
|
System.out.println("Writing: "+txtFile);
|
||||||
|
FileWriter txtStream = new FileWriter(txtFile);
|
||||||
|
txtStream.write(txt);
|
||||||
|
txtStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.out.println("Failed to write file" + txtFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Security.addProvider(new BouncyCastleProvider());
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
|
|
||||||
System.out.println("usrename: "+encryptString("transrights@transgender.lgbt"));
|
if(args.length < 4) {
|
||||||
System.out.println("password: "+encryptString("Trans Rights are Human Rights"));
|
System.out.println("Usage: <android_id> <psm.apk uid> <email address> <password> <account_id>");
|
||||||
System.out.println("accountId: "+encryptString("-6148914691236517206"));
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
private static String getAndroidId(){
|
|
||||||
return "a256d883de6fe05a";
|
|
||||||
//return Settings.Secure.getString(this.ctx.getContentResolver(), "android_id");;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static int getPsmUid() {
|
|
||||||
return 10123;
|
|
||||||
}
|
|
||||||
private static String base64(byte[] data){
|
|
||||||
byte[] base64 = Base64.getEncoder().encode(data);
|
|
||||||
return new String(base64);
|
|
||||||
}
|
|
||||||
private static String encryptString(String str) {
|
|
||||||
byte[] data = str.getBytes();
|
|
||||||
byte[] encryptedData = encrypt(data);
|
|
||||||
if(encryptedData != null){
|
|
||||||
byte[] encodedData = Arrays.copyOf(encryptedData, encryptedData.length + 2);
|
|
||||||
encodedData[encodedData.length - 2] = 1;
|
|
||||||
encodedData[encodedData.length - 1] = 1;
|
|
||||||
|
|
||||||
return base64(encodedData);
|
|
||||||
}
|
}
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static byte[] encrypt(byte[] input){
|
StringEncryptor stringEncryptor = new StringEncryptor(args[0], Integer.parseInt(args[1]));
|
||||||
try {
|
String emailAddress = args[2];
|
||||||
Cipher cipher =generateKeyCipher(Main.salt, Main.iv, Cipher.ENCRYPT_MODE);
|
String password = args[3];
|
||||||
if (cipher != null) {
|
long accountId = Long.parseLong(args[4], 16);
|
||||||
return cipher.doFinal(input);
|
|
||||||
}
|
new File("shared_prefs").mkdirs();
|
||||||
} catch (BadPaddingException | IllegalBlockSizeException e) { }
|
WriteTxtFile("shared_prefs/SigninInfo.xml", "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n<string name=\"SignedInUsername\">"+stringEncryptor.encryptString(emailAddress)+"\n</string>\n<boolean name=\"PassSave\" value=\"true\" />\n<string name=\"Password\">"+stringEncryptor.encryptString(password)+"\n</string>\n<boolean name=\"AutoSignIn\" value=\"true\" />\n</map>\n");
|
||||||
return null;
|
WriteTxtFile("shared_prefs/com.playstation.psstore_preferences.xml", "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n<boolean name=\"key_upgradeDownloadTableForNeedWifi\" value=\"true\" />\n<string name=\"last_signin_account_id\">"+stringEncryptor.encryptString(String.valueOf(accountId)) +"\n</string>\n<long name=\"last_signin_account_region\" value=\"2\" />\n<int name=\"key_psstore\" value=\"1\" />\n<int name=\"key_downloader\" value=\"1\" />\n<int name=\"psm_license_agree_version_code\" value=\"1170\" />\n<boolean name=\"key_notDisplayAgainEndOfSupportPreNavi\" value=\"true\" />\n<int name=\"key_xmlcache\" value=\"1\" />\n<string name=\"last_signin_account_country\">US</string>\n<boolean name=\"key_notDisplayAgainContentStartNavi\" value=\"true\" />\n<int name=\"key_startcontent\" value=\"1\" />\n<int name=\"key_nsxevent\" value=\"1\" />\n<boolean name=\"key_upgradeLibraryTableForLocationUseConfirmationDate\" value=\"true\" />\n<int name=\"key_install\" value=\"1\" />\n<string name=\"update_md5\">387ce7e424258aef426aaa5be8a1638a</string>\n<boolean name=\"psm_license_agree\" value=\"true\" />\n<int name=\"key_guestinfo\" value=\"1\" />\n<string name=\"last_signin_account_language\">en</string>\n<int name=\"key_cache\" value=\"2\" />\n<int name=\"key_signinfo\" value=\"2\" />\n</map>\n");
|
||||||
|
WriteTxtFile("shared_prefs/RunningContentInfo.xml", "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n<null name=\"title_id\" />\n<null name=\"next_title_id\" />\n</map>\n");
|
||||||
|
WriteTxtFile("shared_prefs/LocalLibrary.xml", "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n<map>\n<boolean name=\"notDisplayAgain\" value=\"true\" />\n<int name=\"sortType\" value=\"0\" />\n<boolean name=\"isList\" value=\"false\" />\n</map>\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Cipher generateKeyCipher(final byte[] salt, final byte[] iv, final int opmode) {
|
|
||||||
try {
|
|
||||||
final String androidId = getAndroidId();
|
|
||||||
final String psmUid = String.valueOf(getPsmUid());
|
|
||||||
if (androidId == null || psmUid == null) {
|
|
||||||
throw new InvalidParameterException();
|
|
||||||
}
|
|
||||||
final SecretKeyFactory skeyFactory = SecretKeyFactory.getInstance("PBEWITHSHAAND256BITAES-CBC-BC");
|
|
||||||
final char[] charArray = (androidId + psmUid + " com.playstation.psstore ").toCharArray();
|
|
||||||
final PBEKeySpec keySpec = new PBEKeySpec(charArray, salt, 16, 256);
|
|
||||||
Arrays.fill(charArray, '\0');
|
|
||||||
final SecretKeySpec key = new SecretKeySpec(skeyFactory.generateSecret(keySpec).getEncoded(), "AES");
|
|
||||||
final Cipher newCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
|
||||||
newCipher.init(opmode, key, new IvParameterSpec(iv), new SecureRandom());
|
|
||||||
return newCipher;
|
|
||||||
}
|
|
||||||
catch (NoSuchPaddingException ex) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (InvalidAlgorithmParameterException ex2) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (InvalidKeyException ex3) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (InvalidKeySpecException ex4) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
catch (NoSuchAlgorithmException ex5) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import javax.crypto.*;
|
||||||
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
|
import javax.crypto.spec.PBEKeySpec;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.security.*;
|
||||||
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
public class StringEncryptor {
|
||||||
|
private static final byte[] iv = {-126, -30, -6, -75, -99, -117, -66, 117, 39, -65, -126, -27, -12, 38, -99, 86};
|
||||||
|
private static final byte[] salt = {-92, -102, -105, -123, 71, -33, 69, -39, -27, -32, 21, 33, 126, -81, 69, 59, 57, 29, -83, -15};
|
||||||
|
|
||||||
|
private String ANDROID_ID = "";
|
||||||
|
private int PSM_UID = 0;
|
||||||
|
|
||||||
|
StringEncryptor(String androidId, int psmUid){
|
||||||
|
ANDROID_ID = androidId;
|
||||||
|
psmUid = psmUid;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getAndroidId(){
|
||||||
|
return ANDROID_ID;
|
||||||
|
//return Settings.Secure.getString(this.ctx.getContentResolver(), "android_id");;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getPsmUid() {
|
||||||
|
return PSM_UID;
|
||||||
|
}
|
||||||
|
private String base64(byte[] data){
|
||||||
|
byte[] base64 = Base64.getEncoder().encode(data);
|
||||||
|
return new String(base64);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String encryptString(String str) {
|
||||||
|
byte[] data = str.getBytes();
|
||||||
|
byte[] encryptedData = encrypt(data);
|
||||||
|
if(encryptedData != null){
|
||||||
|
byte[] encodedData = Arrays.copyOf(encryptedData, encryptedData.length + 2);
|
||||||
|
encodedData[encodedData.length - 2] = 1;
|
||||||
|
encodedData[encodedData.length - 1] = 1;
|
||||||
|
|
||||||
|
return base64(encodedData);
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte[] encrypt(byte[] input){
|
||||||
|
try {
|
||||||
|
Cipher cipher =generateKeyCipher(StringEncryptor.salt, StringEncryptor.iv, Cipher.ENCRYPT_MODE);
|
||||||
|
if (cipher != null) {
|
||||||
|
return cipher.doFinal(input);
|
||||||
|
}
|
||||||
|
} catch (BadPaddingException | IllegalBlockSizeException e) { }
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private Cipher generateKeyCipher(final byte[] salt, final byte[] iv, final int opmode) {
|
||||||
|
try {
|
||||||
|
final String androidId = getAndroidId();
|
||||||
|
final String psmUid = String.valueOf(getPsmUid());
|
||||||
|
if (androidId == null || psmUid == null) {
|
||||||
|
throw new InvalidParameterException();
|
||||||
|
}
|
||||||
|
final SecretKeyFactory skeyFactory = SecretKeyFactory.getInstance("PBEWITHSHAAND256BITAES-CBC-BC");
|
||||||
|
final char[] charArray = (androidId + psmUid + " com.playstation.psstore ").toCharArray();
|
||||||
|
final PBEKeySpec keySpec = new PBEKeySpec(charArray, salt, 16, 256);
|
||||||
|
Arrays.fill(charArray, '\0');
|
||||||
|
final SecretKeySpec key = new SecretKeySpec(skeyFactory.generateSecret(keySpec).getEncoded(), "AES");
|
||||||
|
final Cipher newCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||||
|
newCipher.init(opmode, key, new IvParameterSpec(iv), new SecureRandom());
|
||||||
|
return newCipher;
|
||||||
|
}
|
||||||
|
catch (NoSuchPaddingException ex) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (InvalidAlgorithmParameterException ex2) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (InvalidKeyException ex3) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (InvalidKeySpecException ex4) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
catch (NoSuchAlgorithmException ex5) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +0,0 @@
|
||||||
<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
|
|
||||||
<map>
|
|
||||||
<string name="SignedInUsername">ixazRIfzsgM1qLucnDvcRgEB
|
|
||||||
</string>
|
|
||||||
<boolean name="PassSave" value="true" />
|
|
||||||
<boolean name="AutoSignIn" value="true" />
|
|
||||||
<string name="Password">j+/dWQjJmm1gvG1IuevMpKuebIxTwgQMk8vEu66xmqkBAQ==
|
|
||||||
</string>
|
|
||||||
</map>
|
|
Loading…
Reference in New Issue
Block a user