簡單android病毒分析並實現其效果,android病毒實現

來源:互聯網
上載者:User

簡單android病毒分析並實現其效果,android病毒實現

今天在群裡看到大家發的一個連結,一個病毒的顯示方式,挺好玩的,模仿寫了下。


http://mt.sohu.com/20150517/n413220620.shtml?qq-pf-to=pcqq.c2c





這個實現的難度不大,主要是思路上面能夠理解就非常簡單了。


根據來看,主要也就是文字方面的更改,那麼我們可以直接考慮android中如何給TextView進行賦值的操作。


TextView.setText(CharSequence) 


這個方法就可以實現對其顯示文字的賦值,所以使用了substrate架構簡單編寫了下hook指令碼。


<span style="font-size:18px;">public class Main {  public static void initialize() {      MS.hookClassLoad("android.widget.TextView", new MS.ClassLoadHook() { @Overridepublic void classLoaded(Class<?> arg0) {// TODO Auto-generated method stubMethod smstest ;try {  smstest=arg0.getMethod("setText", CharSequence.class);} catch (SecurityException e) {// TODO Auto-generated catch blocksmstest=null;e.printStackTrace();} catch (NoSuchMethodException e) {// TODO Auto-generated catch block smstest=null;e.printStackTrace(); }if(smstest!=null){       final MS.MethodPointer old = new MS.MethodPointer();MS.hookMethod(arg0, smstest, new MS.MethodHook() {@Overridepublic Object invoked(Object arg0, Object... arg1)throws Throwable {// TODO Auto-generated method stubLog.d("ggz","i am hook in------->");String bb=(String)arg1[0];Log.d("ggz","string is----->"+bb);bb="愛破解,愛鬼哥";Log.d("ggz","now string is --->"+bb);return old.invoke(arg0, bb);   }}, old); }}      });    }  }</span>



然後我們運行看下我們定義的Log日誌:




日誌正常顯示了,那麼我們就看下手機的:






好了,跟病毒樣式一模一樣。


如果病毒來做的話,可以直接通過自訂的hook方式來實現,不依靠這些公開的注入架構如Xposed,Cydia Substrate,可以通過自己編寫的注入架構也可以很方便的來實現這個原理。


關於hook如何使用,我的部落格裡面也有簡單介紹Cydia Substrate的從頭教學,大家有興趣的可以看下。


本文僅供研究而已,請勿進行非法用途。


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.