Bug Fixes

Bug Fixes
master
Abdul Mannan 2022-02-10 16:50:06 +05:00
parent b26dcf28c5
commit d55c8ba105
6 changed files with 44 additions and 47 deletions

View File

@ -139,6 +139,7 @@ dependencies {
implementation 'com.google.android.material:material:1.5.0' implementation 'com.google.android.material:material:1.5.0'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.google.android.gms:play-services-ads:20.5.0' implementation 'com.google.android.gms:play-services-ads:20.5.0'
implementation group: 'com.macasaet.fernet', name: 'fernet-java8', version: '1.4.2'
} }
/* Automated APK Generation */ /* Automated APK Generation */

View File

@ -29,7 +29,6 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationCompat;
import androidx.core.content.FileProvider; import androidx.core.content.FileProvider;
import com.darkweb.genesissearchengine.appManager.homeManager.homeController.homeController;
import com.darkweb.genesissearchengine.constants.constants; import com.darkweb.genesissearchengine.constants.constants;
import com.darkweb.genesissearchengine.constants.enums; import com.darkweb.genesissearchengine.constants.enums;
import com.darkweb.genesissearchengine.constants.keys; import com.darkweb.genesissearchengine.constants.keys;
@ -38,7 +37,7 @@ import com.darkweb.genesissearchengine.constants.strings;
import com.darkweb.genesissearchengine.dataManager.dataEnums; import com.darkweb.genesissearchengine.dataManager.dataEnums;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.libs.trueTime.trueTime; import com.darkweb.genesissearchengine.libs.trueTime.trueTimeEncryption;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -63,14 +62,12 @@ import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.net.URLEncoder;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import javax.crypto.spec.SecretKeySpec;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_ERROR_CACHED_DARK;
@ -79,9 +76,7 @@ import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED;
import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK; import static com.darkweb.genesissearchengine.constants.constants.CONST_GENESIS_URL_CACHED_DARK;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_DEFAULT_BROWSER; import static com.darkweb.genesissearchengine.constants.enums.etype.M_DEFAULT_BROWSER;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_NEW_LINK_IN_NEW_TAB;
import static com.darkweb.genesissearchengine.constants.enums.etype.M_RATE_COUNT; import static com.darkweb.genesissearchengine.constants.enums.etype.M_RATE_COUNT;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_APPLICATION_CRASH;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_URL;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManager.M_LONG_PRESS_WITH_LINK;
import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION; import static com.darkweb.genesissearchengine.pluginManager.pluginEnums.eMessageManagerCallbacks.M_RATE_APPLICATION;
@ -538,8 +533,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
private String setGenesisVerificationToken(String pString){ private String setGenesisVerificationToken(String pString){
try{ try{
Uri built = Uri.parse(pString).buildUpon() Uri built = Uri.parse(pString).buildUpon()
.appendQueryParameter(constants.CONST_GENESIS_GMT_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getGMT(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8")) .appendQueryParameter(constants.CONST_GENESIS_GMT_TIME_GET_KEY, trueTimeEncryption.getInstance().getSecretToken())
.appendQueryParameter(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY, URLEncoder.encode(helperMethod.caesarCipherEncrypt(trueTime.getInstance().getLTZ(),new SecretKeySpec(constants.CONST_ENCRYPTION_KEY.getBytes(), "AES")), "utf-8"))
.build(); .build();
return built.toString(); return built.toString();
}catch (Exception ex){ }catch (Exception ex){
@ -554,7 +548,7 @@ geckoSession extends GeckoSession implements GeckoSession.MediaDelegate,GeckoSes
event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.M_NEW_IDENTITY_MESSAGED); event.invokeObserver(Arrays.asList(mCurrentURL,mSessionID,mCurrentTitle, mTheme), enums.etype.M_NEW_IDENTITY_MESSAGED);
return GeckoResult.fromValue(AllowOrDeny.DENY); return GeckoResult.fromValue(AllowOrDeny.DENY);
} }
if(!var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){ if(!var1.uri.contains(constants.CONST_GENESIS_GMT_TIME_GET_KEY) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED) && !var1.uri.startsWith(CONST_GENESIS_URL_CACHED_DARK) && var1.uri.startsWith("http://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion") && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY) && !var1.uri.contains(constants.CONST_GENESIS_LOCAL_TIME_GET_KEY)){
String mVerificationURL = setGenesisVerificationToken(var1.uri); String mVerificationURL = setGenesisVerificationToken(var1.uri);
initURL(mVerificationURL); initURL(mVerificationURL);
loadUri(mVerificationURL); loadUri(mVerificationURL);

View File

@ -73,7 +73,7 @@ import com.darkweb.genesissearchengine.appManager.activityStateManager;
import com.darkweb.genesissearchengine.eventObserver; import com.darkweb.genesissearchengine.eventObserver;
import com.darkweb.genesissearchengine.helperManager.helperMethod; import com.darkweb.genesissearchengine.helperManager.helperMethod;
import com.darkweb.genesissearchengine.appManager.activityThemeManager; import com.darkweb.genesissearchengine.appManager.activityThemeManager;
import com.darkweb.genesissearchengine.libs.trueTime.trueTime; import com.darkweb.genesissearchengine.libs.trueTime.trueTimeEncryption;
import com.darkweb.genesissearchengine.pluginManager.pluginController; import com.darkweb.genesissearchengine.pluginManager.pluginController;
import com.darkweb.genesissearchengine.pluginManager.pluginEnums; import com.darkweb.genesissearchengine.pluginManager.pluginEnums;
import com.example.myapplication.R; import com.example.myapplication.R;
@ -216,7 +216,7 @@ public class homeController extends AppCompatActivity implements ComponentCallba
dataController.getInstance().initialize(this); dataController.getInstance().initialize(this);
status.initStatus(this); status.initStatus(this);
dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this)); dataController.getInstance().invokeSQLCipher(dataEnums.eSqlCipherCommands.M_INIT, Collections.singletonList(this));
trueTime.getInstance().initTime(); trueTimeEncryption.getInstance().initTime();
helperMethod.updateResources(this, status.mSystemLocale.getLanguage()); helperMethod.updateResources(this, status.mSystemLocale.getLanguage());
pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED); pluginController.getInstance().onLanguageInvoke(Collections.singletonList(this), pluginEnums.eLangManager.M_ACTIVITY_CREATED);

