Android Black technology to read the user SMS + Modify the system SMS database _android

Source: Internet
Author: User

Android system is the biggest drawback of iOS system, I believe we all know that it is the system security problem. This blog shows a wave of "black technology".

Read User SMS

Android apps can read text messages on a user's phone, and believe it's nothing new, like the code we've received, some apps will be able to automatically get and fill in the verification code, eliminating the ability to manually fill in the verification code. The principle is to access the system's SMS database through the ContentProvider component of Android, and get all the SMS content. Here's a demo.

The layout is simple, as follows:

The code is as follows:

public class Mainactivity extends activity {list<message> smslist;
    @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate);
    Setcontentview (R.layout.activity_main);
  Smslist = new arraylist<message> ();
    public void Click (View v) {//Access content provider Get SMS Contentresolver CR = Getcontentresolver ();  The host name of the SMS content provider Cursor Cursor = Cr.query (Uri.parse ("Content://sms"), New string[]{"Address", "date", "body",
    "Type"}, NULL, NULL, NULL);
      while (Cursor.movetonext ()) {String address = cursor.getstring (0);
      Long date = Cursor.getlong (1);
      String BODY = cursor.getstring (2);
      String type = cursor.getstring (3);
      Message SMS = new Message (body, type, address, date);
      Smslist.add (SMS);
    LOG.E ("TAG", sms.tostring ());
    } public void Click2 (View v) {XmlSerializer xs = xml.newserializer ();
    File File = new file ("Sdcard/sms.xml"); FileOutputStreamFos
      try {fos = new FileOutputStream (file);
      Xs.setoutput (FOS, "utf-8");
      Xs.startdocument ("Utf-8", true);
      Xs.starttag (NULL, "message");
        for (message sms:smslist) {Xs.starttag (null, "SMS");
        Xs.starttag (NULL, "body");
        Xs.text (Sms.getbody ());
        Xs.endtag (NULL, "body");
        Xs.starttag (NULL, "date");
        Xs.text (Sms.getdate () + "");
        Xs.endtag (NULL, "date");
        Xs.starttag (NULL, "type");
        Xs.text (Sms.gettype ());
        Xs.endtag (NULL, "type");
        Xs.starttag (NULL, "address");
        Xs.text (Sms.getaddress ());
        Xs.endtag (NULL, "address");
      Xs.endtag (NULL, "SMS");
      } Xs.endtag (NULL, "message");
    Xs.enddocument ();
    catch (Exception e) {//TODO auto-generated catch block E.printstacktrace ();  }
  }
}

To read and insert text messages, you must also add permissions:

<uses-permission android:name= "Android.permission.READ_SMS"/>
  

The following is an analysis of the code: the first button indirectly obtains some message information by ContentProvider, and saves it under a list array. Let's take a look at the Android SMS table:

A total of 17 fields so many, obviously not we are concerned about, here as long as the address,date, body, type four fields, respectively, indicating the other side number, SMS time, SMS content, send or receive. The second button stores the message information in a serialized XML file for easy viewing.

Put the XML screenshot:


Can be seen at this time on the phone a total of 5 text messages, done.

Modify the System SMS database

The real black technology came, I believe you know some outlaws can impersonate various numbers to publish false information, such as 10086 what, the following demonstration with 95533 (CCB) to send an April Fool card.

The code is as follows:

public class Mainactivity extends activity {
  @Override
  protected void onCreate (Bundle savedinstancestate) {
    super.oncreate (savedinstancestate);
    Setcontentview (R.layout.activity_main);
  }
  public void Click (View v) {
    thread t = new Thread () {
      @Override public
      void Run () {
        contentresolver CR = ge Tcontentresolver ();
        Contentvalues values = new Contentvalues ();
        Values.put ("Address", 95533);
        Values.put ("type", 1);
        Values.put ("Date", System.currenttimemillis ());
        Values.put ("Body", "you tail for 9999 of the credit card received 1,000,000RMB transfer, please pay attention to check");
        Cr.insert (Uri.parse ("content://sms"), values);
      }
    ;
    T.start ();
  }

The idea is similar to a step, but here is the insertion of a message. Implementation effect:


Incidentally, from the Android 5.0, the default SMS application software can not be written in the form of a text message database (write SMS) text messages, that is to modify the system SMS database does not work, but read the user text message this bug has not been repaired. So don't want to be cheated of the children's shoes or feel upgrade more than 5.0 version bar ^_^

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.