├── Arm64Generator.h ├── ElfParser.h ├── Injector.cpp ├── KDrv.cpp ├── KDrv.h ├── KDrvImpl.cpp ├── LICENSE ├── ProcessControl.h ├── RemoteDlsym.h ├── TouchLab.c ├── TouchLabStructs.hpp ├── binso.hpp ├── build.sh ├── catlog.sh ├── killserver.sh ├── readme.md ├── run.sh ├── trans2Char.py └── util.h /Arm64Generator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #ifndef _ARM64GENERATOR_H_ 3 | #define _ARM64GENERATOR_H_ 4 | 5 | #include 6 | #include 7 | #include "util.h" 8 | #include 9 | 10 | static u32 generic_inst_b(u64 pc,u64 target){ 11 | const uint32_t inst_b_head=0b000101 << 26; 12 | uint32_t offset=target-pc; 13 | offset/=4; 14 | 15 | u32 inst=inst_b_head | (offset & 0b00000011111111111111111111111111); 16 | 17 | return inst; 18 | } 19 | static u32 generic_inst_movz(u16 imm,u16 hw,u16 ridx){ 20 | const u32 inst_template=0b11010010100000000000000000000000; 21 | 22 | u32 imm_or = static_cast(imm) << 5; 23 | u32 hw_or = static_cast(hw) << 21; 24 | 25 | return inst_template | imm_or | hw_or | static_cast(ridx); 26 | } 27 | static u32 generic_inst_movk(u16 imm,u16 hw,u16 ridx){ 28 | const u32 inst_template=0b11110010100000000000000000000000; 29 | 30 | u32 imm_or = static_cast(imm) << 5; 31 | u32 hw_or = static_cast(hw) << 21; 32 | 33 | return inst_template | imm_or | hw_or | static_cast(ridx); 34 | } 35 | static u32 generic_inst_blr(u32 ridx){ 36 | const u32 blr_template=0b11010110001111110000000000000000; 37 | return blr_template | (static_cast(ridx) << 5); 38 | } 39 | static u32 generic_inst_br(u32 ridx){ 40 | const u32 br_template= 0b11010110000111110000000000000000; 41 | return br_template | (static_cast(ridx) << 5); 42 | } 43 | 44 | static void generic_inst_movabs(u32 ridx,u64 imm,u32* out){ 45 | u16 subdata[4]; 46 | *(u64*)subdata=imm; 47 | 48 | out[0]=generic_inst_movz(subdata[0],0,ridx); 49 | for(int i=1;i<4;i++){ 50 | out[i]=generic_inst_movk(subdata[i],i,ridx); 51 | } 52 | } 53 | static void generic_inst_jmpabs(u64 target,u32 ridx,u32* out){ 54 | u16 subdata[4]; 55 | *(u64*)subdata=target; 56 | 57 | out[0]=generic_inst_movz(subdata[0],0,ridx); 58 | for(int i=1;i<4;i++){ 59 | out[i]=generic_inst_movk(subdata[i],i,ridx); 60 | } 61 | 62 | const u32 br_template=0b11010110000111110000000000000000; 63 | out[4] = br_template | (ridx << 5); 64 | } 65 | 66 | static int generic_invoker(uintptr_t CB,uintptr_t JmpAddr,u32 oldinst,u32 *out){ 67 | memcpy( 68 | &out[0], 69 | "\xfd\x7b\xbd\xa9\xff\x83\x04\xd1\xe0\x07\x00\xa9\xe2\x0f\x01\xa9\xe4\x17\x02\xa9\xe6\x1f\x03\xa9\xe8\x27\x04\xa9\xea\x2f\x05\xa9\xec\x37\x06\xa9\xee\x3f\x07\xa9\xf0\x47\x08\xa9\xf2\x4f\x09\xa9\xf4\x57\x0a\xa9\xf6\x5f\x0b\xa9\xf8\x67\x0c\xa9\xfa\x6f\x0d\xa9\xfc\x77\x0e\xa9\xfe\x7b\x00\xf9\xe0\x03\x00\x91", 70 | 76 71 | ); 72 | generic_inst_movabs(9,CB,&out[19]); 73 | out[23] = generic_inst_blr(9); 74 | 75 | memcpy(&out[24], 76 | "\xe0\x07\x40\xa9\xe2\x0f\x41\xa9\xe4\x17\x42\xa9\xe6\x1f\x43\xa9\xe8\x27\x44\xa9\xea\x2f\x45\xa9\xec\x37\x46\xa9\xee\x3f\x47\xa9\xf0\x47\x48\xa9\xf2\x4f\x49\xa9\xf4\x57\x4a\xa9\xf6\x5f\x4b\xa9\xf8\x67\x4c\xa9\xfa\x6f\x4d\xa9\xfc\x77\x4e\xa9\xfe\x7b\x40\xf9\xea\x7f\x40\xf9\xff\x83\x04\x91\xfd\x7b\xc3\xa8", 77 | 76); 78 | /* 79 | CBZ X9,CONT 80 | RET 81 | CONT: 82 | */ 83 | memcpy(&out[43],"\x49\x00\x00\xb4\xc0\x03\x5f\xd6",8); 84 | out[45] = oldinst; 85 | 86 | generic_inst_movabs(9,JmpAddr,&out[46]); 87 | 88 | out[50] = generic_inst_br(9); 89 | 90 | return 52; 91 | } 92 | 93 | #endif 94 | -------------------------------------------------------------------------------- /ElfParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by www on 4/27/2023. 3 | // 4 | 5 | #ifndef INJECTOR_ELF_PARSER_H 6 | #define INJECTOR_ELF_PARSER_H 7 | 8 | #include 9 | #include 10 | #include "util.h" 11 | #include "RemoteDlsym.h" 12 | 13 | unsigned int 14 | elf_hash (const char *name) 15 | { 16 | const unsigned char *iname = (const unsigned char *) name; 17 | unsigned int hash = (unsigned int) *iname++; 18 | if (*iname != '\0') 19 | { 20 | hash = (hash << 4) + (unsigned int) *iname++; 21 | if (*iname != '\0') 22 | { 23 | hash = (hash << 4) + (unsigned int) *iname++; 24 | if (*iname != '\0') 25 | { 26 | hash = (hash << 4) + (unsigned int) *iname++; 27 | if (*iname != '\0') 28 | { 29 | hash = (hash << 4) + (unsigned int) *iname++; 30 | while (*iname != '\0') 31 | { 32 | unsigned int hi; 33 | hash = (hash << 4) + (unsigned int) *iname++; 34 | hi = hash & 0xf0000000; 35 | 36 | /* The algorithm specified in the ELF ABI is as 37 | follows: 38 | 39 | if (hi != 0) 40 | hash ^= hi >> 24; 41 | 42 | hash &= ~hi; 43 | 44 | But the following is equivalent and a lot 45 | faster, especially on modern processors. */ 46 | 47 | hash ^= hi; 48 | hash ^= hi >> 24; 49 | } 50 | } 51 | } 52 | } 53 | } 54 | return hash; 55 | } 56 | uint_fast32_t 57 | gnu_hash (const char *s) 58 | { 59 | uint_fast32_t h = 5381; 60 | for (unsigned char c = *s; c != '\0'; c = *++s) 61 | h = h * 33 + c; 62 | return h & 0xffffffff; 63 | } 64 | 65 | 66 | Elf64_Phdr *elf_get_phdr(u8*elf_file,Elf64_Word type){ 67 | Elf64_Ehdr *ehdr=(Elf64_Ehdr *)elf_file; 68 | Elf64_Phdr *phdr=(Elf64_Phdr *)(elf_file+ehdr->e_phoff); 69 | for(int i=0;ie_phnum;i++){ 70 | if(phdr->p_type==type){ 71 | return phdr; 72 | } 73 | phdr++; 74 | } 75 | return nullptr; 76 | } 77 | uint64_t elf_virt_to_offs(u8*elf_file,uint64_t virt){ 78 | Elf64_Ehdr *ehdr=(Elf64_Ehdr *)elf_file; 79 | Elf64_Phdr *phdr=(Elf64_Phdr *)(elf_file+ehdr->e_phoff); 80 | for(int i=0;ie_phnum;i++){ 81 | if(phdr->p_type==PT_LOAD){ 82 | if(virt>=phdr->p_vaddr && virt<(phdr->p_vaddr+phdr->p_filesz)){ 83 | return virt-phdr->p_vaddr+phdr->p_offset; 84 | } 85 | } 86 | phdr++; 87 | } 88 | return 0; 89 | } 90 | 91 | size_t elf_get_image_sz(u8* elf_file){ 92 | Elf64_Ehdr *ehdr=(Elf64_Ehdr *)elf_file; 93 | Elf64_Phdr *phdr=(Elf64_Phdr *)(elf_file+ehdr->e_phoff); 94 | uintptr_t maxaddr=0; 95 | uintptr_t minaddr=0xffffffffffffffff; 96 | uintptr_t minaddr_init=false; 97 | for(int i=0;ie_phnum;i++){ 98 | if(phdr->p_vaddr+phdr->p_memsz>maxaddr){ 99 | maxaddr=phdr->p_vaddr+phdr->p_memsz; 100 | } 101 | if(minaddr_init==false){ 102 | minaddr=phdr->p_vaddr; 103 | minaddr_init=true; 104 | } 105 | if(phdr->p_vaddr < minaddr){ 106 | minaddr=phdr->p_vaddr; 107 | } 108 | phdr++; 109 | } 110 | return maxaddr; 111 | } 112 | Elf64_Dyn *elf_get_dynseg(u8*elf_file,Elf64_Sxword tag){ 113 | Elf64_Phdr *phdr=elf_get_phdr(elf_file,PT_DYNAMIC); 114 | Elf64_Dyn *dyn=(Elf64_Dyn *)(phdr->p_offset+elf_file); 115 | while(dyn->d_tag!=DT_NULL){ 116 | if(dyn->d_tag==tag){ 117 | return dyn; 118 | } 119 | dyn++; 120 | } 121 | return nullptr; 122 | } 123 | u8* elf_get_dynseg_addr(u8*elf_file,Elf64_Sxword tag){ 124 | Elf64_Dyn *dynseg=elf_get_dynseg(elf_file,tag); 125 | if(dynseg != nullptr) 126 | { 127 | uint64_t offs=elf_virt_to_offs(elf_file,dynseg->d_un.d_ptr); 128 | //p1x(offs); 129 | return elf_file+offs; 130 | } 131 | return nullptr; 132 | } 133 | uint64_t elf_get_dynseg_vaddr(u8*elf_file,Elf64_Sxword tag){ 134 | Elf64_Dyn *dynseg=elf_get_dynseg(elf_file,tag); 135 | if(dynseg != nullptr) 136 | { 137 | uint64_t vaddr=dynseg->d_un.d_ptr; 138 | //p1x(offs); 139 | return vaddr; 140 | } 141 | return 0; 142 | } 143 | Elf64_Xword elf_get_dynseg_val(u8*elf_file,Elf64_Sxword tag){ 144 | Elf64_Dyn *dynseg=elf_get_dynseg(elf_file,tag); 145 | if(dynseg != nullptr){ 146 | return dynseg->d_un.d_val; 147 | } 148 | return 0; 149 | } 150 | 151 | Elf64_Shdr *elf_get_shdr(u8*elf_file,Elf64_Word type){ 152 | Elf64_Ehdr *ehdr=(Elf64_Ehdr *)elf_file; 153 | Elf64_Shdr *shdr=(Elf64_Shdr *)((u8*)elf_file+ehdr->e_shoff); 154 | 155 | for(int i=0;ie_shnum;i++){ 156 | if(shdr->sh_type==type){ 157 | return shdr; 158 | } 159 | shdr++; 160 | } 161 | return nullptr; 162 | } 163 | u8* elf_get_shdr_addr(u8*elf_file,Elf64_Word type){ 164 | Elf64_Shdr *shdr=elf_get_shdr(elf_file,type); 165 | if(shdr!= nullptr){ 166 | return shdr->sh_offset+elf_file; 167 | } 168 | return nullptr; 169 | } 170 | Elf64_Xword elf_get_shdr_sz(u8*elf_file,Elf64_Word type){ 171 | Elf64_Shdr *shdr=elf_get_shdr(elf_file,type); 172 | if(shdr!= nullptr){ 173 | return shdr->sh_size; 174 | } 175 | return 0; 176 | } 177 | 178 | const char *elf_get_require_ver(u8*elf_file,Elf64_Xword symidx){ 179 | const char* strtab=(decltype(strtab))elf_get_dynseg_addr(elf_file,DT_STRTAB); 180 | Elf64_Sym *symtab=(Elf64_Sym *)elf_get_dynseg_addr(elf_file,DT_SYMTAB); 181 | Elf64_Versym *versymtab=(Elf64_Versym *)elf_get_dynseg_addr(elf_file,DT_VERSYM); 182 | Elf64_Verneed *verneedtab=(Elf64_Verneed *)elf_get_dynseg_addr(elf_file,DT_VERNEED); 183 | if(symtab == nullptr || versymtab == nullptr || verneedtab == nullptr || strtab== nullptr) 184 | return nullptr; 185 | Elf64_Versym versym=versymtab[symidx]; 186 | if(versym==0 || versym==1) 187 | return nullptr; 188 | while(1){ 189 | Elf64_Vernaux *vernaux=(Elf64_Vernaux *)(verneedtab->vn_aux+(u8*)verneedtab); 190 | while(1){ 191 | Elf64_Half other=vernaux->vna_other; 192 | //p1x(other); 193 | if((other & 0x8000)==0){ 194 | if(other==(versym & 0x7FFF)){ 195 | return strtab+vernaux->vna_name; 196 | } 197 | } 198 | if(vernaux->vna_next==0) 199 | break; 200 | vernaux=(decltype(vernaux))((u8*)vernaux+vernaux->vna_next); 201 | } 202 | if(verneedtab->vn_next==0) 203 | break; 204 | verneedtab=(decltype(verneedtab))((u8*)verneedtab+verneedtab->vn_next); 205 | } 206 | return nullptr; 207 | } 208 | const char *elf_get_require_file(u8*elf_file,Elf64_Xword symidx){ 209 | const char* strtab=(decltype(strtab))elf_get_dynseg_addr(elf_file,DT_STRTAB); 210 | Elf64_Sym *symtab=(Elf64_Sym *)elf_get_dynseg_addr(elf_file,DT_SYMTAB); 211 | Elf64_Versym *versymtab=(Elf64_Versym *)elf_get_dynseg_addr(elf_file,DT_VERSYM); 212 | Elf64_Verneed *verneedtab=(Elf64_Verneed *)elf_get_dynseg_addr(elf_file,DT_VERNEED); 213 | if(symtab == nullptr || versymtab == nullptr || verneedtab == nullptr || strtab== nullptr) 214 | return nullptr; 215 | Elf64_Versym versym=versymtab[symidx]; 216 | if(versym==0 || versym==1) 217 | return nullptr; 218 | while(1){ 219 | Elf64_Vernaux *vernaux=(Elf64_Vernaux *)(verneedtab->vn_aux+(u8*)verneedtab); 220 | while(1){ 221 | Elf64_Half other=vernaux->vna_other; 222 | //p1x(other); 223 | if((other & 0x8000)==0){ 224 | if(other==(versym & 0x7FFF)){ 225 | return strtab+verneedtab->vn_file; 226 | } 227 | } 228 | if(vernaux->vna_next==0) 229 | break; 230 | vernaux=(decltype(vernaux))((u8*)vernaux+vernaux->vna_next); 231 | } 232 | if(verneedtab->vn_next==0) 233 | break; 234 | verneedtab=(decltype(verneedtab))((u8*)verneedtab+verneedtab->vn_next); 235 | } 236 | return nullptr; 237 | } 238 | int elf_lookup_symidx(u8*elf_file,const char* name){ 239 | uint_fast32_t namehash=gnu_hash(name); 240 | 241 | uint32_t *hashtab=(decltype(hashtab))elf_get_dynseg_addr(elf_file,DT_GNU_HASH); 242 | const char *strtab=(decltype(strtab))elf_get_dynseg_addr(elf_file,DT_STRTAB); 243 | Elf64_Sym *symtab=(decltype(symtab)) elf_get_dynseg_addr(elf_file,DT_SYMTAB); 244 | 245 | const uint32_t nbuckets = hashtab[0]; // 哈希桶的数量 246 | const uint32_t symndx = hashtab[1]; // 符号表中第一个全局符号的索引 247 | const uint32_t bloom_size = hashtab[2]; // Bloom 过滤器的掩码数 248 | const uint32_t bloom_shift = hashtab[3]; 249 | 250 | bloom_el_t *blooms=(decltype(blooms))&hashtab[4]; 251 | const uint32_t* buckets = (decltype(buckets))&blooms[bloom_size]; 252 | const uint32_t* chain = &buckets[nbuckets]; 253 | 254 | bloom_el_t word = blooms[(namehash / ELFCLASS_BITS) % bloom_size]; 255 | bloom_el_t mask = 0 256 | | (bloom_el_t)1 << (namehash % ELFCLASS_BITS) 257 | | (bloom_el_t)1 << ((namehash >> bloom_shift) % ELFCLASS_BITS); 258 | if ((word & mask) != mask) { 259 | return 0; 260 | } 261 | uint32_t symix = buckets[namehash % nbuckets]; 262 | if (symix < symndx) { 263 | return 0; 264 | } 265 | while (true) { 266 | const char* symname = strtab + symtab[symix].st_name; 267 | const uint32_t hash = chain[symix - symndx]; 268 | 269 | if ((namehash|1) == (hash|1) && strcmp(name, symname) == 0) { 270 | return symix; 271 | } 272 | 273 | /* Chain ends with an element with the lowest bit set to 1. */ 274 | if (hash & 1) { 275 | break; 276 | } 277 | 278 | symix++; 279 | } 280 | 281 | return 0; 282 | } 283 | 284 | Elf64_Addr elf_dlvsym_vaddr(u8*elf_file,const char * __name,const char * __version) 285 | { 286 | const char* strtab=(decltype(strtab))elf_get_dynseg_addr(elf_file,DT_STRTAB); 287 | Elf64_Sym *symtab=(Elf64_Sym *)elf_get_dynseg_addr(elf_file,DT_SYMTAB); 288 | Elf64_Versym *versymtab=(Elf64_Versym *)elf_get_dynseg_addr(elf_file,DT_VERSYM); 289 | Elf64_Verdef *verdeftab=(Elf64_Verdef *)elf_get_dynseg_addr(elf_file,DT_VERDEF); 290 | int symidx=elf_lookup_symidx(elf_file,__name); 291 | if(symtab == nullptr || versymtab == nullptr || verdeftab == nullptr || strtab== nullptr) 292 | return 0; 293 | Elf64_Versym versym=versymtab[symidx]; 294 | if(versym==0 || versym==1) 295 | return 0; 296 | while(1){ 297 | Elf64_Verdaux *verdaux=(Elf64_Verdaux *)(verdeftab->vd_aux+(u8*)verdeftab); 298 | while(1){ 299 | const char *vername=strtab+verdaux->vda_name; 300 | puts(vername); 301 | if(!strcmp(vername,__version)){ 302 | return symtab[symidx].st_value; 303 | } 304 | if(verdaux->vda_next ==0) 305 | break; 306 | verdaux=(decltype(verdaux))((u8*)verdaux+verdaux->vda_next); 307 | } 308 | if(verdeftab->vd_next == 0) 309 | break; 310 | verdeftab=(decltype(verdeftab))((u8*)verdeftab+verdeftab->vd_next); 311 | } 312 | return 0; 313 | } 314 | Elf64_Addr elf_dlsym_vaddr(u8*elf_file,const char * __name) 315 | { 316 | const char* strtab=(decltype(strtab))elf_get_dynseg_addr(elf_file,DT_STRTAB); 317 | Elf64_Sym *symtab=(Elf64_Sym *)elf_get_dynseg_addr(elf_file,DT_SYMTAB); 318 | int symidx=elf_lookup_symidx(elf_file,__name); 319 | if(symtab == nullptr || strtab== nullptr || symidx==0) 320 | return 0; 321 | 322 | return symtab[symidx].st_value; 323 | } 324 | 325 | void mapelf(pid_t pid,uintptr_t remoteaddr,u8*elf_file,u8*rwx_buff){ 326 | //Elf64_Addr ssym= elf_dlsym_vaddr(elf_file,"main"); 327 | //p1x(ssym); 328 | //exit(1); 329 | 330 | Elf64_Ehdr *ehdr=(Elf64_Ehdr *)elf_file; 331 | Elf64_Phdr *phdr=(Elf64_Phdr *)(elf_file+ehdr->e_phoff); 332 | for(int i=0;ie_phnum;i++){ 333 | memcpy(rwx_buff+phdr->p_vaddr,elf_file+phdr->p_offset,phdr->p_filesz); 334 | phdr++; 335 | } 336 | 337 | Elf64_Rela *rela_array=(Elf64_Rela *)elf_get_dynseg_addr(elf_file,DT_RELA); 338 | const char *strtab=(decltype(strtab))(elf_get_dynseg_addr(elf_file,DT_STRTAB)); 339 | Elf64_Sym *syms= (decltype(syms))(elf_get_dynseg_addr(elf_file,DT_SYMTAB)); 340 | int num_rela=elf_get_dynseg_val(elf_file,DT_RELASZ)/sizeof(Elf64_Rela); 341 | if(rela_array== nullptr || strtab== nullptr || syms== nullptr){ 342 | p1x(rela_array); 343 | p1x(strtab); 344 | p1x(syms); 345 | return; 346 | } 347 | for(int i=0;ir_info); 350 | Elf64_Xword type = ELF64_R_TYPE(rela->r_info); 351 | //p1x(type); 352 | //p1x(symidx); 353 | if(type == R_AARCH64_GLOB_DAT){ 354 | if(syms[symidx].st_shndx!=0 && syms[symidx].st_value!=0) 355 | { 356 | uintptr_t sym_addr=(uint64_t)syms[symidx].st_value+remoteaddr; 357 | *(uint64_t*)(rwx_buff+rela->r_offset)=sym_addr; 358 | printf("[+] fixing R_X86_64_GLOB_DAT symidx:%d rva:%llX\n",symidx,syms[symidx].st_value); 359 | } 360 | else 361 | { 362 | const char *sym_name=strtab+syms[symidx].st_name; 363 | const char *ver_name= elf_get_require_ver(elf_file,symidx); 364 | const char *ver_file= elf_get_require_file(elf_file,symidx); 365 | 366 | if(ver_name && ver_file){ 367 | //void* soinfo= dlopen(ver_name,RTLD_NOW); 368 | uintptr_t sym_addr=process_dlvsym(pid,ver_file,sym_name,ver_name); 369 | //p1x(sym_addr); 370 | if(sym_addr != 0){ 371 | *(uint64_t*)(rwx_buff+rela->r_offset)=(uint64_t)sym_addr; 372 | printf("[+] fixing R_X86_64_GLOB_DAT sym:%s ver:%s file:%s remote:%llX\n",sym_name,ver_name,ver_file,sym_addr); 373 | } 374 | } 375 | } 376 | 377 | } 378 | if(type == R_AARCH64_RELATIVE){ 379 | printf("[+] fixing R_X86_64_RELATIVE r_offset: %llX r_addend: %llX\n",rela->r_offset,rela->r_addend); 380 | *(uint64_t*)(rwx_buff+rela->r_offset)=(uint64_t)rela->r_addend + (uint64_t)rwx_buff; 381 | } 382 | if(type == R_AARCH64_ABS64){ 383 | const char *sym_name=strtab+syms[symidx].st_name; 384 | Elf64_Addr sym_addr=remoteaddr+syms[symidx].st_value; 385 | //p1x(sym_addr); 386 | if(sym_addr != 0){ 387 | *(Elf64_Addr *)(rwx_buff+rela->r_offset)=(uint64_t)sym_addr; 388 | printf("[+] fixing R_AARCH64_ABS64 sym:%s addr:%llX\n",sym_name,sym_addr); 389 | } 390 | } 391 | } 392 | 393 | Elf64_Rela *jmprel_array=(Elf64_Rela *)elf_get_dynseg_addr(elf_file,DT_JMPREL); 394 | Elf64_Xword jmprel_sz= elf_get_dynseg_val(elf_file,DT_PLTRELSZ); 395 | if(jmprel_array==nullptr) 396 | return; 397 | int numjmprel=jmprel_sz/sizeof(Elf64_Rela); 398 | for(int i=0;ir_info); 401 | Elf64_Xword type = ELF64_R_TYPE(rela->r_info); 402 | const char *sym_name=strtab+syms[symidx].st_name; 403 | if(type==R_AARCH64_JUMP_SLOT){ 404 | if(syms[symidx].st_value !=0 ) 405 | { 406 | uintptr_t sym_addr=remoteaddr + syms[symidx].st_value; 407 | if(sym_addr != 0){ 408 | *(uint64_t*)(rwx_buff+rela->r_offset)=(uint64_t)sym_addr; 409 | printf("[+] fixing R_AARCH64_JUMP_SLOT offset:%04X remote:%llX\n",rela->r_offset,sym_addr); 410 | } 411 | } 412 | else 413 | { 414 | const char *ver_name=elf_get_require_ver(elf_file,symidx); 415 | const char *ver_file= elf_get_require_file(elf_file,symidx); 416 | p1x(ver_name); 417 | if(ver_name) 418 | { 419 | if(ver_file) 420 | { 421 | uintptr_t sym_addr=process_dlvsym(pid,ver_file,sym_name,ver_name); 422 | if(sym_addr != 0){ 423 | *(uint64_t*)(rwx_buff+rela->r_offset)=(uint64_t)sym_addr; 424 | printf("[+] fixing R_AARCH64_JUMP_SLOT offset:%04X sym:%s ver:%s file:%s remote:%llX\n",rela->r_offset,sym_name,ver_name,ver_file,sym_addr); 425 | } 426 | else 427 | { 428 | printf("[-] unknown2\r\n"); 429 | } 430 | } 431 | } 432 | else 433 | { 434 | p1x(rela->r_offset); 435 | } 436 | } 437 | 438 | } 439 | } 440 | 441 | //void(*Entry)() =decltype(Entry)(0x1189+rwx_buff); 442 | //Entry(); 443 | 444 | } 445 | 446 | #endif //INJECTOR_ELF_PARSER_H 447 | -------------------------------------------------------------------------------- /Injector.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include "KDrv.h" 3 | #include "util.h" 4 | #include "RemoteDlsym.h" 5 | #include "binso.hpp" 6 | #include "ElfParser.h" 7 | #include "Arm64Generator.h" 8 | #include "ProcessControl.h" 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | using namespace std; 15 | 16 | #define BITS_PER_LONG (sizeof(long) * 8) 17 | #define test_bit(array, bit) ((array[bit / BITS_PER_LONG] >> bit % BITS_PER_LONG) & 1) 18 | #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) 19 | 20 | #define rpm _KDrv->readMemory 21 | #define wpm _KDrv->writeMemoryPtrace 22 | 23 | shared_ptr _KDrv = nullptr; 24 | 25 | int64_t findSystemServer() 26 | { 27 | auto r = _KDrv->traverseProcesses(); 28 | for(auto& [pid,name] : r) 29 | { 30 | if(name == "system_server") 31 | { 32 | return pid; 33 | } 34 | } 35 | return -1; 36 | } 37 | 38 | int enumFD(int pid,int(*enumCB)(int fd,const char *filePath,void* ctx),void* ctx) 39 | { 40 | DIR *d; 41 | struct dirent *dir; 42 | char fd_path[PATH_MAX]; 43 | char proc_fd_path[1024]; 44 | snprintf(proc_fd_path,1024,"/proc/%d/fd",pid); 45 | 46 | // 打开 /proc/self/fd 目录 47 | d = opendir(proc_fd_path); 48 | if (d == NULL) { 49 | return -1; 50 | } 51 | 52 | // 遍历 /proc/self/fd 下的每个条目 53 | while ((dir = readdir(d)) != NULL) { 54 | // 跳过 "." 和 ".." 目录 55 | if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { 56 | continue; 57 | } 58 | 59 | // 构建 fd 的路径 60 | snprintf(fd_path, sizeof(fd_path), "%s/%s", proc_fd_path, dir->d_name); 61 | 62 | char link_target[PATH_MAX]; 63 | ssize_t len; 64 | 65 | // 读取符号链接,获取文件描述符对应的文件路径 66 | if ((len = readlink(fd_path, link_target, sizeof(link_target) - 1)) != -1) { 67 | link_target[len] = '\0'; // 确保字符串 null 终止 68 | // printf("文件描述符 %s -> %s\n", dir->d_name, link_target); 69 | int fd = atoi(dir->d_name); 70 | if(enumCB(fd,link_target,ctx)!=0) 71 | { 72 | closedir(d); 73 | return fd; 74 | } 75 | } 76 | } 77 | 78 | // 关闭目录 79 | closedir(d); 80 | return -1; 81 | } 82 | int getFDCB(int fd,const char *filePath,void* ctx) 83 | { 84 | const char * findpath = (const char *)ctx; 85 | if(!strcmp(filePath,findpath)) 86 | { 87 | return 1; 88 | } 89 | return 0; 90 | } 91 | int getFD(int pid,const char *path) 92 | { 93 | return enumFD(pid,getFDCB,(void*)path); 94 | } 95 | int isa_event_device(const struct dirent *dir) { 96 | return strncmp("event", dir->d_name, 5) == 0; 97 | } 98 | std::string getTouchScreenDevice() { 99 | struct dirent **namelist; 100 | int i, ndev; 101 | ndev = scandir("/dev/input", &namelist, isa_event_device, alphasort); 102 | if (ndev <= 0) { 103 | return ""; 104 | } 105 | for (i = 0; i < ndev; i++) { 106 | char fname[64]; 107 | int fd = -1; 108 | unsigned long keybit[NBITS(KEY_CNT)]; 109 | unsigned long propbit[INPUT_PROP_MAX]; 110 | snprintf(fname, sizeof(fname), "%s/%s", "/dev/input", namelist[i]->d_name); 111 | fd = open(fname, O_RDONLY); 112 | if (fd < 0) { 113 | continue; 114 | } 115 | memset(keybit, 0, sizeof(keybit)); 116 | memset(propbit, 0, sizeof(propbit)); 117 | ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybit)), keybit); 118 | ioctl(fd, EVIOCGPROP(INPUT_PROP_MAX), propbit); 119 | close(fd); 120 | free(namelist[i]); 121 | if (test_bit(propbit, INPUT_PROP_DIRECT) && 122 | (test_bit(keybit, BTN_TOUCH) || test_bit(keybit, BTN_TOOL_FINGER))) { 123 | return {fname}; 124 | } else if (test_bit(keybit, BTN_TOUCH) || test_bit(keybit, BTN_TOOL_FINGER)) { 125 | return {fname}; 126 | } 127 | } 128 | return ""; 129 | } 130 | 131 | int main() 132 | { 133 | _KDrv = CreateKDrvObject(); 134 | auto pid = findSystemServer(); 135 | int touchFD = -1; 136 | auto dev = getTouchScreenDevice(); 137 | if(!dev.empty()) 138 | { 139 | touchFD = getFD(pid,dev.c_str()); 140 | } 141 | if(touchFD < 0) 142 | { 143 | puts("cannot find touch device!"); 144 | exit(1); 145 | } 146 | p1d(touchFD); 147 | 148 | p1d(pid); 149 | _KDrv->setPid(pid); 150 | _KDrv->enableReadCache(); 151 | 152 | auto libc = _KDrv->getModuleAddress("libc.so"); 153 | 154 | p1x(libc); 155 | 156 | auto exitaddr = process_dlsym(pid,"libc.so","abort"); 157 | p1x(exitaddr); 158 | auto readaddr = process_dlsym(pid,"libc.so","read"); 159 | p1x(readaddr); 160 | auto mallocaddr = process_dlsym(pid,"libc.so","malloc"); 161 | p1x(mallocaddr); 162 | auto readoldinst = rpm(readaddr).value_or(0); 163 | p1x(readoldinst) 164 | 165 | auto nestaddr = process_get_simplelibexecaddr(pid,"libbacktrace.so"); 166 | p1x(nestaddr); 167 | 168 | auto elf = binso::binary_data; 169 | 170 | auto imgsz = elf_get_image_sz(elf); 171 | auto imgdat = (u8*)malloc(imgsz); 172 | p1x(imgsz) 173 | memset(imgdat,0,imgsz); 174 | mapelf(pid,nestaddr,elf,imgdat); 175 | auto readCallback = elf_dlsym_vaddr(elf,"readCallback") + nestaddr; 176 | auto IsInjectorOk = elf_dlsym_vaddr(elf,"g_IsInjectorOk") + nestaddr; 177 | auto contextptr = elf_dlsym_vaddr(elf,"g_contextPtr") + nestaddr; 178 | auto touchDeviceFD = elf_dlsym_vaddr(elf,"g_TouchDeviceFD") + nestaddr; 179 | p1x(readCallback); 180 | p1x(IsInjectorOk); 181 | p1x(contextptr); 182 | p1x(touchDeviceFD); 183 | 184 | auto wrsz = wpm(nestaddr,imgdat,imgsz); 185 | p1x(wrsz); 186 | 187 | uint32_t inst_jmp2exit; 188 | inst_jmp2exit = generic_inst_b(readaddr,exitaddr); 189 | p1x(inst_jmp2exit) 190 | uint32_t inst_invokecallback[52]={0}; 191 | generic_invoker(readCallback,readaddr+4,readoldinst,inst_invokecallback); 192 | 193 | wpm(exitaddr,&inst_invokecallback,sizeof(inst_invokecallback)); 194 | 195 | auto contextmallocaddr = process_remotecall(pid,mallocaddr,0x1000,0,0,0,0,0); 196 | p1x(contextmallocaddr); 197 | auto vecZerp = vector(0x1000,0); 198 | wpm(contextmallocaddr,vecZerp); 199 | 200 | wpm(contextptr,contextmallocaddr); 201 | wpm(touchDeviceFD,touchFD); 202 | wpm(readaddr,inst_jmp2exit); 203 | wpm(IsInjectorOk,1); 204 | 205 | return 0; 206 | } 207 | -------------------------------------------------------------------------------- /KDrv.cpp: -------------------------------------------------------------------------------- 1 | #include "KDrv.h" 2 | 3 | extern std::unique_ptr CreateKDrvimplementObject(); 4 | 5 | std::shared_ptr CreateKDrvObject() 6 | { 7 | return std::make_shared(std::move(CreateKDrvimplementObject())); 8 | } 9 | -------------------------------------------------------------------------------- /KDrv.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef _KDRV_H_ 4 | #define _KDRV_H_ 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | class KDrvImplement 16 | { 17 | public: 18 | virtual size_t readMemory(uint64_t address,void* data,size_t size) = 0; 19 | virtual size_t writeMemory(uint64_t address,const void* data,size_t size) = 0; 20 | virtual size_t writeMemoryPtrace(uint64_t address,const void* data,size_t size) = 0; 21 | virtual uint64_t getModuleAddress(std::string moduleName) = 0; 22 | virtual std::vector> traverseProcesses() = 0; 23 | virtual uint64_t remoteMmap(uint64_t size, uint64_t prot, uint64_t flags) = 0; 24 | virtual void setPid(uint64_t pid) = 0; 25 | }; 26 | 27 | enum class KDrvReadCacheStatus : int 28 | { 29 | UNUSED = 0, 30 | BADPAGE, 31 | GOOD, 32 | }; 33 | 34 | class KDrvReadCache { 35 | private: 36 | 37 | std::unordered_map> mCache; 38 | std::unordered_map mCacheStatus; 39 | int cacheClock = 0; 40 | 41 | protected: 42 | std::shared_ptr _impl; 43 | bool updatePage(uint64_t PFN,std::array& outData) 44 | { 45 | auto &Status = mCacheStatus[PFN]; 46 | switch (Status) 47 | { 48 | case KDrvReadCacheStatus::UNUSED: 49 | { 50 | std::array data; 51 | if(_impl->readMemory(PFN*0x1000,(void*)&data[0],0x1000) == 0x1000) 52 | { 53 | mCacheStatus[PFN] = KDrvReadCacheStatus::GOOD; 54 | mCache[PFN] = data; 55 | outData = mCache[PFN]; 56 | return true; 57 | } 58 | else 59 | { 60 | mCacheStatus[PFN] = KDrvReadCacheStatus::BADPAGE; 61 | return false; 62 | } 63 | break; 64 | } 65 | case KDrvReadCacheStatus::BADPAGE: 66 | { 67 | return false; 68 | break; 69 | } 70 | case KDrvReadCacheStatus::GOOD: 71 | { 72 | auto &cData = mCache[PFN]; 73 | outData = cData; 74 | return true; 75 | } 76 | default: 77 | break; 78 | } 79 | 80 | 81 | return false; 82 | } 83 | 84 | 85 | public: 86 | KDrvReadCache(std::shared_ptr impl) 87 | { 88 | _impl = impl; 89 | } 90 | size_t readMemoryWithCache(uint64_t address,void* data,size_t size) 91 | { 92 | uint64_t StartAddress = (uint64_t)address; 93 | uint64_t EndAddress = StartAddress + size - 1; 94 | uint64_t StartAddressPage = StartAddress & 0xFFFFFFFFFFFFF000; 95 | uint64_t EndAddressPage = EndAddress & 0xFFFFFFFFFFFFF000; 96 | uint64_t StartAddressReadOffset = StartAddress - StartAddressPage; 97 | uint64_t StartAddressReadSize = 0x1000 - StartAddressReadOffset; 98 | uint64_t EndAddressReadSize = EndAddress - EndAddressPage; 99 | uint64_t StartPFN = StartAddress / 0x1000; 100 | uint64_t EndPFN = EndAddress / 0x1000; 101 | uint64_t successDataCount = 0; 102 | 103 | uint8_t *uData = (uint8_t *)data; 104 | 105 | std::array pageData; 106 | 107 | if(!updatePage(StartPFN , pageData)) 108 | { 109 | return 0; 110 | } 111 | 112 | if(EndPFN > StartPFN) 113 | { 114 | memcpy(uData,&(pageData)[StartAddressReadOffset],StartAddressReadSize); 115 | successDataCount += StartAddressReadSize; 116 | uData += StartAddressReadSize; 117 | uint64_t ThroughPages = EndPFN - StartPFN - 1; 118 | for(uint64_t i=0;i s; 147 | 148 | char c; 149 | int i=0; 150 | while(readMemoryWithCache(address+i,(void*)&c,1) && c && ++i < cb) 151 | { 152 | s.push_back(c); 153 | } 154 | s.push_back(0); 155 | return std::string(&s[0]); 156 | } 157 | 158 | void invalidateReadCache() { 159 | mCache.clear(); 160 | mCacheStatus.clear(); 161 | } 162 | }; 163 | 164 | class KDrv 165 | { 166 | private: 167 | bool mEnableReadCache = false; 168 | std::shared_ptr _impl = nullptr; 169 | std::shared_ptr mReadCache = nullptr; 170 | 171 | public: 172 | KDrv(std::shared_ptr impl) 173 | { 174 | _impl = impl; 175 | mReadCache = std::make_shared(_impl); 176 | } 177 | 178 | uint64_t getModuleAddress(std::string moduleName) 179 | { 180 | if(moduleName.length() > 0) 181 | { 182 | auto addr = _impl->getModuleAddress(moduleName); 183 | if(addr != -1) 184 | { 185 | return addr; 186 | } 187 | } 188 | return 0; 189 | } 190 | uint64_t remoteMmap(uint64_t size, uint64_t prot, uint64_t flags) 191 | { 192 | return _impl->remoteMmap(size,prot,flags); 193 | } 194 | 195 | std::vector> traverseProcesses() 196 | { 197 | return _impl->traverseProcesses(); 198 | } 199 | void setPid(uint64_t pid) 200 | { 201 | _impl->setPid(pid); 202 | } 203 | 204 | void invalidateReadCache() 205 | { 206 | mReadCache->invalidateReadCache(); 207 | } 208 | void enableReadCache() 209 | { 210 | mEnableReadCache = true; 211 | invalidateReadCache(); 212 | } 213 | void disableReadCache() 214 | { 215 | mEnableReadCache = false; 216 | invalidateReadCache(); 217 | } 218 | 219 | template 220 | std::optional readMemory(uint64_t address) 221 | { 222 | T data={}; 223 | if(mEnableReadCache) 224 | { 225 | if(mReadCache->readMemoryWithCache(address,&data,sizeof(T)) == sizeof(T)) 226 | { 227 | return data; 228 | } 229 | } 230 | else 231 | { 232 | if(_impl->readMemory(address,&data,sizeof(T)) == sizeof(T)) 233 | { 234 | return data; 235 | } 236 | } 237 | 238 | return {}; 239 | } 240 | std::optional> readMemory(uint64_t address,size_t size) 241 | { 242 | std::vector data; 243 | data.resize(size); 244 | if(mEnableReadCache) 245 | { 246 | if(mReadCache->readMemoryWithCache(address,(void*)&data[0],size) == size) 247 | { 248 | return data; 249 | } 250 | } 251 | else 252 | { 253 | if(_impl->readMemory(address,(void*)&data[0],size) == size) 254 | { 255 | return data; 256 | } 257 | } 258 | 259 | return {}; 260 | } 261 | 262 | template 263 | T readMemorySimplely(uint64_t address) 264 | { 265 | auto rr = readMemory(address); 266 | if(rr) 267 | { 268 | return *rr; 269 | } 270 | T rval={}; 271 | return rval; 272 | } 273 | 274 | template 275 | size_t writeMemory(uint64_t address,const T& data) 276 | { 277 | auto size = _impl->writeMemory(address,&data,sizeof(T)); 278 | if(size > 0) 279 | { 280 | return size; 281 | } 282 | return 0; 283 | } 284 | size_t writeMemory(uint64_t address,const std::vector &data) 285 | { 286 | auto size = _impl->writeMemory(address,(void*)&data[0],data.size()); 287 | if(size > 0) 288 | { 289 | return size; 290 | } 291 | return 0; 292 | } 293 | size_t writeMemory(uint64_t address,void* data,size_t size) 294 | { 295 | return _impl->writeMemory(address,data,size); 296 | } 297 | 298 | template 299 | size_t writeMemoryPtrace(uint64_t address,const T& data) 300 | { 301 | auto size = _impl->writeMemoryPtrace(address,(void*)&data,sizeof(T)); 302 | if(size > 0) 303 | { 304 | return size; 305 | } 306 | return 0; 307 | } 308 | size_t writeMemoryPtrace(uint64_t address,const std::vector &data) 309 | { 310 | auto size = _impl->writeMemoryPtrace(address,(void*)&data[0],data.size()); 311 | if(size > 0) 312 | { 313 | return size; 314 | } 315 | return 0; 316 | } 317 | size_t writeMemoryPtrace(uint64_t address,const void* data,size_t size) 318 | { 319 | return _impl->writeMemoryPtrace(address,data,size); 320 | } 321 | 322 | std::string readString(uint64_t address,size_t cb = 1024) 323 | { 324 | if(mEnableReadCache) 325 | { 326 | return mReadCache->readStringWithCache(address,cb); 327 | } 328 | else 329 | { 330 | auto tempCache = std::make_shared(_impl); 331 | return tempCache->readStringWithCache(address,cb); 332 | } 333 | } 334 | 335 | }; 336 | 337 | 338 | std::shared_ptr CreateKDrvObject(); 339 | 340 | #endif -------------------------------------------------------------------------------- /KDrvImpl.cpp: -------------------------------------------------------------------------------- 1 | #include "KDrv.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include "RemoteDlsym.h" 15 | 16 | using namespace std; 17 | 18 | class KDrvRootImpl : public KDrvImplement 19 | { 20 | private: 21 | uint64_t mPid = 0; 22 | 23 | public: 24 | KDrvRootImpl() 25 | { 26 | 27 | } 28 | size_t readMemory(uint64_t address,void* data,size_t size) override 29 | { 30 | struct iovec local[1]; 31 | struct iovec remote[1]; 32 | 33 | local[0].iov_base = data; 34 | local[0].iov_len = size; 35 | remote[0].iov_base = (void *)address; 36 | remote[0].iov_len = size; 37 | 38 | ssize_t n_read = process_vm_readv(mPid, local, 1, remote, 1, 0); 39 | return n_read; 40 | } 41 | size_t writeMemory(uint64_t address,const void* data,size_t size) override 42 | { 43 | auto len = size; 44 | auto buf = (uint8_t*)data; 45 | auto addr = address; 46 | auto pid = mPid; 47 | 48 | long word; 49 | size_t bytes_written = 0; 50 | size_t bytes = len; 51 | 52 | if(ptrace(PTRACE_ATTACH, pid, 0, 0) == -1) { 53 | return bytes_written; 54 | } 55 | waitpid(pid, NULL, 0); 56 | 57 | // 逐字(word)写入数据 58 | while (bytes >= sizeof(long)) { 59 | memcpy(&word, buf + bytes_written, sizeof(long)); 60 | if (ptrace(PTRACE_POKEDATA, pid, addr + bytes_written, word) == -1) { 61 | fprintf(stderr, "PTRACE_POKEDATA failed: %s\n", strerror(errno)); 62 | return bytes_written; 63 | } 64 | bytes -= sizeof(long); 65 | bytes_written += sizeof(long); 66 | } 67 | 68 | if (bytes > 0) { 69 | // 只剩下不足一个字的字节 70 | uint8_t last_word_data[sizeof(long)]; 71 | memcpy(last_word_data,buf+bytes_written,bytes); 72 | readMemory(address+bytes_written+bytes,last_word_data+bytes,sizeof(long) - bytes); 73 | long last_word = *(long*)last_word_data; 74 | if (ptrace(PTRACE_PEEKDATA, pid, addr + bytes_written, &last_word) == -1) { 75 | fprintf(stderr, "PTRACE_PEEKDATA failed: %s\n", strerror(errno)); 76 | return bytes_written; 77 | } 78 | 79 | // 使用缓冲区稍后写入的字节覆盖最后一个字中的前几个字节 80 | memcpy(&last_word, buf + bytes_written, bytes); 81 | if (ptrace(PTRACE_POKEDATA, pid, addr + bytes_written, last_word) == -1) { 82 | fprintf(stderr, "PTRACE_POKEDATA failed: %s\n", strerror(errno)); 83 | return bytes_written; 84 | } 85 | } 86 | 87 | ptrace(PTRACE_DETACH, pid, 0, 0); 88 | return bytes_written; 89 | } 90 | size_t writeMemoryPtrace(uint64_t address,const void* data,size_t size) override 91 | { 92 | return writeMemory(address,data,size); 93 | } 94 | uint64_t getModuleAddress(std::string moduleName) override 95 | { 96 | if(!moduleName.empty()) 97 | { 98 | return process_get_simplelibaddr(mPid,moduleName.c_str()); 99 | } 100 | return 0; 101 | } 102 | std::vector> traverseProcesses() override 103 | { 104 | std::vector> ret; 105 | DIR* dir = opendir("/proc"); 106 | if (!dir) { 107 | return ret; 108 | } 109 | struct dirent* entry; 110 | while ((entry = readdir(dir))) { 111 | if (entry->d_type != DT_DIR) { 112 | continue; 113 | } 114 | const char* name = entry->d_name; 115 | if (*name < '0' || *name > '9') { 116 | continue; 117 | } 118 | int pid = atoi(name); 119 | char cmdline_path[256]; 120 | snprintf(cmdline_path, sizeof(cmdline_path), "/proc/%d/cmdline", pid); 121 | FILE* cmdline_file = fopen(cmdline_path, "r"); 122 | if (!cmdline_file) { 123 | continue; 124 | } 125 | char cmdline[256]; 126 | int len = fread(cmdline, 1, sizeof(cmdline), cmdline_file); 127 | fclose(cmdline_file); 128 | if (len <= 0) { 129 | continue; 130 | } 131 | cmdline[len] = '\0'; 132 | ret.push_back(make_pair(pid,string(cmdline))); 133 | } 134 | closedir(dir); 135 | return ret; 136 | } 137 | uint64_t remoteMmap(uint64_t size, uint64_t prot, uint64_t flags) 138 | { 139 | return 0; 140 | } 141 | void setPid(uint64_t pid) override 142 | { 143 | mPid = pid; 144 | } 145 | }; 146 | 147 | std::unique_ptr CreateKDrvimplementObject() 148 | { 149 | return make_unique(); 150 | } 151 | 152 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /ProcessControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by www on 4/27/2023. 3 | // 4 | 5 | #ifndef _PROCESS_CONTROL_H_ 6 | #define _PROCESS_CONTROL_H_ 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include "util.h" 28 | #include "RemoteDlsym.h" 29 | 30 | uintptr_t process_remotecall(pid_t pid,uintptr_t calladdr, 31 | uint64_t a1,uint64_t a2,uint64_t a3,uint64_t a4,uint64_t a5,uint64_t a6){ 32 | if(ptrace(PTRACE_ATTACH,pid,0,0)){ 33 | fprintf(stderr,"%s\n","process attach failed!"); 34 | return 0; 35 | } 36 | waitpid(pid,0,0 ); 37 | 38 | int regset=NT_PRSTATUS; 39 | user_pt_regs ori_regs; 40 | iovec iov; 41 | iov.iov_base=&ori_regs; 42 | iov.iov_len=sizeof(ori_regs); 43 | if(ptrace(PTRACE_GETREGSET,pid,(void *)regset,&iov)){ 44 | fputs("getreg failed!\n",stderr); 45 | fflush(stdout); 46 | ptrace(PTRACE_DETACH,pid,0,0); 47 | return 0; 48 | } 49 | //show_reg(&ori_regs); 50 | user_pt_regs modify_regs; 51 | memcpy(&modify_regs,&ori_regs,sizeof(modify_regs)); 52 | 53 | modify_regs.regs[0]=a1; 54 | modify_regs.regs[1]=a2; 55 | modify_regs.regs[2]=a3;//PROT_EXEC | PROT_READ | PROT_WRITE; 56 | modify_regs.regs[3]=a4;//MAP_ANONYMOUS | MAP_PRIVATE; 57 | modify_regs.regs[4]=a5; 58 | modify_regs.regs[5]=a6; 59 | 60 | //uintptr_t addr_mmap= process_dlsym(pid,"libc.so","mmap"); 61 | //uintptr_t addr_libc= process_symaddr_to_libaddr(pid,addr_mmap); 62 | //p1x(addr_libc); 63 | modify_regs.regs[30]=0; 64 | modify_regs.pc=calladdr; 65 | 66 | iov.iov_base=&modify_regs; 67 | iov.iov_len=sizeof(modify_regs); 68 | ptrace(PTRACE_SETREGSET,pid,(void *)regset,&iov); 69 | ptrace(PTRACE_CONT,pid,0,0); 70 | 71 | uintptr_t return_value=0; 72 | while (1){ 73 | waitpid(pid,0,0); 74 | user_pt_regs regs; 75 | memset(®s,0,sizeof(regs)); 76 | iov.iov_base=®s; 77 | iov.iov_len=sizeof(regs); 78 | ptrace(PTRACE_GETREGSET,pid,(void *)regset,&iov); 79 | if(regs.pc==0 && regs.regs[30]==0) { 80 | return_value=regs.regs[0]; 81 | break; 82 | } 83 | } 84 | 85 | 86 | iov.iov_base=&ori_regs; 87 | iov.iov_len=sizeof(ori_regs); 88 | ptrace(PTRACE_SETREGSET,pid,(void *)regset,&iov); 89 | 90 | ptrace(PTRACE_DETACH,pid,0,0); 91 | 92 | //p1x(return_value); 93 | return return_value; 94 | } 95 | void process_remotecall_nonret(pid_t pid,uintptr_t calladdr, 96 | uint64_t a1,uint64_t a2,uint64_t a3,uint64_t a4,uint64_t a5,uint64_t a6){ 97 | if(ptrace(PTRACE_ATTACH,pid,0,0)){ 98 | fprintf(stderr,"%s\n","process attach failed!"); 99 | return; 100 | } 101 | waitpid(pid,0,0 ); 102 | 103 | int regset=NT_PRSTATUS; 104 | user_pt_regs ori_regs; 105 | iovec iov; 106 | iov.iov_base=&ori_regs; 107 | iov.iov_len=sizeof(ori_regs); 108 | if(ptrace(PTRACE_GETREGSET,pid,(void *)regset,&iov)){ 109 | fputs("getreg failed!\n",stderr); 110 | fflush(stdout); 111 | ptrace(PTRACE_DETACH,pid,0,0); 112 | return; 113 | } 114 | //show_reg(&ori_regs); 115 | user_pt_regs modify_regs; 116 | memcpy(&modify_regs,&ori_regs,sizeof(modify_regs)); 117 | 118 | modify_regs.regs[0]=a1; 119 | modify_regs.regs[1]=a2; 120 | modify_regs.regs[2]=a3;//PROT_EXEC | PROT_READ | PROT_WRITE; 121 | modify_regs.regs[3]=a4;//MAP_ANONYMOUS | MAP_PRIVATE; 122 | modify_regs.regs[4]=a5; 123 | modify_regs.regs[5]=a6; 124 | 125 | uintptr_t addr_mmap= process_dlsym(pid,"libc.so","mmap"); 126 | uintptr_t addr_libc= process_symaddr_to_libaddr(pid,addr_mmap); 127 | p1x(addr_libc); 128 | modify_regs.regs[30]=0; 129 | modify_regs.pc=calladdr; 130 | 131 | iov.iov_base=&modify_regs; 132 | iov.iov_len=sizeof(modify_regs); 133 | ptrace(PTRACE_SETREGSET,pid,(void *)regset,&iov); 134 | ptrace(PTRACE_CONT,pid,0,0); 135 | 136 | uintptr_t return_value=0; 137 | while (1){ 138 | waitpid(pid,0,0); 139 | user_pt_regs regs; 140 | memset(®s,0,sizeof(regs)); 141 | iov.iov_base=®s; 142 | iov.iov_len=sizeof(regs); 143 | ptrace(PTRACE_GETREGSET,pid,(void *)regset,&iov); 144 | if(regs.pc==addr_libc && regs.regs[30]==addr_libc) { 145 | return_value=regs.regs[0]; 146 | break; 147 | } 148 | } 149 | 150 | 151 | iov.iov_base=&ori_regs; 152 | iov.iov_len=sizeof(ori_regs); 153 | ptrace(PTRACE_SETREGSET,pid,(void *)regset,&iov); 154 | 155 | ptrace(PTRACE_DETACH,pid,0,0); 156 | 157 | //p1x(return_value); 158 | return ; 159 | } 160 | 161 | 162 | uintptr_t process_mmap(pid_t pid,size_t length,int prot){ 163 | uintptr_t remote_mmap=process_dlsym(pid,"libc.so","mmap"); 164 | p1x(remote_mmap); 165 | if(remote_mmap!=0){ 166 | return process_remotecall(pid, 167 | remote_mmap, 168 | 0, 169 | (uintptr_t)length, 170 | prot, 171 | MAP_ANONYMOUS | MAP_PRIVATE, 172 | 0,0); 173 | } 174 | return 0; 175 | } 176 | uintptr_t process_mprotect(pid_t pid,uintptr_t addr,size_t length,int prot){ 177 | uintptr_t remote_mmap=process_dlsym(pid,"libc.so","mprotect"); 178 | p1x(remote_mmap); 179 | if(remote_mmap!=0){ 180 | return process_remotecall(pid, 181 | remote_mmap, 182 | addr, 183 | (uintptr_t)length, 184 | prot, 185 | 0, 186 | 0,0); 187 | } 188 | return 0; 189 | } 190 | 191 | 192 | #endif //INJECTSURFACEFLINGER_PROCESS_CONTROL_H 193 | -------------------------------------------------------------------------------- /RemoteDlsym.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by www on 4/27/2023. 3 | // 4 | 5 | #ifndef _TOUCHLAB_PROCESS_CONTROL_H 6 | #define _TOUCHLAB_PROCESS_CONTROL_H 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include "KDrv.h" 29 | 30 | static const char *pathsuffix(const char *path){ 31 | const char *final= path; 32 | while(*path++){ 33 | if(*path=='/'){ 34 | final=path+1; 35 | } 36 | } 37 | return final; 38 | } 39 | 40 | static void process_enumlibs(pid_t pid,int (*EnumCB)(const char *name,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void *context),void *context){ 41 | char path_proc_pid_maps[1024]={0}; 42 | snprintf(path_proc_pid_maps,1024,"/proc/%d/maps",pid); 43 | FILE*fp=fopen(path_proc_pid_maps,"r"); 44 | 45 | char line[1024]; 46 | struct { 47 | int inode=0; 48 | uintptr_t baseaddr=0; 49 | uintptr_t endaddr=0; 50 | uintptr_t execaddr=0; 51 | char path[1024]={0}; 52 | } lookinginode; 53 | bool looked= false; 54 | //int lookinginode=0; 55 | while(fgets(line,1024,fp)!=0){ 56 | uint64_t addr_begin=0,addr_end=0; 57 | uint32_t offset=0; 58 | uint32_t dev_major=0,dev_minor=0; 59 | int inode=0; 60 | char pathname[1024]={0}; 61 | 62 | char prot[5]={0}; 63 | sscanf(line,"%llx-%llx %4s %x %x:%x %d %1024s", 64 | &addr_begin,&addr_end,prot,&offset,&dev_major,&dev_minor,&inode,&pathname); 65 | 66 | if(lookinginode.inode!=inode) 67 | { 68 | //如果已经遍历到了可执行的内存块,则开始记录 69 | if(looked==true){ 70 | if(EnumCB != nullptr && EnumCB(lookinginode.path,lookinginode.baseaddr,lookinginode.execaddr,lookinginode.endaddr-lookinginode.baseaddr,context)==1) 71 | return; 72 | } 73 | //如果inode存在,则视为一个新模块的开始,并重新初始化变量 74 | if(inode!=0){ 75 | lookinginode.inode=inode; 76 | lookinginode.baseaddr=addr_begin; 77 | lookinginode.endaddr=addr_end; 78 | strncpy(lookinginode.path,pathname,1024); 79 | } 80 | 81 | looked=false; 82 | } 83 | 84 | //判断是否是连续文件映射内存块 85 | if(lookinginode.inode==inode && inode!=0 ){ 86 | //如果保护属性里面有可执行属性,则标记 87 | if(prot[2]=='x' && looked==false){ 88 | lookinginode.execaddr=addr_begin; 89 | looked=true; 90 | } 91 | lookinginode.endaddr=addr_end; 92 | } 93 | } 94 | if(looked==true){ 95 | if(EnumCB != nullptr && EnumCB(lookinginode.path,lookinginode.baseaddr,lookinginode.execaddr,lookinginode.endaddr-lookinginode.baseaddr,context)==1) 96 | return; 97 | } 98 | } 99 | static uintptr_t process_symaddr_to_libaddr(pid_t pid,uintptr_t symaddr){ 100 | struct { 101 | uintptr_t symaddr=symaddr; 102 | uintptr_t retval=0; 103 | }local_ctx={symaddr,0}; 104 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 105 | auto ctx=(decltype(local_ctx)*)context; 106 | if(ctx->symaddr>=addr && (ctx->symaddr)<(addr+imgsz)){ 107 | ctx->retval=addr; 108 | return 1; 109 | } 110 | return 0; 111 | }, &local_ctx); 112 | return local_ctx.retval; 113 | } 114 | static std::string process_libaddr_to_libpath(pid_t pid,uintptr_t libaddr){ 115 | struct { 116 | uintptr_t libaddr=libaddr; 117 | std::string retval=""; 118 | }local_ctx={libaddr,""}; 119 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 120 | auto ctx=(decltype(local_ctx)*)context; 121 | if(ctx->libaddr==addr){ 122 | ctx->retval=path; 123 | return 1; 124 | } 125 | return 0; 126 | }, &local_ctx); 127 | return local_ctx.retval; 128 | } 129 | static uintptr_t process_get_libaddr(pid_t pid,const char* libpath){ 130 | struct { 131 | const char* libpath=libpath; 132 | uintptr_t retval=0; 133 | }local_ctx={libpath,0}; 134 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 135 | auto ctx=(decltype(local_ctx)*)context; 136 | if(!strcmp(ctx->libpath,path)){ 137 | ctx->retval=addr; 138 | return 1; 139 | } 140 | return 0; 141 | }, &local_ctx); 142 | return local_ctx.retval; 143 | } 144 | static uintptr_t process_get_simplelibaddr(pid_t pid,const char* libpath){ 145 | struct { 146 | const char* libpath=pathsuffix(libpath); 147 | uintptr_t retval=0; 148 | }local_ctx={libpath,0}; 149 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 150 | auto ctx=(decltype(local_ctx)*)context; 151 | if(!strcmp(ctx->libpath,pathsuffix(path))){ 152 | ctx->retval=addr; 153 | return 1; 154 | } 155 | return 0; 156 | }, &local_ctx); 157 | return local_ctx.retval; 158 | } 159 | static uintptr_t process_get_simplelibexecaddr(pid_t pid,const char* libpath){ 160 | struct { 161 | const char* libpath=pathsuffix(libpath); 162 | uintptr_t retval=0; 163 | }local_ctx={libpath,0}; 164 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 165 | auto ctx=(decltype(local_ctx)*)context; 166 | if(!strcmp(ctx->libpath,pathsuffix(path))){ 167 | ctx->retval=execaddr; 168 | return 1; 169 | } 170 | return 0; 171 | }, &local_ctx); 172 | return local_ctx.retval; 173 | } 174 | 175 | static void process_print_libs(pid_t pid){ 176 | struct { 177 | const char* libpath=libpath; 178 | uintptr_t retval=0; 179 | }local_ctx={0,0}; 180 | process_enumlibs(pid,[](const char* path,uintptr_t addr,uintptr_t execaddr,uintptr_t imgsz,void*context)->int{ 181 | printf("%p %p %s\n",addr,imgsz,path); 182 | return 0; 183 | }, &local_ctx); 184 | return; 185 | } 186 | 187 | static uintptr_t process_dlvsym(pid_t pid,const char *lib,const char * __name,const char * __version){ 188 | void* soinfo=dlopen(lib,RTLD_NOW); 189 | if(soinfo) 190 | { 191 | uintptr_t local_sym = (uintptr_t)dlvsym(soinfo,__name,__version); 192 | uintptr_t local_lib = process_symaddr_to_libaddr(getpid(),local_sym); 193 | uintptr_t sym_offset=local_sym-local_lib; 194 | std::string local_lib_path= process_libaddr_to_libpath(getpid(),local_lib); 195 | 196 | // std::cout << local_lib_path << std::endl; 197 | // auto suffix = pathsuffix(local_lib_path.c_str()); 198 | 199 | uintptr_t remote_lib=process_get_libaddr(pid,local_lib_path.c_str()); 200 | // auto kdrv = CreateKDrvObject(); 201 | // kdrv->setPid(pid); 202 | // uintptr_t remote_lib=kdrv->getModuleAddress(suffix); 203 | if(remote_lib) 204 | { 205 | return remote_lib+sym_offset; 206 | } 207 | } 208 | return 0; 209 | } 210 | static uintptr_t process_dlsym(pid_t pid,const char *lib,const char * __name){ 211 | void* soinfo=dlopen(lib,RTLD_NOW); 212 | if(soinfo) 213 | { 214 | uintptr_t local_sym = (uintptr_t)dlsym(soinfo,__name); 215 | uintptr_t local_lib = process_symaddr_to_libaddr(getpid(),local_sym); 216 | uintptr_t sym_offset=local_sym-local_lib; 217 | std::string local_lib_path= process_libaddr_to_libpath(getpid(),local_lib); 218 | 219 | uintptr_t remote_lib=process_get_libaddr(pid,local_lib_path.c_str()); 220 | return remote_lib+sym_offset; 221 | } 222 | return 0; 223 | } 224 | 225 | #endif //_TOUCHLAB_PROCESS_CONTROL_H 226 | -------------------------------------------------------------------------------- /TouchLab.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "TouchLabStructs.hpp" 19 | 20 | #define TAG ("TOUCHLAB") 21 | 22 | #define p1x(v){char __strbuf__[64];memset(__strbuf__,0,sizeof(__strbuf__));snprintf(__strbuf__,64,"[++] "#v"=%llX",(uint64_t)v);__android_log_print(100,TAG,__strbuf__);}; 23 | #define p1d(v){char __strbuf__[64];memset(__strbuf__,0,sizeof(__strbuf__));snprintf(__strbuf__,64,"[++] "#v"=%lld",(uint64_t)v);__android_log_print(100,TAG,__strbuf__);}; 24 | #define p1s(v){char __strbuf__[64];memset(__strbuf__,0,sizeof(__strbuf__));snprintf(__strbuf__,64,"[++] "#v"=%s",(uint64_t)v);__android_log_print(100,TAG,__strbuf__);}; 25 | 26 | #define p1x 27 | #define p1d 28 | #define p1s 29 | 30 | #define InterlockedCompareExchange16(target,new_value,expected) (__sync_val_compare_and_swap(target, expected, new_value)) 31 | 32 | typedef struct { 33 | short InitLockOnce; 34 | int IsInitOk; 35 | int logfd; 36 | int touchScreenDeviceFd; 37 | struct universal_events_queue simEventsQueue; 38 | pthread_rwlock_t simEventsQueueLock; 39 | pthread_t eventsThread; 40 | } ContextStruct; 41 | typedef struct { 42 | int hasEvent; 43 | struct TouchEvent event; 44 | } TouchEventStruct; 45 | 46 | 47 | 48 | __attribute__((visibility("default"))) 49 | int g_IsInjectorOk = 0; 50 | __attribute__((visibility("default"))) 51 | ContextStruct* g_contextPtr = NULL; 52 | __attribute__((visibility("default"))) 53 | TouchEventStruct* g_touchEventPtr = NULL; 54 | __attribute__((visibility("default"))) 55 | int g_TouchDeviceFD = 0; 56 | 57 | void EventsThread(); 58 | void Initialize() 59 | { 60 | g_contextPtr->touchScreenDeviceFd = g_TouchDeviceFD; 61 | { 62 | universal_events_queue_initialize(&g_contextPtr->simEventsQueue); 63 | pthread_rwlockattr_t attr; 64 | pthread_rwlockattr_init(&attr); 65 | pthread_rwlock_init(&g_contextPtr->simEventsQueueLock, &attr); 66 | } 67 | 68 | int ThreadResult = pthread_create(&g_contextPtr->eventsThread,NULL,EventsThread,NULL); 69 | p1d(ThreadResult); 70 | 71 | g_contextPtr->IsInitOk = 1; 72 | } 73 | 74 | void EventsThread() 75 | { 76 | p1s("EventsThread!"); 77 | // 从外部接受按键模拟请求,该部分尚未完成 78 | while(1) 79 | { 80 | // if(g_touchEventPtr->hasEvent) 81 | // { 82 | 83 | 84 | // g_touchEventPtr->hasEvent = 0; 85 | // } 86 | 87 | msleep(1000); 88 | } 89 | } 90 | 91 | ssize_t myRead(int fd,void *buf,size_t sz) 92 | { 93 | // return -1; // 这行是屏蔽对于touchScreenDeviceFd的所有read 94 | 95 | // 如果原先FD能读到事件,则返回 96 | ssize_t r = syscall(SYS_read,g_contextPtr->touchScreenDeviceFd,buf,sz); 97 | if(errno != EAGAIN && errno != EINTR) 98 | { 99 | return r; 100 | } 101 | // 下面是模拟触摸事件的实现 102 | 103 | int numBlocks = sz / sizeof(struct input_event); 104 | struct input_event *outBuf = (struct input_event *)buf; 105 | 106 | struct input_event_block block; 107 | pthread_rwlock_wrlock(&g_contextPtr->simEventsQueueLock); 108 | int numQueue = universal_events_queue_length(&g_contextPtr->simEventsQueue); 109 | int readCount = numQueue; 110 | if(readCount > numBlocks) 111 | { 112 | readCount = numBlocks; 113 | } 114 | if(readCount > 0) 115 | { 116 | for(int i=0;isimEventsQueue,&block); 119 | outBuf[i] = block.event; 120 | } 121 | pthread_rwlock_unlock(&g_contextPtr->simEventsQueueLock); 122 | errno = 0; 123 | return readCount * sizeof(struct input_event); 124 | } 125 | pthread_rwlock_unlock(&g_contextPtr->simEventsQueueLock); 126 | 127 | return r; 128 | } 129 | 130 | typedef struct { 131 | uint64_t x0,x1,x2,x3,x4,x5,x6,x7,x8,x9; 132 | uint64_t x10,x11,x12,x13,x14,x15,x16,x17,x18,x19; 133 | uint64_t x20,x21,x22,x23,x24,x25,x26,x27,x28,x29; 134 | uint64_t x30,x31; 135 | } Arm64Context; 136 | 137 | int readCallbackInner(Arm64Context *context) 138 | { 139 | int fd = context->x0; 140 | if(!g_contextPtr->IsInitOk) 141 | { 142 | if(InterlockedCompareExchange16(&g_contextPtr->InitLockOnce,1,0) == 0) 143 | { 144 | Initialize(); 145 | } 146 | } 147 | 148 | if(g_contextPtr->IsInitOk) 149 | { 150 | if(fd == g_contextPtr->touchScreenDeviceFd) 151 | { 152 | p1s("touch2!"); 153 | context->x0 = myRead(fd,(void*)context->x1,(size_t)context->x2); 154 | return 1; 155 | } 156 | } 157 | return 0; 158 | } 159 | 160 | __attribute__((visibility("default"))) 161 | void readCallback(uint64_t sp) 162 | { 163 | Arm64Context *context = (Arm64Context *)sp; 164 | if(readCallbackInner(context)) 165 | { 166 | // context->x0 = -1; 167 | context->x9 = 1; 168 | } 169 | else 170 | { 171 | context->x9 = 0; 172 | } 173 | } 174 | 175 | 176 | 177 | -------------------------------------------------------------------------------- /TouchLabStructs.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _TOUCHLAB_STRUCTS_H_ 2 | #define _TOUCHLAB_STRUCTS_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | enum TouchEventType 10 | { 11 | TOUCH_DOWN = 0, 12 | TOUCH_MOVE, 13 | TOUCH_UP, 14 | }; 15 | 16 | struct TouchEvent 17 | { 18 | int type; 19 | int64_t timestamp; 20 | int fingerIndex; 21 | float posX; 22 | float posY; 23 | }; 24 | struct input_event_block 25 | { 26 | struct input_event event; 27 | }; 28 | 29 | struct universal_events_queue { 30 | #define UNIVERSAL_EVENTS_QUEUE_SIZE (200) 31 | int from,rear; 32 | struct input_event_block data[UNIVERSAL_EVENTS_QUEUE_SIZE]; 33 | 34 | }; 35 | void universal_events_queue_initialize(struct universal_events_queue *q) 36 | { 37 | q->from=0; 38 | q->rear=0; 39 | } 40 | bool universal_events_queue_inqueue(struct universal_events_queue *q,const struct input_event_block* event) 41 | { 42 | int nextrear = (q->rear + 1) % UNIVERSAL_EVENTS_QUEUE_SIZE; 43 | if(nextrear == q->from){ 44 | return false; 45 | } 46 | q->data[q->rear]=*event; 47 | q->rear=nextrear; 48 | return true; 49 | } 50 | bool universal_events_queue_dequeue(struct universal_events_queue *q,struct input_event_block* outEvent){ 51 | if(q->from == q->rear) 52 | return false; 53 | *outEvent=q->data[q->from]; 54 | q->from=(q->from+1) % UNIVERSAL_EVENTS_QUEUE_SIZE; 55 | return true; 56 | } 57 | int universal_events_queue_length(const struct universal_events_queue *q) 58 | { 59 | if (q->rear >= q->from) { 60 | return q->rear - q->from; 61 | } else { 62 | return UNIVERSAL_EVENTS_QUEUE_SIZE - (q->from - q->rear); 63 | } 64 | } 65 | 66 | #endif 67 | 68 | -------------------------------------------------------------------------------- /binso.hpp: -------------------------------------------------------------------------------- 1 | #ifndef _BINARY_DATA_H_ 2 | #define _BINARY_DATA_H_ 3 | 4 | namespace binso { 5 | 6 | unsigned char binary_data[] = { 7 | 0x7F, 0x45, 0x4C, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0xB7, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x38, 0x00, 0x0A, 0x00, 0x40, 0x00, 0x15, 0x00, 0x14, 0x00, 0x06, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x20, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x70, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0xD0, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x52, 0xE5, 0x74, 0x64, 0x04, 0x00, 0x00, 0x00, 0x70, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0xE5, 0x74, 0x64, 0x04, 0x00, 0x00, 0x00, 0x94, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0xE5, 0x74, 0x64, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x41, 0x6E, 0x64, 0x72, 0x6F, 0x69, 0x64, 0x00, 0x21, 0x00, 0x00, 0x00, 0x72, 0x32, 0x35, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x35, 0x31, 0x39, 0x36, 0x35, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD5, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xED, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0E, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3B, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA5, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAF, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC5, 0x01, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAD, 0x00, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x5C, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2F, 0x00, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x80, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0xE8, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8F, 0x00, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x48, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8, 0x00, 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0xD8, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC5, 0x00, 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0xE8, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x01, 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0xE0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x88, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0xDC, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0xF0, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x67, 0x01, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x54, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79, 0x01, 0x00, 0x00, 0x12, 0x00, 0x0C, 0x00, 0x54, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x01, 0x00, 0x00, 0x11, 0x00, 0x14, 0x00, 0xD0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0xCD, 0x01, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x0D, 0x05, 0x00, 0x00, 0x00, 0x02, 0x00, 0xD5, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x04, 0x40, 0x40, 0x08, 0x08, 0x80, 0x04, 0x60, 0x00, 0x80, 0x00, 0x20, 0x41, 0x00, 0x20, 0xC4, 0x00, 0x0E, 0xA0, 0x08, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x77, 0xA2, 0x93, 0x2E, 0x26, 0x55, 0xE2, 0xF8, 0x42, 0xAF, 0x2B, 0xDF, 0x56, 0xB1, 0x89, 0x95, 0xA6, 0x3C, 0x02, 0xF4, 0x88, 0x83, 0x8A, 0x9D, 0x67, 0x58, 0x07, 0x6B, 0xB0, 0x4C, 0x0D, 0x75, 0xB2, 0x93, 0x63, 0x16, 0xE6, 0x97, 0xDD, 0x0E, 0x2A, 0x34, 0x62, 0xDA, 0x8E, 0x9B, 0x05, 0xCF, 0xBF, 0x69, 0x65, 0x8B, 0x00, 0x5F, 0x5F, 0x63, 0x78, 0x61, 0x5F, 0x66, 0x69, 0x6E, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x00, 0x5F, 0x5F, 0x63, 0x78, 0x61, 0x5F, 0x61, 0x74, 0x65, 0x78, 0x69, 0x74, 0x00, 0x5F, 0x5F, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x5F, 0x61, 0x74, 0x66, 0x6F, 0x72, 0x6B, 0x00, 0x75, 0x6E, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6C, 0x5F, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x5F, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5F, 0x69, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x00, 0x75, 0x6E, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6C, 0x5F, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x5F, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5F, 0x69, 0x6E, 0x71, 0x75, 0x65, 0x75, 0x65, 0x00, 0x75, 0x6E, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6C, 0x5F, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x5F, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5F, 0x64, 0x65, 0x71, 0x75, 0x65, 0x75, 0x65, 0x00, 0x75, 0x6E, 0x69, 0x76, 0x65, 0x72, 0x73, 0x61, 0x6C, 0x5F, 0x65, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x5F, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x00, 0x49, 0x6E, 0x69, 0x74, 0x69, 0x61, 0x6C, 0x69, 0x7A, 0x65, 0x00, 0x67, 0x5F, 0x63, 0x6F, 0x6E, 0x74, 0x65, 0x78, 0x74, 0x50, 0x74, 0x72, 0x00, 0x67, 0x5F, 0x54, 0x6F, 0x75, 0x63, 0x68, 0x44, 0x65, 0x76, 0x69, 0x63, 0x65, 0x46, 0x44, 0x00, 0x70, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5F, 0x72, 0x77, 0x6C, 0x6F, 0x63, 0x6B, 0x61, 0x74, 0x74, 0x72, 0x5F, 0x69, 0x6E, 0x69, 0x74, 0x00, 0x70, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5F, 0x72, 0x77, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x69, 0x6E, 0x69, 0x74, 0x00, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x73, 0x54, 0x68, 0x72, 0x65, 0x61, 0x64, 0x00, 0x70, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5F, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x00, 0x6D, 0x73, 0x6C, 0x65, 0x65, 0x70, 0x00, 0x6D, 0x79, 0x52, 0x65, 0x61, 0x64, 0x00, 0x73, 0x79, 0x73, 0x63, 0x61, 0x6C, 0x6C, 0x00, 0x5F, 0x5F, 0x65, 0x72, 0x72, 0x6E, 0x6F, 0x00, 0x70, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5F, 0x72, 0x77, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x77, 0x72, 0x6C, 0x6F, 0x63, 0x6B, 0x00, 0x70, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5F, 0x72, 0x77, 0x6C, 0x6F, 0x63, 0x6B, 0x5F, 0x75, 0x6E, 0x6C, 0x6F, 0x63, 0x6B, 0x00, 0x72, 0x65, 0x61, 0x64, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x49, 0x6E, 0x6E, 0x65, 0x72, 0x00, 0x72, 0x65, 0x61, 0x64, 0x43, 0x61, 0x6C, 0x6C, 0x62, 0x61, 0x63, 0x6B, 0x00, 0x67, 0x5F, 0x49, 0x73, 0x49, 0x6E, 0x6A, 0x65, 0x63, 0x74, 0x6F, 0x72, 0x4F, 0x6B, 0x00, 0x67, 0x5F, 0x74, 0x6F, 0x75, 0x63, 0x68, 0x45, 0x76, 0x65, 0x6E, 0x74, 0x50, 0x74, 0x72, 0x00, 0x67, 0x65, 0x74, 0x61, 0x75, 0x78, 0x76, 0x61, 0x6C, 0x00, 0x5F, 0x5F, 0x73, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x5F, 0x70, 0x72, 0x6F, 0x70, 0x65, 0x72, 0x74, 0x79, 0x5F, 0x67, 0x65, 0x74, 0x00, 0x73, 0x74, 0x72, 0x6E, 0x63, 0x6D, 0x70, 0x00, 0x6C, 0x69, 0x62, 0x63, 0x2E, 0x73, 0x6F, 0x00, 0x4C, 0x49, 0x42, 0x43, 0x00, 0x6C, 0x69, 0x62, 0x64, 0x6C, 0x2E, 0x73, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB0, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB8, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC8, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x78, 0x79, 0x6E, 0x6F, 0x73, 0x39, 0x38, 0x31, 0x30, 0x00, 0x72, 0x6F, 0x2E, 0x61, 0x72, 0x63, 0x68, 0x00, 0x00, 0x01, 0x1B, 0x03, 0x3B, 0x90, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x8C, 0x12, 0x00, 0x00, 0xAC, 0x00, 0x00, 0x00, 0x9C, 0x12, 0x00, 0x00, 0xC4, 0x00, 0x00, 0x00, 0xA4, 0x12, 0x00, 0x00, 0xDC, 0x00, 0x00, 0x00, 0xAC, 0x12, 0x00, 0x00, 0xF4, 0x00, 0x00, 0x00, 0xC0, 0x12, 0x00, 0x00, 0x0C, 0x01, 0x00, 0x00, 0xDC, 0x12, 0x00, 0x00, 0x24, 0x01, 0x00, 0x00, 0xEC, 0x12, 0x00, 0x00, 0x3C, 0x01, 0x00, 0x00, 0xF4, 0x12, 0x00, 0x00, 0x54, 0x01, 0x00, 0x00, 0x54, 0x13, 0x00, 0x00, 0x6C, 0x01, 0x00, 0x00, 0xB4, 0x13, 0x00, 0x00, 0x84, 0x01, 0x00, 0x00, 0xC8, 0x13, 0x00, 0x00, 0x9C, 0x01, 0x00, 0x00, 0x48, 0x14, 0x00, 0x00, 0xBC, 0x01, 0x00, 0x00, 0x5C, 0x14, 0x00, 0x00, 0xDC, 0x01, 0x00, 0x00, 0xC0, 0x15, 0x00, 0x00, 0x04, 0x02, 0x00, 0x00, 0xC0, 0x16, 0x00, 0x00, 0x2C, 0x02, 0x00, 0x00, 0xEC, 0x16, 0x00, 0x00, 0x4C, 0x02, 0x00, 0x00, 0x20, 0x17, 0x00, 0x00, 0x64, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5F, 0x24, 0x03, 0xD5, 0x00, 0x00, 0x00, 0xD0, 0x00, 0xC0, 0x0D, 0x91, 0x51, 0x01, 0x00, 0x14, 0x5F, 0x24, 0x03, 0xD5, 0xC0, 0x03, 0x5F, 0xD6, 0x5F, 0x24, 0x03, 0xD5, 0xFD, 0xFF, 0xFF, 0x17, 0x5F, 0x24, 0x03, 0xD5, 0x60, 0x00, 0x00, 0xB4, 0xF0, 0x03, 0x00, 0xAA, 0x00, 0x02, 0x1F, 0xD6, 0xC0, 0x03, 0x5F, 0xD6, 0x5F, 0x24, 0x03, 0xD5, 0xE1, 0x03, 0x00, 0xAA, 0x00, 0x00, 0x00, 0x90, 0x02, 0x00, 0x00, 0xD0, 0x00, 0x00, 0x35, 0x91, 0x42, 0xC0, 0x0D, 0x91, 0x45, 0x01, 0x00, 0x14, 0x5F, 0x24, 0x03, 0xD5, 0x03, 0x00, 0x00, 0xD0, 0x63, 0xC0, 0x0D, 0x91, 0x45, 0x01, 0x00, 0x14, 0x1F, 0x00, 0x00, 0xF9, 0xC0, 0x03, 0x5F, 0xD6, 0x09, 0x20, 0x40, 0x29, 0xEA, 0xA3, 0x90, 0x52, 0x08, 0x7D, 0x40, 0x93, 0x6A, 0x3D, 0xAA, 0x72, 0x0B, 0x05, 0x00, 0x11, 0x6A, 0x7D, 0x2A, 0x9B, 0x4C, 0xFD, 0x7F, 0xD3, 0x4A, 0xFD, 0x66, 0x93, 0x4A, 0x01, 0x0C, 0x0B, 0x0C, 0x19, 0x80, 0x52, 0x4A, 0xAD, 0x0C, 0x1B, 0x5F, 0x01, 0x09, 0x6B, 0x20, 0x01, 0x00, 0x54, 0x0B, 0x03, 0x80, 0x52, 0x20, 0x00, 0xC0, 0x3D, 0x1F, 0x20, 0x03, 0xD5, 0x08, 0x01, 0x0B, 0x9B, 0x2B, 0x08, 0x40, 0xF9, 0x0B, 0x0D, 0x00, 0xF9, 0x00, 0x81, 0x80, 0x3C, 0x0A, 0x04, 0x00, 0xB9, 0x5F, 0x01, 0x09, 0x6B, 0xE0, 0x07, 0x9F, 0x1A, 0xC0, 0x03, 0x5F, 0xD6, 0x08, 0x24, 0x40, 0x29, 0x08, 0x7D, 0x40, 0x93, 0x1F, 0x01, 0x09, 0x6B, 0x40, 0x02, 0x00, 0x54, 0x0A, 0x03, 0x80, 0x52, 0x0A, 0x01, 0x0A, 0x9B, 0x4B, 0x0D, 0x40, 0xF9, 0x40, 0x81, 0xC0, 0x3C, 0x2B, 0x08, 0x00, 0xF9, 0xEB, 0xA3, 0x90, 0x52, 0x20, 0x00, 0x80, 0x3D, 0x6B, 0x3D, 0xAA, 0x72, 0x0A, 0x00, 0x40, 0xB9, 0x4A, 0x05, 0x00, 0x11, 0x4B, 0x7D, 0x2B, 0x9B, 0x6C, 0xFD, 0x7F, 0xD3, 0x6B, 0xFD, 0x66, 0x93, 0x6B, 0x01, 0x0C, 0x0B, 0x0C, 0x19, 0x80, 0x52, 0x6A, 0xA9, 0x0C, 0x1B, 0x0A, 0x00, 0x00, 0xB9, 0x1F, 0x01, 0x09, 0x6B, 0xE0, 0x07, 0x9F, 0x1A, 0xC0, 0x03, 0x5F, 0xD6, 0x09, 0x20, 0x40, 0x29, 0x08, 0x01, 0x09, 0x6B, 0x09, 0x21, 0x03, 0x11, 0x20, 0xB1, 0x88, 0x1A, 0xC0, 0x03, 0x5F, 0xD6, 0xFD, 0x7B, 0xBE, 0xA9, 0xF3, 0x0B, 0x00, 0xF9, 0xFD, 0x03, 0x00, 0x91, 0x13, 0x00, 0x00, 0xD0, 0x08, 0x00, 0x00, 0xD0, 0xA0, 0x63, 0x00, 0x91, 0x73, 0x92, 0x42, 0xF9, 0x08, 0x95, 0x42, 0xF9, 0x69, 0x02, 0x40, 0xF9, 0x08, 0x01, 0x40, 0xB9, 0x3F, 0x09, 0x00, 0xF9, 0x28, 0x0D, 0x00, 0xB9, 0x05, 0x01, 0x00, 0x94, 0x68, 0x02, 0x40, 0xF9, 0x09, 0x5B, 0x82, 0x52, 0xA1, 0x63, 0x00, 0x91, 0x00, 0x01, 0x09, 0x8B, 0x04, 0x01, 0x00, 0x94, 0x68, 0x02, 0x40, 0xF9, 0x02, 0x00, 0x00, 0xD0, 0x09, 0x62, 0x82, 0x52, 0xE1, 0x03, 0x1F, 0xAA, 0xE3, 0x03, 0x1F, 0xAA, 0x00, 0x01, 0x09, 0x8B, 0x42, 0x98, 0x42, 0xF9, 0x00, 0x01, 0x00, 0x94, 0x68, 0x02, 0x40, 0xF9, 0x29, 0x00, 0x80, 0x52, 0xF3, 0x0B, 0x40, 0xF9, 0x09, 0x05, 0x00, 0xB9, 0xFD, 0x7B, 0xC2, 0xA8, 0xC0, 0x03, 0x5F, 0xD6, 0xFD, 0x7B, 0xBF, 0xA9, 0xFD, 0x03, 0x00, 0x91, 0x00, 0x7D, 0x80, 0x52, 0xFA, 0x00, 0x00, 0x94, 0xFE, 0xFF, 0xFF, 0x17, 0xFF, 0x83, 0x01, 0xD1, 0xFD, 0x7B, 0x02, 0xA9, 0xFD, 0x83, 0x00, 0x91, 0xF7, 0x1B, 0x00, 0xF9, 0xF6, 0x57, 0x04, 0xA9, 0xF4, 0x4F, 0x05, 0xA9, 0x17, 0x00, 0x00, 0xD0, 0xF6, 0x03, 0x02, 0xAA, 0xF3, 0x03, 0x01, 0xAA, 0xE0, 0x07, 0x80, 0x52, 0xE2, 0x03, 0x13, 0xAA, 0xE3, 0x03, 0x16, 0xAA, 0xF7, 0x92, 0x42, 0xF9, 0xE8, 0x02, 0x40, 0xF9, 0x01, 0x0D, 0x40, 0xB9, 0xF1, 0x00, 0x00, 0x94, 0xF5, 0x03, 0x00, 0xAA, 0xF3, 0x00, 0x00, 0x94, 0x08, 0x00, 0x40, 0xB9, 0xF4, 0x03, 0x00, 0xAA, 0x1F, 0x2D, 0x00, 0x71, 0x60, 0x00, 0x00, 0x54, 0x1F, 0x11, 0x00, 0x71, 0x61, 0x07, 0x00, 0x54, 0xE9, 0x02, 0x40, 0xF9, 0xE8, 0xF3, 0x01, 0xB2, 0x68, 0x55, 0x95, 0xF2, 0x0A, 0x5B, 0x82, 0x52, 0x20, 0x01, 0x0A, 0x8B, 0xC8, 0x7E, 0xC8, 0x9B, 0x16, 0xFD, 0x44, 0xD3, 0xE9, 0x00, 0x00, 0x94, 0xE8, 0x02, 0x40, 0xF9, 0x0D, 0x39, 0x42, 0x29, 0xC9, 0x01, 0x0D, 0x6B, 0x2A, 0x21, 0x03, 0x11, 0x49, 0xB1, 0x89, 0x1A, 0x3F, 0x01, 0x16, 0x6B, 0xD6, 0xC2, 0x89, 0x1A, 0xDF, 0x06, 0x00, 0x71, 0xEB, 0x04, 0x00, 0x54, 0xEB, 0xA3, 0x90, 0x52, 0xC9, 0x06, 0x00, 0xD1, 0x0A, 0x03, 0x80, 0x52, 0x6B, 0x3D, 0xAA, 0x72, 0x0C, 0x19, 0x80, 0x52, 0xBF, 0x01, 0x0E, 0x6B, 0xC0, 0x01, 0x00, 0x54, 0xAF, 0x05, 0x00, 0x11, 0x0E, 0x41, 0x00, 0x91, 0xAD, 0x39, 0x2A, 0x9B, 0xEE, 0x7D, 0x2B, 0x9B, 0xD0, 0xFD, 0x7F, 0xD3, 0xCE, 0xFD, 0x66, 0x93, 0xCE, 0x01, 0x10, 0x0B, 0xA0, 0x81, 0xC0, 0x3C, 0xAD, 0x0D, 0x40, 0xF9, 0xCE, 0xBD, 0x0C, 0x1B, 0xE0, 0x03, 0x80, 0x3D, 0xED, 0x0B, 0x00, 0xF9, 0x0E, 0x11, 0x00, 0xB9, 0xE0, 0x03, 0xC0, 0x3D, 0xED, 0x0B, 0x40, 0xF9, 0x60, 0x02, 0x80, 0x3D, 0x6D, 0x0A, 0x00, 0xF9, 0xE9, 0x00, 0x00, 0xB4, 0x0D, 0x39, 0x42, 0x29, 0x73, 0x62, 0x00, 0x91, 0x29, 0x05, 0x00, 0xD1, 0xBF, 0x01, 0x0E, 0x6B, 0x41, 0xFD, 0xFF, 0x54, 0xF6, 0xFF, 0xFF, 0x17, 0x09, 0x5B, 0x82, 0x52, 0x00, 0x01, 0x09, 0x8B, 0xC2, 0x00, 0x00, 0x94, 0x08, 0x03, 0x80, 0x52, 0x9F, 0x02, 0x00, 0xB9, 0xD5, 0x7E, 0x28, 0x9B, 0x04, 0x00, 0x00, 0x14, 0x09, 0x5B, 0x82, 0x52, 0x00, 0x01, 0x09, 0x8B, 0xBB, 0x00, 0x00, 0x94, 0xE0, 0x03, 0x15, 0xAA, 0xF7, 0x1B, 0x40, 0xF9, 0xF4, 0x4F, 0x45, 0xA9, 0xF6, 0x57, 0x44, 0xA9, 0xFD, 0x7B, 0x42, 0xA9, 0xFF, 0x83, 0x01, 0x91, 0xC0, 0x03, 0x5F, 0xD6, 0xFF, 0x03, 0x01, 0xD1, 0xFD, 0x7B, 0x01, 0xA9, 0xFD, 0x43, 0x00, 0x91, 0xF6, 0x57, 0x02, 0xA9, 0xF4, 0x4F, 0x03, 0xA9, 0x15, 0x00, 0x00, 0xB0, 0xF3, 0x03, 0x00, 0xAA, 0xB5, 0x92, 0x42, 0xF9, 0x14, 0x00, 0x40, 0xB9, 0xA2, 0x02, 0x40, 0xF9, 0x48, 0x04, 0x40, 0xB9, 0x48, 0x04, 0x00, 0x35, 0xE0, 0x03, 0x1F, 0x2A, 0x21, 0x00, 0x80, 0x52, 0x36, 0x00, 0x80, 0x52, 0x3C, 0x00, 0x00, 0x94, 0x1F, 0x00, 0x00, 0x71, 0x21, 0x03, 0x00, 0x54, 0x08, 0x00, 0x00, 0xB0, 0xE0, 0x23, 0x00, 0x91, 0x08, 0x95, 0x42, 0xF9, 0xA9, 0x02, 0x40, 0xF9, 0x08, 0x01, 0x40, 0xB9, 0x3F, 0x09, 0x00, 0xF9, 0x28, 0x0D, 0x00, 0xB9, 0x7A, 0x00, 0x00, 0x94, 0xA8, 0x02, 0x40, 0xF9, 0x09, 0x5B, 0x82, 0x52, 0xE1, 0x23, 0x00, 0x91, 0x00, 0x01, 0x09, 0x8B, 0x79, 0x00, 0x00, 0x94, 0xA8, 0x02, 0x40, 0xF9, 0x02, 0x00, 0x00, 0xB0, 0x09, 0x62, 0x82, 0x52, 0xE1, 0x03, 0x1F, 0xAA, 0xE3, 0x03, 0x1F, 0xAA, 0x00, 0x01, 0x09, 0x8B, 0x42, 0x98, 0x42, 0xF9, 0x75, 0x00, 0x00, 0x94, 0xA2, 0x02, 0x40, 0xF9, 0x56, 0x04, 0x00, 0xB9, 0x04, 0x00, 0x00, 0x14, 0xA2, 0x02, 0x40, 0xF9, 0x48, 0x04, 0x40, 0xB9, 0xC8, 0x01, 0x00, 0x34, 0x48, 0x0C, 0x40, 0xB9, 0x1F, 0x01, 0x14, 0x6B, 0x61, 0x01, 0x00, 0x54, 0x61, 0x8A, 0x40, 0xA9, 0x72, 0x00, 0x00, 0x94, 0xE8, 0x03, 0x00, 0xAA, 0x20, 0x00, 0x80, 0x52, 0x68, 0x02, 0x00, 0xF9, 0xF4, 0x4F, 0x43, 0xA9, 0xF6, 0x57, 0x42, 0xA9, 0xFD, 0x7B, 0x41, 0xA9, 0xFF, 0x03, 0x01, 0x91, 0xC0, 0x03, 0x5F, 0xD6, 0xE0, 0x03, 0x1F, 0x2A, 0xF4, 0x4F, 0x43, 0xA9, 0xF6, 0x57, 0x42, 0xA9, 0xFD, 0x7B, 0x41, 0xA9, 0xFF, 0x03, 0x01, 0x91, 0xC0, 0x03, 0x5F, 0xD6, 0xFD, 0x7B, 0xBE, 0xA9, 0xF3, 0x0B, 0x00, 0xF9, 0xFD, 0x03, 0x00, 0x91, 0xF3, 0x03, 0x00, 0xAA, 0x73, 0x00, 0x00, 0x94, 0x1F, 0x00, 0x00, 0x71, 0xE8, 0x07, 0x9F, 0x1A, 0x68, 0x26, 0x00, 0xF9, 0xF3, 0x0B, 0x40, 0xF9, 0xFD, 0x7B, 0xC2, 0xA8, 0xC0, 0x03, 0x5F, 0xD6, 0x5F, 0x24, 0x03, 0xD5, 0x10, 0x00, 0x00, 0xD0, 0x10, 0xB2, 0x57, 0x39, 0x70, 0x00, 0x00, 0x34, 0x41, 0xFC, 0xE0, 0x48, 0xC0, 0x03, 0x5F, 0xD6, 0x10, 0x3C, 0x00, 0x53, 0x40, 0xFC, 0x5F, 0x48, 0x1F, 0x00, 0x10, 0x6B, 0x61, 0x00, 0x00, 0x54, 0x41, 0xFC, 0x11, 0x48, 0x91, 0xFF, 0xFF, 0x35, 0xC0, 0x03, 0x5F, 0xD6, 0x3F, 0x23, 0x03, 0xD5, 0xFF, 0xC3, 0x01, 0xD1, 0xFE, 0x4F, 0x06, 0xA9, 0x00, 0x02, 0x80, 0x52, 0x5F, 0x00, 0x00, 0x94, 0xF3, 0x03, 0x00, 0xAA, 0x13, 0x01, 0x40, 0x37, 0xE8, 0x03, 0x1F, 0x2A, 0xFE, 0x4F, 0x46, 0xA9, 0x09, 0x00, 0x00, 0xD0, 0x28, 0xB1, 0x17, 0x39, 0xFF, 0xC3, 0x01, 0x91, 0xBF, 0x23, 0x03, 0xD5, 0xC0, 0x03, 0x5F, 0xD6, 0xE0, 0xFF, 0xFF, 0xD0, 0xE1, 0x13, 0x00, 0x91, 0x00, 0x2C, 0x2A, 0x91, 0x56, 0x00, 0x00, 0x94, 0x1F, 0x04, 0x00, 0x71, 0x6B, 0x01, 0x00, 0x54, 0xE1, 0xFF, 0xFF, 0xD0, 0xE0, 0x13, 0x00, 0x91, 0x21, 0x00, 0x2A, 0x91, 0x42, 0x01, 0x80, 0x52, 0x68, 0x02, 0x78, 0x92, 0x13, 0xFD, 0x48, 0xD3, 0x51, 0x00, 0x00, 0x94, 0x1F, 0x00, 0x00, 0x71, 0xE8, 0x03, 0x93, 0x1A, 0x02, 0x00, 0x00, 0x14, 0x68, 0x22, 0x48, 0xD3, 0x1F, 0x01, 0x00, 0x71, 0xE8, 0x07, 0x9F, 0x1A, 0xFE, 0x4F, 0x46, 0xA9, 0x09, 0x00, 0x00, 0xD0, 0x28, 0xB1, 0x17, 0x39, 0xFF, 0xC3, 0x01, 0x91, 0xBF, 0x23, 0x03, 0xD5, 0xC0, 0x03, 0x5F, 0xD6, 0xF0, 0x7B, 0xBF, 0xA9, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xA6, 0x42, 0xF9, 0x10, 0x22, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x1F, 0x20, 0x03, 0xD5, 0x1F, 0x20, 0x03, 0xD5, 0x1F, 0x20, 0x03, 0xD5, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xAA, 0x42, 0xF9, 0x10, 0x42, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xAE, 0x42, 0xF9, 0x10, 0x62, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xB2, 0x42, 0xF9, 0x10, 0x82, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xB6, 0x42, 0xF9, 0x10, 0xA2, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xBA, 0x42, 0xF9, 0x10, 0xC2, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xBE, 0x42, 0xF9, 0x10, 0xE2, 0x15, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xC2, 0x42, 0xF9, 0x10, 0x02, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xC6, 0x42, 0xF9, 0x10, 0x22, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xCA, 0x42, 0xF9, 0x10, 0x42, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xCE, 0x42, 0xF9, 0x10, 0x62, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xD2, 0x42, 0xF9, 0x10, 0x82, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xD6, 0x42, 0xF9, 0x10, 0xA2, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xDA, 0x42, 0xF9, 0x10, 0xC2, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xDE, 0x42, 0xF9, 0x10, 0xE2, 0x16, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xE2, 0x42, 0xF9, 0x10, 0x02, 0x17, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x10, 0x00, 0x00, 0xB0, 0x11, 0xE6, 0x42, 0xF9, 0x10, 0x22, 0x17, 0x91, 0x20, 0x02, 0x1F, 0xD6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDA, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xCD, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFF, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF9, 0xFF, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF5, 0xFE, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1B, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x6F, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2E, 0x69, 0x6E, 0x69, 0x74, 0x5F, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x2E, 0x66, 0x69, 0x6E, 0x69, 0x5F, 0x61, 0x72, 0x72, 0x61, 0x79, 0x00, 0x2E, 0x74, 0x65, 0x78, 0x74, 0x00, 0x2E, 0x67, 0x6F, 0x74, 0x00, 0x2E, 0x6E, 0x6F, 0x74, 0x65, 0x2E, 0x61, 0x6E, 0x64, 0x72, 0x6F, 0x69, 0x64, 0x2E, 0x69, 0x64, 0x65, 0x6E, 0x74, 0x00, 0x2E, 0x67, 0x6F, 0x74, 0x2E, 0x70, 0x6C, 0x74, 0x00, 0x2E, 0x72, 0x65, 0x6C, 0x61, 0x2E, 0x70, 0x6C, 0x74, 0x00, 0x2E, 0x62, 0x73, 0x73, 0x00, 0x2E, 0x64, 0x79, 0x6E, 0x73, 0x74, 0x72, 0x00, 0x2E, 0x65, 0x68, 0x5F, 0x66, 0x72, 0x61, 0x6D, 0x65, 0x5F, 0x68, 0x64, 0x72, 0x00, 0x2E, 0x67, 0x6E, 0x75, 0x2E, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x5F, 0x72, 0x00, 0x2E, 0x64, 0x61, 0x74, 0x61, 0x2E, 0x72, 0x65, 0x6C, 0x2E, 0x72, 0x6F, 0x00, 0x2E, 0x72, 0x65, 0x6C, 0x61, 0x2E, 0x64, 0x79, 0x6E, 0x00, 0x2E, 0x67, 0x6E, 0x75, 0x2E, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x00, 0x2E, 0x64, 0x79, 0x6E, 0x73, 0x79, 0x6D, 0x00, 0x2E, 0x67, 0x6E, 0x75, 0x2E, 0x68, 0x61, 0x73, 0x68, 0x00, 0x2E, 0x64, 0x79, 0x6E, 0x61, 0x6D, 0x69, 0x63, 0x00, 0x2E, 0x73, 0x68, 0x73, 0x74, 0x72, 0x74, 0x61, 0x62, 0x00, 0x2E, 0x72, 0x6F, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x0B, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8C, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x6F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x00, 0x00, 0x00, 0xFE, 0xFF, 0xFF, 0x6F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA1, 0x00, 0x00, 0x00, 0xF6, 0xFF, 0xFF, 0x6F, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xBE, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x75, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0E, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB4, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD0, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 8 | }; 9 | 10 | } 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | export CXX=~/Desktop/tools/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang++ 2 | export CC=~/Desktop/tools/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android33-clang 3 | 4 | export OBJCOPY=~/Desktop/tools/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy 5 | export STRIP=~/Desktop/tools/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-objcopy 6 | 7 | $CC TouchLab.c -o TouchLab.so -w -O3 -shared -fPIC 8 | $STRIP --strip-all TouchLab.so 9 | $OBJCOPY --remove-section .eh_frame TouchLab.so 10 | 11 | python trans2Char.py TouchLab.so > binso.hpp 12 | 13 | $CXX Injector.cpp KDrv.cpp KDrvImpl.cpp $INCS $LIBS $LIB -static-libstdc++ -std=c++17 -w -O3 -o Injector.elf 14 | 15 | 16 | -------------------------------------------------------------------------------- /catlog.sh: -------------------------------------------------------------------------------- 1 | adb shell su -c logcat | grep TOUCHLAB 2 | -------------------------------------------------------------------------------- /killserver.sh: -------------------------------------------------------------------------------- 1 | adb shell su -c killall -9 system_server -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## 注入被SELinux保护的系统服务进程 2 | 3 | 1. 手工映射要注入的SO,以对方的进程模块信息来修补SO的重定位 4 | 5 | 2. 以对方进程libbacktrace.so的.text段作为nest,写入映射后的SO 6 | 7 | 3. Hook对方进程的某个经常被调用的函数作为执行时机初始化代码(比如 libc.so.read) 8 | 9 | 4. 编写要注入的SO文件时需保证不写全局变量(你在一个权限为r-x的内存范围内运行这个SO) 10 | 11 | 仓库里的代码是一个hook system_server的read函数从而劫持eventhub实现模拟触摸的半成品 12 | 13 | ## 使用方式: 14 | 把仓库里的build.sh文件中的以下几个变量修改成ndk的clang路径 15 | ``` 16 | export CXX 17 | export CC 18 | export OBJCOPY 19 | export STRIP 20 | ``` 21 | bash 运行./build.sh 22 | bash 运行./run.sh 23 | 24 | -------------------------------------------------------------------------------- /run.sh: -------------------------------------------------------------------------------- 1 | 2 | adb push Injector.elf /data/local/tmp/Injector.elf 3 | adb shell chmod 777 /data/local/tmp/Injector.elf 4 | adb shell su -c /data/local/tmp/Injector.elf 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /trans2Char.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | filename = sys.argv[1] 4 | 5 | with open(filename,'rb') as sf: 6 | data=sf.read() 7 | 8 | 9 | c_array = ['0x{:02X}'.format(byte) for byte in data] 10 | c_array_str = ', '.join(c_array) 11 | 12 | namespace = 'binso' 13 | 14 | header_content = '#ifndef _BINARY_DATA_H_\n' 15 | header_content += '#define _BINARY_DATA_H_\n\n' 16 | header_content += 'namespace ' + namespace + ' {\n\n' 17 | header_content += 'unsigned char binary_data[] = {\n' 18 | header_content += ' ' + c_array_str + '\n};\n\n' 19 | header_content += '}\n\n' 20 | header_content += '#endif' 21 | 22 | print(header_content) 23 | -------------------------------------------------------------------------------- /util.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by www on 2023/4/21. 3 | // 4 | 5 | #ifndef MAPELF_CUSTOMDEF_H 6 | #define MAPELF_CUSTOMDEF_H 7 | 8 | #include 9 | #include 10 | 11 | #define pp1x(v)printf(""#v"\t= %08llX\n",(uint64_t)v);fflush(stdout); 12 | #define pp1d(v)printf(""#v"\t= %08lld\n",(uint64_t)v);fflush(stdout); 13 | 14 | #define p1x pp1x 15 | #define p1d pp1d 16 | 17 | typedef uint8_t u8; 18 | typedef uint16_t u16; 19 | typedef uint32_t u32; 20 | typedef uint64_t u64; 21 | 22 | typedef uint64_t bloom_el_t; 23 | #define ELFCLASS_BITS 64 24 | 25 | #endif //MAPELF_CUSTOMDEF_H 26 | --------------------------------------------------------------------------------