View File

@ -33,7 +33,7 @@ public class constants
public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/"; public static final String CONST_GENESIS_DOMAIN_URL_SLASHED = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion/";
public static final String CONST_GENESIS_DOMAIN_URL = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion"; public static final String CONST_GENESIS_DOMAIN_URL = "https://trcip42ymcgvv5hsa7nxpwdnott46ebomnn5pm5lovg5hpszyo4n35yd.onion";
public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken"; public static final String CONST_GENESIS_LOCAL_TIME_GET_KEY = "pLocalTimeVerificationToken";
public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pGlobalTimeVerificationToken"; public static final String CONST_GENESIS_GMT_TIME_GET_KEY = "pSecretToken";
public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/Help/help.html"; public static final String CONST_GENESIS_HELP_URL_CACHE = "resource://android/assets/Help/help.html";
public static final String CONST_GENESIS_HELP_URL_CACHE_DARK = "resource://android/assets/Help/help-dark.html"; public static final String CONST_GENESIS_HELP_URL_CACHE_DARK = "resource://android/assets/Help/help-dark.html";
public static final String CONST_GENESIS_HELP_URL = "https://genesis.onion/help"; public static final String CONST_GENESIS_HELP_URL = "https://genesis.onion/help";

View File

@ -1,35 +0,0 @@
package com.darkweb.genesissearchengine.libs.trueTime;
import com.darkweb.genesissearchengine.constants.strings;
import com.instacart.library.truetime.TrueTime;
import java.util.Date;
public class trueTime {
private static trueTime ourInstance = new trueTime();
public static trueTime getInstance()
{
return ourInstance;
}
public void initTime(){
try{
TrueTime.build().initialize();
}catch (Exception ignored){ }
}
public String getGMT(){
if (TrueTime.isInitialized()) {
Date trueTime = TrueTime.now();
return trueTime.getTime()+strings.GENERIC_EMPTY_STR;
}else {
return "null";
}
}
public String getLTZ(){
return System.currentTimeMillis()+strings.GENERIC_EMPTY_STR;
}
}

View File

@ -0,0 +1,37 @@
package com.darkweb.genesissearchengine.libs.trueTime;
import android.os.Build;
import androidx.annotation.RequiresApi;
import com.instacart.library.truetime.TrueTime;
import com.macasaet.fernet.Key;
import com.macasaet.fernet.Token;
import java.util.Base64;
public class trueTimeEncryption {
public static String S_FERNET_KEY = "W#ZYBHQa9G_DB_iU@yjA3Es@COu4-UzU";
public static String S_APP_BLOCK_KEY = "D~S=05y68#M25oj]vprm}9HE))Tr'VX?[p|m-Wg`mrg^";
private static trueTimeEncryption ourInstance = new trueTimeEncryption();
public static trueTimeEncryption getInstance()
{
return ourInstance;
}
public void initTime(){
try{
TrueTime.build().initialize();
}catch (Exception ignored){ }
}
public String getSecretToken() {
Key mkey = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
mkey = new Key(Base64.getUrlEncoder().encodeToString(S_FERNET_KEY.getBytes()));
}
Token token = Token.generate(mkey, S_APP_BLOCK_KEY);
return token.serialise();
}
}