当前位置: 首页 > 编程日记 > 正文

Android APK加壳技术方案----代码实现

本文章由Jack_Jia编写,转载请注明出处。  

文章链接:http://blog.csdn.net/jiazhijun/article/details/8746917

作者:Jack_Jia    邮箱: 309zhijun@163.com


一、序言


在上篇“Android APK加壳技术方案”(http://blog.csdn.net/jiazhijun/article/details/8678399)博文中,根据加壳数据在解壳程序Dex文件所处的位置,我提出了两种Android Dex加壳技术实现方案,本片博文将对方案1代码实现进行讲解。博友可以根据方案1的代码实现原理对方案2自行实现。

在方案1的代码实现过程中,各种不同的问题接踵出现,最初的方案也在不同问题的出现、解决过程中不断的得到调整、优化。

本文的代码实现了对整个APK包的加壳处理。加壳程序不会对源程序有任何的影响。


二、代码实现


本程序基于Android2.3代码实现,因为牵扯到系统代码的反射修改,本程序不保证在其它android版本正常工作,博友可以根据实现原理,自行实现对其它Android版本的兼容性开发。


1、 加壳程序流程及代码实现

1、加密源程序APK为解壳数据

2、把解壳数据写入解壳程序DEX文件末尾,并在文件尾部添加解壳数据的大小。

3、修改解壳程序DEX头中checksum、signature 和file_size头信息。


       代码实现如下:

package com.android.dexshell;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.zip.Adler32;public class DexShellTool {/*** @param args*/public static void main(String[] args) {// TODO Auto-generated method stubtry {File payloadSrcFile = new File("g:/payload.apk");File unShellDexFile = new File("g:/unshell.dex");byte[] payloadArray = encrpt(readFileBytes(payloadSrcFile));byte[] unShellDexArray = readFileBytes(unShellDexFile);int payloadLen = payloadArray.length;int unShellDexLen = unShellDexArray.length;int totalLen = payloadLen + unShellDexLen +4;byte[] newdex = new byte[totalLen];//添加解壳代码System.arraycopy(unShellDexArray, 0, newdex, 0, unShellDexLen);//添加加密后的解壳数据System.arraycopy(payloadArray, 0, newdex, unShellDexLen,payloadLen);//添加解壳数据长度System.arraycopy(intToByte(payloadLen), 0, newdex, totalLen-4, 4);//修改DEX file size文件头fixFileSizeHeader(newdex);//修改DEX SHA1 文件头fixSHA1Header(newdex);//修改DEX CheckSum文件头fixCheckSumHeader(newdex);String str = "g:/classes.dex";File file = new File(str);if (!file.exists()) {file.createNewFile();}FileOutputStream localFileOutputStream = new FileOutputStream(str);localFileOutputStream.write(newdex);localFileOutputStream.flush();localFileOutputStream.close();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}//直接返回数据,读者可以添加自己加密方法private static byte[] encrpt(byte[] srcdata){return srcdata;}private static void fixCheckSumHeader(byte[] dexBytes) {Adler32 adler = new Adler32();adler.update(dexBytes, 12, dexBytes.length - 12);long value = adler.getValue();int va = (int) value;byte[] newcs = intToByte(va);byte[] recs = new byte[4];for (int i = 0; i < 4; i++) {recs[i] = newcs[newcs.length - 1 - i];System.out.println(Integer.toHexString(newcs[i]));}System.arraycopy(recs, 0, dexBytes, 8, 4);System.out.println(Long.toHexString(value));System.out.println();}public static byte[] intToByte(int number) {byte[] b = new byte[4];for (int i = 3; i >= 0; i--) {b[i] = (byte) (number % 256);number >>= 8;}return b;}private static void fixSHA1Header(byte[] dexBytes)throws NoSuchAlgorithmException {MessageDigest md = MessageDigest.getInstance("SHA-1");md.update(dexBytes, 32, dexBytes.length - 32);byte[] newdt = md.digest();System.arraycopy(newdt, 0, dexBytes, 12, 20);String hexstr = "";for (int i = 0; i < newdt.length; i++) {hexstr += Integer.toString((newdt[i] & 0xff) + 0x100, 16).substring(1);}System.out.println(hexstr);}private static void fixFileSizeHeader(byte[] dexBytes) {byte[] newfs = intToByte(dexBytes.length);System.out.println(Integer.toHexString(dexBytes.length));byte[] refs = new byte[4];for (int i = 0; i < 4; i++) {refs[i] = newfs[newfs.length - 1 - i];System.out.println(Integer.toHexString(newfs[i]));}System.arraycopy(refs, 0, dexBytes, 32, 4);}private static byte[] readFileBytes(File file) throws IOException {byte[] arrayOfByte = new byte[1024];ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();FileInputStream fis = new FileInputStream(file);while (true) {int i = fis.read(arrayOfByte);if (i != -1) {localByteArrayOutputStream.write(arrayOfByte, 0, i);} else {return localByteArrayOutputStream.toByteArray();}}}}


    2、 解壳程序流程及代码实现

          在解壳程序的开发过程中需要解决如下几个关键的技术问题:

         (1)解壳代码如何能够第一时间执行

                  Android程序由不同的组件构成,系统在有需要的时候启动程序组件。因此解壳程序必须在Android系统启动组件之前运行,完成对解壳数                据的解壳及APK文件的动态加载,否则会使程序出现加载类失败的异常。

                  Android开发者都知道Applicaiton做为整个应用的上下文,会被系统第一时间调用,这也是应用开发者程序代码的第一执行点。因此通过对              AndroidMainfest.xml的application的配置可以实现解壳代码第一时间运行。

    <applicationandroid:icon="@drawable/ic_launcher"android:label="@string/app_name"android:theme="@style/AppTheme" android:name="com.android.dexunshell.ProxyApplication" ></application>

         (2)如何替换回源程序原有的Application?

                  当在AndroidMainfest.xml文件配置为解壳代码的Application时。源程序原有的Applicaiton将被替换,为了不影响源程序代码逻辑,我们需要              在解壳代码运行完成后,替换回源程序原有的Application对象。我们通过在AndroidMainfest.xml文件中配置原有Applicaiton类信息来达到我们              的目的。解壳程序要在运行完毕后通过创建配置的Application对象,并通过反射修改回原Application。

    <applicationandroid:icon="@drawable/ic_launcher"android:label="@string/app_name"android:theme="@style/AppTheme" android:name="com.android.dexunshell.ProxyApplication" ><meta-data android:name="APPLICATION_CLASS_NAME" android:value="com.***.Application"/></application>

          

          (3)如何通过DexClassLoader实现对apk代码的动态加载。

                  我们知道DexClassLoader加载的类是没有组件生命周期的,也就是说即使DexClassLoader通过对APK的动态加载完成了对组件类的加载,              当系统启动该组件时,还会出现加载类失败的异常。为什么组件类被动态加载入虚拟机,但系统却出现加载类失败呢?

                  通过查看Android源代码我们知道组件类的加载是由另一个ClassLoader来完成的,DexClassLoader和系统组件ClassLoader并不存在关                  系,系统组件ClassLoader当然找不到由DexClassLoader加载的类,如果把系统组件ClassLoader的parent修改成DexClassLoader,我们就可              以实现对apk代码的动态加载。


         (4)如何使解壳后的APK资源文件被代码动态引用。

                 代码默认引用的资源文件在最外层的解壳程序中,因此我们要增加系统的资源加载路径来实现对借壳后APK文件资源的加载。


        解壳实现代码:

package com.android.dexunshell;import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;import dalvik.system.DexClassLoader;
import android.app.Application;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Bundle;public class ProxyApplication extends Application {private static final String appkey = "APPLICATION_CLASS_NAME";private String apkFileName;private String odexPath;private String libPath;@Overridepublic void onCreate() {// TODO Auto-generated method stubsuper.onCreate();try {File odex = this.getDir("payload_odex", MODE_PRIVATE);File libs = this.getDir("payload_lib", MODE_PRIVATE);odexPath = odex.getAbsolutePath();libPath = libs.getAbsolutePath();apkFileName = odex.getAbsolutePath()+"/payload.apk";File dexFile = new File(apkFileName);if(!dexFile.exists())dexFile.createNewFile();//读取程序classes.dex文件byte[] dexdata = this.readDexFileFromApk();//分离出解壳后的apk文件已用于动态加载this.splitPayLoadFromDex(dexdata);//配置动态加载环境this.configApplicationEnv();} catch (Exception e) {// TODO Auto-generated catch blocke.printStackTrace();}}private void configApplicationEnv() throws NameNotFoundException, IllegalAccessException, InstantiationException, ClassNotFoundException, IOException{ Object currentActivityThread = RefInvoke.invokeStaticMethod("android.app.ActivityThread", "currentActivityThread", new Class[]{}, new Object[]{});HashMap mPackages = (HashMap)RefInvoke.getFieldOjbect("android.app.ActivityThread", currentActivityThread, "mPackages");//替换组件类加载器为DexClassLoader,已使动态加载代码具有组件生命周期WeakReference wr = (WeakReference) mPackages.get(this.getPackageName());DexClassLoader dLoader = new DexClassLoader(apkFileName,odexPath, libPath, (ClassLoader) RefInvoke.getFieldOjbect("android.app.LoadedApk", wr.get(), "mClassLoader"));RefInvoke.setFieldOjbect("android.app.LoadedApk", "mClassLoader", wr.get(), dLoader);//如果源应用配置有Appliction对象,则替换为源应用Applicaiton,以便不影响源程序逻辑。ApplicationInfo appInfo = this.getPackageManager().getApplicationInfo(this.getPackageName(),PackageManager.GET_META_DATA);Bundle bundle =  appInfo.metaData;if(bundle != null && bundle.containsKey(appkey)){String appClassName = bundle.getString(appkey);Application app = (Application)Class.forName(appClassName).newInstance();RefInvoke.setFieldOjbect("android.app.ContextImpl", "mOuterContext", this.getBaseContext(), app);RefInvoke.setFieldOjbect("android.content.ContextWrapper", "mBase", app, this.getBaseContext());Object mBoundApplication = RefInvoke.getFieldOjbect("android.app.ActivityThread", currentActivityThread, "mBoundApplication");Object info = RefInvoke.getFieldOjbect("android.app.ActivityThread$AppBindData", mBoundApplication, "info");RefInvoke.setFieldOjbect("android.app.LoadedApk", "mApplication", info, app);Object oldApplication = RefInvoke.getFieldOjbect("android.app.ActivityThread", currentActivityThread, "mInitialApplication");RefInvoke.setFieldOjbect("android.app.ActivityThread", "mInitialApplication", currentActivityThread, app);ArrayList<Application> mAllApplications = (ArrayList<Application>)RefInvoke.getFieldOjbect("android.app.ActivityThread", currentActivityThread, "mAllApplications");mAllApplications.remove(oldApplication);mAllApplications.add(app);HashMap mProviderMap = (HashMap) RefInvoke.getFieldOjbect("android.app.ActivityThread", currentActivityThread, "mProviderMap");Iterator it = mProviderMap.values().iterator();while(it.hasNext()){Object providerClientRecord = it.next();Object localProvider = RefInvoke.getFieldOjbect("android.app.ProviderClientRecord", providerClientRecord, "mLocalProvider");RefInvoke.setFieldOjbect("android.content.ContentProvider", "mContext", localProvider, app);}RefInvoke.invokeMethod(appClassName, "onCreate", app, new Class[]{}, new Object[]{});}}private void splitPayLoadFromDex(byte[] data) throws IOException{byte[] apkdata = decrypt(data);int ablen = apkdata.length;byte[] dexlen = new byte[4];System.arraycopy(apkdata, ablen - 4, dexlen, 0, 4);ByteArrayInputStream bais = new ByteArrayInputStream(dexlen);DataInputStream in = new DataInputStream(bais);int readInt = in.readInt();System.out.println(Integer.toHexString(readInt));byte[] newdex = new byte[readInt];System.arraycopy(apkdata, ablen - 4 - readInt, newdex, 0, readInt);File file = new File(apkFileName);try {FileOutputStream localFileOutputStream = new FileOutputStream(file);localFileOutputStream.write(newdex);localFileOutputStream.close();} catch (IOException localIOException) {throw new RuntimeException(localIOException);}ZipInputStream localZipInputStream = new ZipInputStream(new BufferedInputStream(new FileInputStream(file)));while (true) {ZipEntry localZipEntry = localZipInputStream.getNextEntry();if (localZipEntry == null) {localZipInputStream.close();break;}String name = localZipEntry.getName();if (name.startsWith("lib/") && name.endsWith(".so")) {File storeFile = new File(libPath+"/"+name.substring(name.lastIndexOf('/')));storeFile.createNewFile();FileOutputStream fos = new FileOutputStream(storeFile);byte[] arrayOfByte = new byte[1024];while (true) {int i = localZipInputStream.read(arrayOfByte);if (i == -1)break;fos.write(arrayOfByte, 0, i);}fos.flush();fos.close();	}localZipInputStream.closeEntry();}localZipInputStream.close();	}private byte[] readDexFileFromApk() throws IOException {ByteArrayOutputStream dexByteArrayOutputStream = new ByteArrayOutputStream();ZipInputStream localZipInputStream = new ZipInputStream(new BufferedInputStream(new FileInputStream(this.getApplicationInfo().sourceDir)));while (true) {ZipEntry localZipEntry = localZipInputStream.getNextEntry();if (localZipEntry == null) {localZipInputStream.close();break;}if (localZipEntry.getName().equals("classes.dex")) {byte[] arrayOfByte = new byte[1024];while (true) {int i = localZipInputStream.read(arrayOfByte);if (i == -1)break;dexByteArrayOutputStream.write(arrayOfByte, 0, i);}}localZipInputStream.closeEntry();}localZipInputStream.close();return dexByteArrayOutputStream.toByteArray();}直接返回数据,读者可以添加自己解密方法private byte[] decrypt(byte[] data){return data;}
}


RefInvoke为反射调用工具类:


package com.android.dexunshell;import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;public class RefInvoke {public static  Object invokeStaticMethod(String class_name, String method_name, Class[] pareTyple, Object[] pareVaules){try {Class obj_class = Class.forName(class_name);Method method = obj_class.getMethod(method_name,pareTyple);return method.invoke(null, pareVaules);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();}  catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchMethodException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (InvocationTargetException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}return null;}public static  Object invokeMethod(String class_name, String method_name, Object obj ,Class[] pareTyple, Object[] pareVaules){try {Class obj_class = Class.forName(class_name);Method method = obj_class.getMethod(method_name,pareTyple);return method.invoke(obj, pareVaules);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();}  catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchMethodException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (InvocationTargetException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}return null;}public static Object getFieldOjbect(String class_name,Object obj, String filedName){try {Class obj_class = Class.forName(class_name);Field field = obj_class.getDeclaredField(filedName);field.setAccessible(true);return field.get(obj);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchFieldException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}return null;}public static Object getStaticFieldOjbect(String class_name, String filedName){try {Class obj_class = Class.forName(class_name);Field field = obj_class.getDeclaredField(filedName);field.setAccessible(true);return field.get(null);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchFieldException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}return null;}public static void setFieldOjbect(String classname, String filedName, Object obj, Object filedVaule){try {Class obj_class = Class.forName(classname);Field field = obj_class.getDeclaredField(filedName);field.setAccessible(true);field.set(obj, filedVaule);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchFieldException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}	}public static void setStaticOjbect(String class_name, String filedName, Object filedVaule){try {Class obj_class = Class.forName(class_name);Field field = obj_class.getDeclaredField(filedName);field.setAccessible(true);field.set(null, filedVaule);} catch (SecurityException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (NoSuchFieldException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalArgumentException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (IllegalAccessException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (ClassNotFoundException e) {// TODO Auto-generated catch blocke.printStackTrace();}		}}


三、总结


本文代码基本实现了APK文件的加壳及脱壳原理,该代码作为实验代码还有诸多地方需要改进。比如:

1、加壳数据的加密算法的添加。

2、脱壳代码由java语言实现,可通过C代码的实现对脱壳逻辑进行保护,以达到更好的反逆向分析效果。


转载于:https://www.cnblogs.com/jiangu66/archive/2013/04/12/3017514.html

相关文章:

【组队学习】【29期】9. 基于transformers的自然语言处理(NLP)入门

9. 基于transformers的自然语言处理(NLP)入门 航路开辟者&#xff1a;多多、erenup、张帆、张贤、李泺秋、蔡杰、hlzhang领航员&#xff1a;张红旭、袁一涵航海士&#xff1a;多多、张红旭、袁一涵、童鸣 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/L…

golang xml和json的解析与生成

golang中解析xml时我们通常会创建与之对应的结构体&#xff0c;一层层嵌套&#xff0c;完成复杂的xml解析。 package main;import ("encoding/xml""fmt" )//我们通过定义一个结构体&#xff0c;来解析xml //注意&#xff0c;结构体中的字段必须是可导出的 …

mongodb 索引去重_朋友问你 MongoDB 是什么?给他看这篇就好了

点击▲关注 “ITPUB” 给公众号标星置顶更多精彩 第一时间直达来源&#xff1a;hello_锦泰blog.csdn.net/hayre/article/details/80628431总结的目的在于回顾MongoDB的相关知识点&#xff0c;明确MongoDB在企业级应用中充当的角色&#xff0c;为之后的技术选型提供一个可查阅…

Win32 API消息函数:GetMessagePos

函数功能&#xff1a;该函数返回表示屏幕坐标下光标位置的长整数值。此位置表示当上一消息由GetMessage取得时鼠标占用的点。 函数原型&#xff1a;DWORD GetMessagePos&#xff08;VOID&#xff09; 参数&#xff1a;无。 返回值&#xff1a;返回值给出光标位置的X&a…

【组队学习】【29期】11. 青少年编程(Scratch 二级)

11. 青少年编程&#xff08;Scratch 二级&#xff09; 航路开辟者&#xff1a;王思齐、马燕鹏领航员&#xff1a;马燕鹏航海士&#xff1a;王思齐、马燕鹏 基本信息 开源内容&#xff1a;https://github.com/datawhalechina/team-learning-program/tree/master/Scratch内容属…

TP基础问题第一天

1、入口文件中定义的内容&#xff0c;说出3点 1. 检测PHP环境 if(version_compare(PHP_VERSION,5.3.0,<)) die(require PHP > 5.3.0 !); 2. 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false define(APP_DEBUG,True); 3. 定义应用目录 define(APP_P…

均值聚类散点图怎么画_GraphPad Prism 绘图教程 | 手把手教你绘制Column散点图

散点图&#xff0c;最常见的散点图是数据在直角坐标系中的分布图&#xff0c;我们可以考察坐标点的分布&#xff0c;判断两变量之间是否存在某种关联或总结坐标点的分布模式和趋势等&#xff1b;此外&#xff0c;我们还会用到多组数据的散点图&#xff0c;那我们如何来操作呢&a…

lucene3.0范围查找TermRangeQuery

原文链接:http://www.wenhq.com/article/view_415.html欢迎转载,请注明出处:亲亲宝宝 lucene3.0范围查找TermRangeQuery 在lucene3.0中&#xff0c;范围查询也有很大的变化&#xff0c;RangeQuery已经不推荐使用&#xff0c;使用TermRangeQuery和NumericRangeQuery两个替代。Te…

开源大数据周刊-第11期

摘要&#xff1a;开源有四个阶段&#xff1a;拥抱开源、回馈开源、融合开源、回报开源阿里云E-Mapreduce动态E-Mapreduce团队1.3.3版本 (已经发布)商业化发布&#xff0c;用户无需申请即可使用E-MapReduce服务1.3.4版本 (正在研发)升级jdk到1.8升级Hadoop到2.7.2添加python2.7.…

【青少年编程】【四级】绘制花瓣

「青少年编程竞赛交流群」已成立&#xff08;适合6至18周岁的青少年&#xff09;&#xff0c;公众号后台回复【Scratch】或【Python】&#xff0c;即可进入。如果加入了之前的社群不需要重复加入。 我们将有关编程题目的教学视频已经发布到抖音号21252972100&#xff0c;小马老…

一加7t人脸识别_一加7T系列国行版开启预约 谷歌Pixel 4系列高清图曝光

据一加手机官方消息&#xff0c;一加7T系列国行版已经开启预约&#xff0c;全新系列将于10月15日正式发布。一加7T采用6.55英寸&#xff0c;分辨率为24001080的AMOLED显示屏&#xff0c;具有90Hz刷新率、峰值亮度为1000尼特和HDR10 &#xff0c;采用屏下指纹。硬件方面&#xf…

MS IME 2007输入法

CH到JP 快捷键 ALTShift A到あ 快捷键 ctrlcaps lock 切换到片假 快捷键 altcaps lock 切换回来 快捷键 shiftcaps lock比如我输あした。本来按空格该出现"明日"的汉字三个假名下面的横线要是分开的话,你按住"SHIFT""左右箭头…

Weex第一天:手势

实验特征 Weex封装原生触摸事件以提供手势系统。使用手势类似于在Weex中使用事件。只需on在节点上设置属性即可收听手势。 类型 目前&#xff0c;有四种类型的手势&#xff1a; Touch。当触摸点被放置&#xff0c;移动或从触摸表面移除时&#xff0c;触摸手势被触发。触摸手势是…

【青少年编程(第30周)】关于青少年编程能力等级测评的科普!

2021年09月12日&#xff08;周日&#xff09;晚20:00我们在青少年编程竞赛交流群开展了第三十次直播活动。我们直播活动的主要内容如下&#xff1a; 首先&#xff0c;我们奖励了上周测试超过60分的小朋友。 其次&#xff0c;我们一起分析了电子学会Scratch四级的考试要求&…

ansys大变形开关要不要打开_ANSYS不收敛问题的解决办法

笔者应聘时发现此公众号内容也备受同行专家认可&#xff0c;继续努力&#xff0c;再接再厉&#xff01;本文经验是基于仿真秀专家学者总结&#xff0c;在此感谢仿真秀的支持与鼓励。80%的线性不收敛都是因为接触问题&#xff01;&#xff01;&#xff01;一、材料问题的不收敛可…

JAVA环境变量的配置

右键计算机—>属性—>高级系统设置—>环境变量&#xff0c;在用户变量那里添加jdk文件夹中的bin文件夹的路径&#xff0c;如&#xff1a; 变量名&#xff1a;PATH 值&#xff1a;E:\Program Files (x86)\Java\jdk1.7.0_09\bin 如果只是做java程序编译那么就可以用了&a…

【青少年编程】【四级】从小到大排序

「青少年编程竞赛交流群」已成立&#xff08;适合6至18周岁的青少年&#xff09;&#xff0c;公众号后台回复【Scratch】或【Python】&#xff0c;即可进入。如果加入了之前的社群不需要重复加入。 微信后台回复“资料下载”可获取以往学习的材料&#xff08;视频、代码、文档&…

ulimit -n 修改

通过ulimit -n命令可以查看linux系统里打开文件描述符的最大值&#xff0c;一般缺省值是1024&#xff0c;对一台繁忙的服务器来说&#xff0c;这个值偏小&#xff0c;所以有必要重新设置linux系统里打开文件描述符的最大值。那么应该在哪里设置呢&#xff1f; 最正确的做法是在…

变频器参数设置_变频器接线和参数设置

工业上用的变频器&#xff0c;分为单相和三相两种&#xff0c;这个是从主回路供电的电压来区分的&#xff0c;三相就是主回路要接入RST三相380伏交流电&#xff0c;输出接UVW三相线给电机&#xff1b;而单相是主回路接入单相220伏LN交流电&#xff0c;输出同样接UVW三相线给电机…

【青少年编程】【二级】货运飞船

「青少年编程竞赛交流群」已成立&#xff08;适合6至18周岁的青少年&#xff09;&#xff0c;公众号后台回复【Scratch】或【Python】&#xff0c;即可进入。如果加入了之前的社群不需要重复加入。 我们将有关编程题目的教学视频已经发布到抖音号21252972100&#xff0c;小马老…

JavaScript系统对象

1. 本地对象&#xff08;非静态对象&#xff09; 常用对象有&#xff1a;   Object、Function、Array、String、Boolean、Number、Date、RegExp、Error   注&#xff1a;本地对象需要new之后再使用。 2. 内置对象&#xff08;静态对象&#xff09; Global、Math   注&…

循环map_python函数 map函数—比for还好用的循环

描述&#xff1a;产生一个将 function 应用于迭代器中所有元素并返回结果的迭代器。如果传递了额外的 iterable 实参&#xff0c;function 必须接受相同个数的实参&#xff0c;并使用所有迭代器中并行获取的元素。当有多个迭代器时&#xff0c;最短的迭代器耗尽则整个迭代结束。…

30分钟掌握STL

三十分钟掌握STL STL概述 STL的一个重要特点是数据结构和算法的分离。尽管这是个简单的概念&#xff0c;但这种分离确实使得STL变得非常通用。例如&#xff0c;由于STL的sort()函数是完全通用的&#xff0c;你可以用它来操作几乎任何数据集合&#xff0c;包括链表&#xff0c;容…

JavaSE基础:Arrays工具类

Java工具类: Arrays Arrays类是数组的操作类,定义在java.util包中,主要功能是实现数组元素的查找/数组内容的充填/排序等功能 1.排序数组的sort方法 重点:对数组元素进行排序操作,默认由小到大排序. 该方法的参数不仅可以是基础数据类型的数组&#xff0c;也可以是对象引用的数…

【青少年编程(第31周)】一个有趣又有料的抖音号!

2021年09月19日&#xff08;周日&#xff09;晚20:00我们在青少年编程竞赛交流群开展了第三十一次直播活动。我们直播活动的主要内容如下&#xff1a; 首先&#xff0c;我们奖励了上周测试超过30分的小朋友。 其次&#xff0c;我们讲解了上次测试中小朋友们做错的题目Scratch青…

android根据ip获取域名_android常用工具类 通过域名获取ip

/*** 编写多线程程序是为了实现多任务的并发执行&#xff0c;从而能够更好地与用户交互。* 一般有三种方法&#xff0c;Thread,Runnable,Callable.* Runnable和Callable的区别是&#xff0c;* (1)Callable规定的方法是call(),Runnable规定的方法是run().* (2)Callable的任务执行…

河南省第二届ACM程序设计大赛解题报告(置换群)

1. 1 /*2 前两道题一直在纠结提议&#xff0c;特别是第二题&#xff0c;看了别人的代码才明白过来题意&#xff0c;由测试用例都没明白 3 */4 #include <iostream>5 #include <cstring>6 #include <queue>7 using namespace std;8 9 const int maxn 55; 10 …

【青少年编程】【四级】创意画图

「青少年编程竞赛交流群」已成立&#xff08;适合6至18周岁的青少年&#xff09;&#xff0c;公众号后台回复【Scratch】或【Python】&#xff0c;即可进入。如果加入了之前的社群不需要重复加入。 我们将有关编程题目的教学视频已经发布到抖音号21252972100&#xff0c;小马老…

《机器学习实践》程序清单2-2

将文本记录转换为NumPy的解析程序 def file2matrix(filename):print("读入文件" str(filename))#以下两行为打开文本文件并读取内容到数组&#xff0c;有没有发现这个操作好简单&#xff1f;&#xff01;fr open(filename)arrayOLines fr.readlines() #把文件中的…

vba保存文件为xlsx格式_Vba把Excel某个范围保存为XLS工作薄文件

Dim wn$, shp As Shape, arrApplication.ScreenUpdating FalseApplication.DisplayAlerts Falsewn [a1]arr Range("o3:o" & Range("o65536").End(xlUp).Row)Sheets("报表").CopyWith ActiveWorkbookWith .Sheets(1).Rows("1:2"…