Grape

Grape

Graduated in Computer Science and Engineering, but currently working with GNU/Linux infrastructure and in the spare time I'm an Open Source programmer (Python and C), a drawer and author in the YINGJUE Blog.

Android 源码开发

准备开发环境

使用docker-aosp搭建

编译步骤

source build/envsetup.sh 
including device/asus/deb/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup …

Docker 基础

Dockerizing a Python Flask App

Install nginx 1.27.2

docker pull nginx:1.27.2
docker pull python:3.13
services:
  web:
    container_name: example_nginx
    image: nginx:1.27.2
    privileged: true
    ports:
      - 80:80
      - 443:443
    volumes:
      - "$PWD/html:/usr/share/nginx/html:rw"
      - "$PWD/conf/conf.d:/etc/nginx/conf.d"
      - "$PWD/logs:/var/log/nginx"
      - "$PWD/certs:/etc/nginx/certs"

自 …

Android ClassLoader

Class

// http://androidxref.com/6.0.1_r10/xref/libcore/libart/src/main/java/java/lang/Class.java
public final class Class<T> implements Serializable, AnnotatedElement, GenericDeclaration, Type {
    static native Class<?> classForName(String className, boolean shouldInitialize,
        ClassLoader classLoader) throws ClassNotFoundException;
}

VMClassLoader

// http://androidxref.com/6.0.1_r10/xref/libcore/libart/src/main/java/java/lang/VMClassLoader.java
package java.lang;
class VMClassLoader{
    native static Class …

Android ProgressBar Circle

Shape

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape=["rectangle" | "oval" | "line" | "ring"] 
    android:innerRadius="integer"
    android:innerRadiusRatio="integer"
    android:thickness="integer"
    android:thicknessRatio="integer"
    android:useLevel="boolean"
    >
    <corners
        android:radius="integer"
        android:topLeftRadius="integer"
        android:topRightRadius="integer"
        android:bottomLeftRadius="integer"
        android:bottomRightRadius="integer" />
    <gradient
        android:angle="integer"
        android:centerX="float"
        android:centerY="float …

Java 知识点

可变参数

变长参数是 Java 的一个语法糖,本质上还是基于数组的实现:

void Foo(String... args);
void Foo(String[] args);

// Method signature
([Ljava/lang/String;)V // public void foo(String[] args)

注意事项: - 可变参数只能作为函数的最后 …

Github Usage

创建ssh-key 并且重命名

cd ~/.ssh
ssh-keygen -t rsa -C "example@example.com"
ssh-keygen -t ed25519 -C "your_email@example.com"

on Windows:

eval `ssh-agent -s`

将ssh-key添加到ssh agent

ssh-add example

配置,将不同账号与ssh-key关联

vim config
Host example
    Hostname github.com
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/example

在git服务器上添加公钥

cat example.pub

测试

ssh -T …

7z 解压文件名乱码

问题描述

在Windows 7中文版系统上使用7z压缩一些文件后,然后在Windows 10 Pro英文版系统上解压,发现凡是文件名中包含中文,最后都是乱码。

原因

使用7z压缩文件时,对文件名的编码是采用Windows 系统默认字符集,而不是unicode编码。

解决方法

  • 使用 …

环境安装

  • frida-server
  • frida-tools
pip3 install frida
pip3 install frida-tools

基础用法

frida-ps -U
frida-trace -U -i "recvfrom" com.android.chrome

Javascript example 1

Java.enumerateLoadedClasses(
  {
  "onMatch": function(className){ 
        console.log(className) 
    },
  "onComplete":function(){}
  }
)

Javascript example 2:chrome.js

Java.perform(function () {
    var Activity = Java.use("android.app.Activity");
    Activity.onResume.implementation = function () {
        console.log("[*] onResume() got called!");
        this.onResume …

使用方法

目标进程需要打开调试开关,android:debuggable=true

adb shell am profile start com.tencent.mm /data/local/tmp/1.trace
adb shell am profile stop com.tencent.mm
adb pull /data/local/tmp/1.trace
~/adt-2014/sdk/tools/traceview 1.trace

文件格式

http://androidxref.com/6.0.1_r10/xref …