Exemplo n.º 1
0
  private boolean isThisTheRegisteredSim() {
    TelephonyManager mTelephonyMgr =
        (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    // String imsi = mTelephonyMgr.getSubscriberId();
    String simSerialNumber = mTelephonyMgr.getSimSerialNumber();
    if (simSerialNumber == null) return true; // Couldn't get the serial number, so can't check.

    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(ctx);
    String storedSerialNumber = settings.getString(PreyConfig.PREFS_SIM_SERIAL_NUMBER, "");
    PreyLogger.d("Checking SIM. Current SIM Serial Number: " + storedSerialNumber);
    if (storedSerialNumber.equals("")) return true; // true since SIM hasn't been registered.

    PreyLogger.d("Checking SIM. Registered SIM Serial Number: " + simSerialNumber);
    return simSerialNumber.equals(storedSerialNumber);
  }
  private FileConfigReader(Context ctx) {
    try {
      PreyLogger.d("Loading config properties from file...");
      properties = new Properties();
      InputStream is = ctx.getResources().openRawResource(R.raw.config);
      properties.load(is);
      is.close();
      PreyLogger.d("Config: " + properties);

    } catch (NotFoundException e) {
      PreyLogger.e("Config file wasn't found", e);
    } catch (IOException e) {
      PreyLogger.e("Couldn't read config file", e);
    }
  }
Exemplo n.º 3
0
 public void saveSimInformation() {
   TelephonyManager mTelephonyMgr =
       (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
   // String imsi = mTelephonyMgr.getSubscriberId();
   String simSerialNumber = mTelephonyMgr.getSimSerialNumber();
   this.saveString(PreyConfig.PREFS_SIM_SERIAL_NUMBER, simSerialNumber);
   PreyLogger.d("SIM Serial number stored: " + simSerialNumber);
 }
 public void saveSimInformation() {
   TelephonyManager telephonyManager =
       (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
   String simSerial = telephonyManager.getSimSerialNumber();
   if (simSerial != null) {
     this.setSimSerialNumber(simSerial);
   }
   this.saveString(PreyConfig.PREFS_SIM_SERIAL_NUMBER, this.getSimSerialNumber());
   PreyLogger.d("SIM Serial number stored: " + this.getSimSerialNumber());
 }
Exemplo n.º 5
0
  public void unlockIfLockActionIsntEnabled(ArrayList<PreyAction> actions) {

    if (isLockSet()) {
      boolean disableLock = true;
      for (PreyAction preyAction : actions) {
        if (preyAction.ID.equals(LockAction.DATA_ID)) // Lock action comes in the modules list.
        disableLock = false;
      }
      if (disableLock) {
        PreyLogger.d("Lock set before but not now. Removing it!");
        this.setLock(false);
        LockAction lockAction = new LockAction();
        lockAction.killAnyInstanceRunning(ctx);
      }
    }
  }
  public boolean isSimChanged() {

    TelephonyManager telephonyManager =
        (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
    String simSerial = telephonyManager.getSimSerialNumber();
    PreyLogger.i("simSerial:" + simSerial + " actual:" + this.simSerialNumber);
    if (this.simSerialNumber == null || "".equals(this.simSerialNumber)) {
      if (simSerial != null && !"".equals(simSerial)) {
        this.setSimSerialNumber(simSerial);
      }
      return false;
    }
    if (simSerial != null
        && !"".equals(simSerial)
        && !simSerial.equals(this.getSimSerialNumber())) {
      return true;
    }

    return false;
  }
Exemplo n.º 7
0
 public boolean askForPassword() {
   boolean ask = FileConfigReader.getInstance(this.ctx).isAskForPassword();
   PreyLogger.d("Ask for password?" + ask);
   return ask;
 }