The Android app pops up a button on the screen and it requires us to press it 10 million times…
The way I solved this is by patching the smali code and repackaging the apk file. Installing on an emulator only requires us to click 16 times (I chose 16 because it was easier for me to remember the numbers Im patching :).
If you wonder how I knew which locations to patch. I used www.decompileandroid.com to get the java source code. There I basically followed the flow of execution and made whatever I could from my poor java interpretation.
The java source code of the files that contained important for me data:
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.// Jad home page: http://www.geocities.com/kpdus/jad.html// Decompiler options: braces fieldsfirst space lnc packagecom.tm.ctf.clicker.activity;importandroid.app.ActionBar;importandroid.app.Activity;importandroid.content.Intent;importandroid.content.res.AssetManager;importandroid.content.res.Resources;importandroid.graphics.Bitmap;importandroid.graphics.BitmapFactory;importandroid.os.Bundle;importandroid.util.Log;importcom.tm.ctf.clicker.a.a;importjava.io.IOException;importjava.io.InputStream;importjava.nio.ByteBuffer;// Referenced classes of package com.tm.ctf.clicker.activity:// bpublicclassCongraturationsActivityextendsActivity{privatestaticfinalStringb=com/tm/ctf/clicker/activity/CongraturationsActivity.getSimpleName();privatestaticfinalbytec[]={-119,80,78,71,13,10,26,10};ba;publicCongraturationsActivity(){a=null;}privateBitmapa(){Bitmapbitmap;try{Objectobj=getResources().getAssets().open("f.png");byteabyte0[]=newbyte[((InputStream)(obj)).available()];((InputStream)(obj)).read(abyte0);obj=ByteBuffer.allocate(abyte0.length+8);((ByteBuffer)(obj)).put(c);((ByteBuffer)(obj)).put(abyte0);bitmap=BitmapFactory.decodeByteArray(((ByteBuffer)(obj)).array(),0,abyte0.length+8);}catch(IOExceptionioexception){ioexception.printStackTrace();returnnull;}returnbitmap;}protectedvoidonCreate(Bundlebundle){super.onCreate(bundle);getActionBar().hide();if(0x989680!=com.tm.ctf.clicker.a.a.c()){finish();}a=newb(this,(newStringBuilder(String.valueOf(getIntent().getStringExtra("data")))).append("Nf").toString());bundle=a();setContentView(a);Log.i("VirusClicker",(newStringBuilder("width=")).append(bundle.getWidth()).append(", height=").append(bundle.getHeight()).toString());}}
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.// Jad home page: http://www.geocities.com/kpdus/jad.html// Decompiler options: braces fieldsfirst space lnc packagecom.tm.ctf.clicker.activity;importandroid.content.Context;importandroid.content.Intent;importandroid.graphics.Bitmap;importandroid.graphics.BitmapFactory;importandroid.graphics.Canvas;importandroid.graphics.Paint;importandroid.graphics.Rect;importandroid.os.Handler;importandroid.os.Message;importandroid.view.MotionEvent;importandroid.view.SurfaceHolder;importandroid.view.SurfaceView;importcom.tm.ctf.clicker.a.a;publicclasscextendsSurfaceViewimplementsandroid.view.SurfaceHolder.Callback,Runnable{privateContexta;privateHandlerb;privateSurfaceHolderc;privateintd;privateinte;privateThreadf;privateintg;privatebooleanh;privateBitmapi;privateRectj;privateBitmapk;privateRectl;privateBitmapm;privateRectn;privateBitmapo;privateRectp;privateStringq;publicc(Contextcontext,Handlerhandler,Strings){super(context);a=null;b=null;g=0;h=false;i=null;j=null;k=null;l=null;m=null;n=null;o=null;p=null;q=null;a=context;c=getHolder();c.addCallback(this);g=0;h=false;context=getContext().getResources();i=BitmapFactory.decodeResource(context,0x7f020000);j=newRect(0,0,i.getWidth(),i.getHeight());k=BitmapFactory.decodeResource(context,0x7f020001);l=newRect(0,0,k.getWidth(),k.getHeight());m=BitmapFactory.decodeResource(context,0x7f020002);n=newRect(0,0,m.getWidth(),m.getHeight());o=BitmapFactory.decodeResource(context,0x7f020005);p=newRect(0,0,o.getWidth(),o.getHeight());b=handler;q=(newStringBuilder(String.valueOf(s))).append("Z3").toString();if(g!=com.tm.ctf.clicker.a.a.c()){context=Message.obtain();context.obj="QUIT";b.sendMessage(context);}}privatevoida(inti1,Canvascanvas,Paintpaint){intj1;intk1;k1=0;j1=0;_L2:if(k1>=10){return;}intl1=0;do{label0:{if(l1<10){breaklabel0;}k1++;}if(true){continue;}j1++;if(j1>i1){Rectrect=newRect(p);rect.offset((d/11)*(l1+1)-rect.right/2,(e/11)*(k1+1)-rect.bottom/2);canvas.drawBitmap(o,p,rect,paint);}l1++;}while(true);if(true)goto_L2;elsegoto_L1_L1:}privatevoida(inti1,Canvascanvas,Paintpaint,Paintpaint1){Strings=Integer.toString(i1);i1=(int)paint.measureText(s);Strings1=Integer.toString(0x989680);intj1=(int)paint.measureText(s1);canvas.drawText(s,(d-i1)/2-2,(e/4)*3,paint1);canvas.drawText(s,(d-i1)/2+2,(e/4)*3,paint1);canvas.drawText(s,(d-i1)/2,(e/4)*3,paint);canvas.drawLine((d-j1)/2,(e/4)*3+20,(d-j1)/2+j1,(e/4)*3+20,paint);canvas.drawText(s1,(d-j1)/2-2,(e/4)*3+100,paint1);canvas.drawText(s1,(d-j1)/2+2,(e/4)*3+100,paint1);canvas.drawText(s1,(d-j1)/2,(e/4)*3+100,paint);}privatevoida(Canvascanvas,Paintpaint,Paintpaint1){inti1=(int)paint.measureText("Click Button!");canvas.drawText("Click Button!",(d-i1)/2-2,e/4-50,paint1);canvas.drawText("Click Button!",(d-i1)/2+2,e/4-50,paint1);canvas.drawText("Click Button!",(d-i1)/2,e/4-50,paint);i1=(int)paint.measureText("Attack Virus!");canvas.drawText("Attack Virus!",(d-i1)/2-2,e/4+50,paint1);canvas.drawText("Attack Virus!",(d-i1)/2+2,e/4+50,paint1);canvas.drawText("Attack Virus!",(d-i1)/2,e/4+50,paint);}privatevoida(booleanflag,Canvascanvas,Paintpaint){Objectobj=i;if(flag){obj=k;}Rectrect=newRect(j);rect.offset((d-rect.right)/2,(e-rect.bottom)/2);canvas.drawBitmap(((Bitmap)(obj)),j,rect,paint);obj=newRect(n);((Rect)(obj)).offset((d-((Rect)(obj)).right)/2,(e-((Rect)(obj)).bottom)/2);canvas.drawBitmap(m,n,((Rect)(obj)),paint);}publicbooleanonTouchEvent(MotionEventmotionevent){motionevent.getAction();JVMINSTRtableswitch01:default28// 0 30// 1 37;goto_L1_L2_L3_L1:returntrue;_L2:h=true;returntrue;_L3:h=false;g=g+1;com.tm.ctf.clicker.a.a.b();if(3769==g||10007==g||59239==g||0x186a3==g||0x78e75==g||0xf4243==g||0x98967f==g){motionevent=newIntent("com.tm.ctf.clicker.SCORE");motionevent.putExtra("SCORE",g);a.sendBroadcast(motionevent);}if(0x989680<=g){motionevent=Message.obtain();motionevent.obj=(newStringBuilder(String.valueOf(q))).append("Jh").toString();b.sendMessage(motionevent);returntrue;}if(true)goto_L1;elsegoto_L4_L4:}publicvoidrun(){Paintpaint;Paintpaint1;longl1;longl3;paint=newPaint();paint1=newPaint();paint.setStyle(android.graphics.Paint.Style.FILL);paint.setColor(0xff000000);paint.setTextSize(80F);paint1.setStyle(android.graphics.Paint.Style.FILL);paint1.setColor(-1);paint1.setTextSize(80F);l3=System.currentTimeMillis();l1=0L;_L2:longl2;if(f==null){return;}l2=l1+1L;longl4;Canvascanvas=c.lockCanvas();canvas.drawPaint(paint1);a(g%100,canvas,paint);a(canvas,paint,paint1);a(g,canvas,paint,paint1);a(h,canvas,paint1);c.unlockCanvasAndPost(canvas);l4=16L*l2-(System.currentTimeMillis()-l3);l1=l2;if(l4<=0L){continue;/* Loop/switch isn't completed */}Thread.sleep(l4);l1=l2;continue;/* Loop/switch isn't completed */Exceptionexception;exception;l1=l2;if(true)goto_L2;elsegoto_L1_L1:}publicvoidsurfaceChanged(SurfaceHoldersurfaceholder,inti1,intj1,intk1){d=j1;e=k1;}publicvoidsurfaceCreated(SurfaceHoldersurfaceholder){f=newThread(this);f.start();}publicvoidsurfaceDestroyed(SurfaceHoldersurfaceholder){if(!f.isInterrupted()){f.interrupt();}f=null;}}
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.// Jad home page: http://www.geocities.com/kpdus/jad.html// Decompiler options: braces fieldsfirst space lnc packagecom.tm.ctf.clicker.receiver;importandroid.content.BroadcastReceiver;importandroid.content.Context;importandroid.content.Intent;importcom.tm.ctf.clicker.a.a;publicclassScoreBroadcastReceiverextendsBroadcastReceiver{publicScoreBroadcastReceiver(){}publicvoidonReceive(Contextcontext,Intentintent){inti;i=intent.getIntExtra("SCORE",0);context="";if(3769!=i)goto_L2;elsegoto_L1_L1:context="2";_L4:a.a(context);return;_L2:if(10007==i){context="x";}elseif(59239==i){context="p";}elseif(0x186a3==i){context="Y";}elseif(0x78e75==i){context="2";}elseif(0xf4243==i){context="t";}elseif(0x98967f==i){context="z";}if(true)goto_L4;elsegoto_L3_L3:}}