Search in sources :

Example 1 with SmsData

use of com.secupwn.aimsicd.data.model.SmsData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class AdvancedUserSmsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    realm = Realm.getDefaultInstance();
    dbaccess = new RealmHelper(getApplicationContext());
    RealmResults<SmsData> msgitems = realm.where(SmsData.class).findAllSorted("timestamp");
    listViewAdv.setAdapter(new SmsDataAdapter(getApplicationContext(), msgitems));
    listViewAdv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {

        @Override
        public boolean onItemLongClick(AdapterView<?> a, View v, int position, long id) {
            final SmsData smsData = (SmsData) listViewAdv.getItemAtPosition(position);
            realm.executeTransaction(new Realm.Transaction() {

                @Override
                public void execute(Realm realm) {
                    smsData.deleteFromRealm();
                }
            });
            Toast.makeText(a.getContext(), "Deleted Sms", LENGTH_SHORT).show();
            return true;
        }
    });
}
Also used : SmsDataAdapter(com.secupwn.aimsicd.data.adapter.SmsDataAdapter) InjectView(io.freefair.android.injection.annotation.InjectView) View(android.view.View) AdapterView(android.widget.AdapterView) ListView(android.widget.ListView) RealmHelper(com.secupwn.aimsicd.utils.RealmHelper) SmsData(com.secupwn.aimsicd.data.model.SmsData) AdapterView(android.widget.AdapterView) Realm(io.realm.Realm)

Example 2 with SmsData

use of com.secupwn.aimsicd.data.model.SmsData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class SmsDetector method parseMwiSms.

private void parseMwiSms(String[] logcatLines, Date logcat_timestamp) {
    @Cleanup Realm realm = Realm.getDefaultInstance();
    long count = realm.where(SmsData.class).equalTo("timestamp", logcat_timestamp).count();
    // Only alert if the timestamp is not in the data base
    if (count == 0) {
        realm.beginTransaction();
        SmsData capturedSms = realm.createObject(SmsData.class);
        String smsText = findSmsData(logcatLines, null);
        String num = findSmsNumber(logcatLines, null);
        capturedSms.setSenderNumber(num);
        capturedSms.setMessage(smsText);
        capturedSms.setTimestamp(logcat_timestamp);
        capturedSms.setType("MWI");
        setCurrentLocationData(null, capturedSms);
        realm.commitTransaction();
        mDbAdapter.toEventLog(realm, 4, "Detected MWI SMS");
        startPopUpInfo(SmsType.MWI);
    } else {
        log.debug("Detected Sms already logged");
    }
}
Also used : SmsData(com.secupwn.aimsicd.data.model.SmsData) SmsDetectionString(com.secupwn.aimsicd.data.model.SmsDetectionString) Cleanup(lombok.Cleanup) Realm(io.realm.Realm)

Example 3 with SmsData

use of com.secupwn.aimsicd.data.model.SmsData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class SmsDetector method parseTypeZeroSms.

private void parseTypeZeroSms(String[] bufferLines, Date logcat_timestamp) {
    @Cleanup Realm realm = Realm.getDefaultInstance();
    long count = realm.where(SmsData.class).equalTo("timestamp", logcat_timestamp).count();
    // Only alert if the timestamp is not in the data base
    if (count == 0) {
        realm.beginTransaction();
        SmsData capturedSms = realm.createObject(SmsData.class);
        String smsText = findSmsData(bufferLines, null);
        String num = findSmsNumber(bufferLines, null);
        capturedSms.setSenderNumber(num);
        capturedSms.setMessage(smsText);
        capturedSms.setTimestamp(logcat_timestamp);
        capturedSms.setType("TYPE0");
        setCurrentLocationData(realm, capturedSms);
        realm.commitTransaction();
        mDbAdapter.toEventLog(realm, 3, "Detected Type-0 SMS");
        startPopUpInfo(SmsType.SILENT);
    } else {
        log.debug("Detected Sms already logged");
    }
}
Also used : SmsData(com.secupwn.aimsicd.data.model.SmsData) SmsDetectionString(com.secupwn.aimsicd.data.model.SmsDetectionString) Cleanup(lombok.Cleanup) Realm(io.realm.Realm)

Example 4 with SmsData

use of com.secupwn.aimsicd.data.model.SmsData in project Android-IMSI-Catcher-Detector by CellularPrivacy.

the class SmsDetector method parseWapPushSms.

private void parseWapPushSms(String[] logcatLines, String[] postWapMessageLines, Date logcat_timestamp) {
    @Cleanup Realm realm = Realm.getDefaultInstance();
    long count = realm.where(SmsData.class).equalTo("timestamp", logcat_timestamp).count();
    // Only alert if the timestamp is not in the data base
    if (count == 0) {
        realm.beginTransaction();
        SmsData capturedSms = realm.createObject(SmsData.class);
        String smsText = findSmsData(logcatLines, postWapMessageLines);
        String num = findSmsNumber(logcatLines, postWapMessageLines);
        capturedSms.setSenderNumber(num);
        capturedSms.setMessage(smsText);
        capturedSms.setTimestamp(logcat_timestamp);
        capturedSms.setType("WAPPUSH");
        setCurrentLocationData(realm, capturedSms);
        realm.commitTransaction();
        mDbAdapter.toEventLog(realm, 6, "Detected WAPPUSH SMS");
        startPopUpInfo(SmsType.WAP_PUSH);
    } else {
        log.debug("Detected SMS already logged");
    }
}
Also used : SmsData(com.secupwn.aimsicd.data.model.SmsData) SmsDetectionString(com.secupwn.aimsicd.data.model.SmsDetectionString) Cleanup(lombok.Cleanup) Realm(io.realm.Realm)

Aggregations

SmsData (com.secupwn.aimsicd.data.model.SmsData)4 Realm (io.realm.Realm)4 SmsDetectionString (com.secupwn.aimsicd.data.model.SmsDetectionString)3 Cleanup (lombok.Cleanup)3 View (android.view.View)1 AdapterView (android.widget.AdapterView)1 ListView (android.widget.ListView)1 SmsDataAdapter (com.secupwn.aimsicd.data.adapter.SmsDataAdapter)1 RealmHelper (com.secupwn.aimsicd.utils.RealmHelper)1 InjectView (io.freefair.android.injection.annotation.InjectView)1