手机安全卫士传智_第1页
手机安全卫士传智_第2页
手机安全卫士传智_第3页
手机安全卫士传智_第4页
手机安全卫士传智_第5页
已阅读5页,还剩29页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

92_杀毒软件的原理1、什么是3、蠕虫,威金,,4前段比特币被,损失270多万5所有 KillKv300300kv300后很多人用盗版的。(蜜罐一组没有没有安全软件没有补丁,服务器一些功能主动联网8、360互联网云安全计划淘宝不许用QQ,只能用;害怕收集;目前卡巴斯基库已经有了2千多万传统杀毒软件的缺陷:数据库越来越大;3601201234把它102000100130lbe主动防御方式杀毒。查看金山卫士2、创建新页面AntiActivity并在功能文件,创建布局文Anti杀毒软android:orientation="horizontal">android:layout_height="80dip">android:src="@drawable/ic_scanner_malware"/>android:src="@drawable/act_scanning_03"/>android:orientation="vertical">android:textSize="18sp"/>android:layout_marginRight="10dip"/>B:代码实现,旋转动iv_scan=(ImageView) Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f);A:参照系统样式文件 ProgressBar-->progress_medium_white-->spinner_white_48(indeterminate不确定的只搜索:progress_horizontal讲解里面的结构;layer-list层;Bprogress_horizontal拷贝该资drawble并修改成;并且把金山进程也拷贝到drawble下,progress_horizontal.xml修改成如下:<layer-list C:布局使android:layout_marginRight="10dip"/>D:代码设置进progressBar1=(ProgressBar)findViewById(R.gressBar1);newpublicvoidrun()for(inti=0;i<100;i++){try{}catch(InterruptedExceptione)//TODOAuto-generatedcatchblock}}运行演示,看效果94_获取应用程序的签名PackageManagerpm= for(PackageInfopackageInfo:packInfos){}AListofPackageInfoobjects,oneforeachpackagethatisinstalledonthedevice.Intheunlikelycaseoftherebeingnoinstalledpackages,anemptylistisreturned.IfflagGET_UNINSTALLED_PACKAGESisset,alistofallapplicationsincludingthosedeletedwithDONT_DELETE_DATA(partiallyinstalledappswithdatadirectory)willbereturned.一列packageInfo对象,每一个包,安装在装置。在不可能的情况下,没有安装的软件包,则返回一个空列表。如果国旗get_uninstalled_packages设置,一个dont_delete_data(部分安装的应用程序将返回的数据。用任意一个APK,拷贝到桌面上。用解压工具打开meta-inf:保存应用程序的签名信息;列出设备命令:adb5554C:\Users\Administrator>adbsemulator-5554installC:\Users\Administrator\DesktB:修改里面图标 apk包的签名被在文件META-INF\CERT.RSA中apk由于签名信息太长不便于计算,把它加密成md5PackageManagerpm=//获取所有应用程序包括卸载的但没有卸载干净(保留有数据的应用) for(PackageInfopackageInfo:packInfos){ }知识拓展1、拷贝金山卫士数据库anti.db到工程资 2、基于AddressDao修改成AntiDao,并且修改里面文件的路径SQL语句:select*fromdatablewheremd5="2b29d68c selectdescfromdatablewheremd5="2b29d68c publicDao= *@parammd5签名信息的md5@return是返回的描述信息;不是返回publicstaticStringis(Stringmd5){Stringresult=null;Databasedb=Database.openDatabase(path,null,Cursorcursor=db.rawQuery("selectdescfromdatablewhere=

newString[]{md5while(cursor.moveToNext()){result=cursor.getString(0);}returnresult;}}在SshActivity把数据库拷copyDB("antifor(PackageInfo Stringresult=AntiDao.is(md5);if(result!=null){}}运行演示看效果4、更改扫描时的状A:实例化状态TextView和线程布tv_scan_status(TextViewfindViewById(R.id.tv_scan_status);ll_container(LinearLayoutfindViewById(R.id.ll_container);B:扫描代码,放入子线程并休眠2秒,便于显示状态效果newThread()publicvoidrun()try}catch(InterruptedExceptione){}PackageManagerpm=List<PackageInfo>packInfos=+PackageManager.GET_SIGNATURES);intprogress=Randomrandom=newfor(PackageInfopackageInfo:packInfos) Stringresult=AntiDao.isif(result!=null){}else}try{Thread.sleep(50+}catch(InterruptedExceptione){}}classbooleanis;Stringdesc;StringappName;}B:创建privateHandlerhandler=newpublicvoidhandleMessage(android.os.Messagemsg)switch(msg.what)caseScanInfoscanInfo=(ScanInfo)TextViewtextView=newTextView(AntiActivity.this);}ll_container.addView(textView0);case}newThread()publicvoidrun()try}catch(InterruptedExceptione){}PackageManagerpm=List<PackageInfo>packInfos=+PackageManager.GET_SIGNATURES);intprogress=Randomrandom=newfor(PackageInfopackageInfo:packInfos)ScanInfoscanInfo=newScanInfo();scanInfo.appName=packageInfo.applicationInfo Stringresult=AntiDao.isif(result!=null){scanInfo.is=true;scanInfo.des=result;}elsescanInfo.is=false;scanInfo.des=null;}Messagemessage=Message.obtain();message.what=SCANING;message.obj=scanInfo;try{Thread.sleep(50+}catch(InterruptedExceptione){}}Messagemessage=Message.obtain();message.what=SCAN_FINISH;}C:模拟,看是否有变色效果D:解决无法拖动查看扫描情况问题android:layout_height="fill_parent">android:orientation="vertical">E:创建集*查询的集privateList<ScanInfo>if(result!=null)scanInfo.is=true;scanInfo.des=result;}elsescanInfo.is=false;scanInfo.des=null;}caseAlertDialog.Builderbuilder=newBuilder(AntiActivity.this);"+赶快杀毒builder.setNegativeButton("下次再说",null);builder.setPositiveButton("立即清除newOnClickListener(publicvoidonClick(DialogInterfacedialog,intwhich)for(ScanInfoscanInfo:Infos){Intentintent=newIntent();}}Toast.makeText(getApplicationContext(),"你的很安全了,继续加油哦!",}onCreate方法代码如下:try

Filefile=newFile(getCacheDir(),"haha.txt");FileOutputStreamfos=newFileOutputStream(file);}catch(Exceptione)//TODOAuto-generatedcatchblock}2、获取应用程序的缓查看软件管理的信息大小,页面<LinearLayout android:layout_height="match_parent">android:hint="请输入要查询的包名"/>android:layout_height="wrap_content"/>B:处理点击-参数设置工程的代码搜索:Cache找到:cache_size_label字段找到布局文件installed_app_details.xmlcache_size_text-->搜索那个Java代码用到它---> entry.cacheSize=stats.cacheSize-->PackageStats--谁调用了 服服对3、获取应用程序的缓存的代码实A:初始化布局view的、得到包名、处理点publicvoidclick(ViewStringpackName=Toast.makeText(this包名不能为空1).show();PackageManagerpm= }}getPackageSizeInfo方法注释RetrievethesizeinformationforaSincethismaytakealittlewhile,theresultbepostedbacktothegivenobserver.Thecallingcontext android.Manifest.permission#GET_PACKAGE_SIZE}permission.应该有{”的Android。#get_package_size}权限。B:用反射得到PackageManager里所有PackageManagerpm=Method[]methods=for(Methodmethod:}运行演示,看日志有没有我们想要的方C:IPackageStatsObserver.Stub()自定拷贝IPackageStatsObserver.aidl文件到android.content.pm包下报错后拷贝PackageStats.aidl文件到android.content.pm包下privateclassMyObserverextendsIPackageStatsObserver.Stub{public pleted(PackageStatspStats,throwsRemoteException{longcacheSize=pStats.cacheSize;longdataSize=pStats.dataSize;longcodeSize=pStats.codeSize 存:"+Formatter.formatFileSize(getApplicationContext(),cacheSize)+"\n"+"+Formatter.formatFileSize(getApplicationContext(),}}

D:执行方PackageManagerpm=Method[]methods=for(Methodmethod:method.invoke(pmpackName,newMyObserver());}}需要限E:解决无法显示结果privateHandlerhandler=newpublicvoidhandleMessage(android.os.Messagemsg){Stringresult=(String)msg.obj;发消息到主线程//tv_result.setText(result);Messagemsg=Message.obtain();msg.obj=result;1、基于做的Demo添加到缓存清理,创建新页面CleanCacheActivity在功能文件并写2、布局文件,基于通讯卫士页面activity_callsms_safe.xml<?xmlversion="1.0"encoding="utf-<LinearLayoutxmlns:android="http://s android:layout_height="wrap_content">android:textSize="20sp"/>android:text="立即清理"/>android:progressDrawable="@drawable/progress_horizontal"/>android:layout_height="wrap_content/>android:orientation="vertical">3progressBar1=(ProgressBar)findViewById(R.gressBar1);tv_status=(TextView)findViewById(R.id.tv_status);ll_container=(LinearLayout)findViewById(R.id.ll_container);AonCreate创建子线程newpublicvoidrun()PackageManagerpm= for(PackageInfopackInfo:packInfos){StringpackName=}aidl文件privateclassMyObserverextendsIPackageStatsObserver.Stubpublic pleted(PackageStatspStats,booleanthrowsRemoteExceptionlongcacheSize=if(cacheSize>0){++Formatter.formatFileSize(getApplicationContext(),}}}PackageManagerpm=getPackageManager();List<PackageInfo>packInfos=pmintprogress=for(PackageInfopackInfo:packInfos){StringpackName=packInfo.packageName;try{Methodmethod=PackageManager.class.getMethod("getPackageSizeInfo",String.class,method.invoke(pm,packName,new}catch(Exceptione)//TODOAuto-generatedcatchblock}progress++;}privateHandlerhandler=newpublicvoidhandleMessage(Messagemsg)switch(msg.what)caseStringname=(String)msg.obj;}for(PackageInfopackInfo:packInfos)StringpackName=tryMethodmethod=PackageManager.class.getMethod("getPackageSizeInfo",String.class,method.invoke(pm,packName,newMyObserver());Messagemsg=Message.obtain();msg.obj=ackInfo.applicationInfo.loadLabel(pm).toString();msg.what=SCANING;}catch(Exceptione)//TODOAuto-generatedcatchblock}progress++;try}catch(InterruptedExceptione)//TODOAuto-generatedcatchblock}}F:显示扫描结定义缓存信息类,发消classDrawableicon;Stringname;longsize;}privateclassMyObserverextendsIPackageStatsObserver.Stubpublic pleted(PackageStatspStats,throwsRemoteExceptionlongcacheSize=pStats.cacheSize+if(cacheSize>0)tryCacheInfocacheInfo=new pm.getApplicationInfo(pStats.packageName,0).loadLabel(pm).toString();cacheInfo.size=cacheSize;Messagemsg=Message.obtain();msg.what=SHOW_SCAN_INFO;msg.obj=cacheInfo;}catch(NameNotFoundExceptione)//TODOAuto-generatedcatchblock}}}}基于布局文件list_app_item.xml修改名字Handler里面处caseCacheInfocacheInfo=(CacheInfo)Viewview=View.inflate(getApplicationContext(),R.layout.list_app_cache,null);ImageViewiv_icon=(ImageView)view.findViewById(R.id.iv_icon);tv_cache_size.setText("缓存大小:"+Formatter.formatFileSize(getApplicationContext(),Messagemsg=Message.obtain();msg.what=SCAN_FINISH;caseSCAN_FINISH:F:如果有缓存应用很多支持上下滚android:layout_height="match_parent">android:orientation="vertical">5A:查看PackageManager方法storagebydeletingLRUsortedlistofcachefilesacrossallapplications.Ifthecurrentlyavailableonthedeviceisgreaterthanorequaltothestorage,nocachefilesarecleared.Ifthecurrentlyavailablestorageonthedeviceislessthanthestorage,someorallofthecachefilesacrossallapplicationsaredeleted(basedonlastaccessedtoincreasethestoragespaceonthedevicetherequestedvalue.Thereisnoguaranteethatclearingthecachefilesfromallapplicationswillclearenoughstoragetoachievethedesired@paramStorageSizeThenumberofbytesofstoragetodbythesystem.SayifStorageSizeisandthecurrentstorageisifXXislessthanYY,justreturn.ifnotXX-YYofbytesif@paramobservercallbackusedtonotifytheoperationis*@paramstoragesize字节数为通过系统释放。如果说storagesize是*XX小于YY,刚刚返回。如果不是免费的xx-yy*LRU(LeastRecentlyUsed) >14:35:14:45:14:49:14:50:14:51:Thenumberofbytesofstorageto*dbythesystem.SayifStorageSizeisandthecurrentstorageisifXXislessthanYY,justreturn.ifnotXX-YYofbytesif5M100MB,5MB空间,如果需要清理的是100MB5MB5MB的空间;如果请求的无限大,有多publicvoidclel(ViewMethod[]methodes=

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论