由于工作需要,研究了一下如何从Android so中提取URL。Android so实际上是一个ELF(Executable and Linking Format)格式的文件,要从中提取URL就需要首先了解ELF文件格式。URL实际上就是一个字符串,要从Android so中提取URL,实际上我们只需知道ELF文件的字符串存储在哪个区段就可以了。以下为ELF文件区块表的介绍:

.text where code stands, as said above. objdump -drS .process.o will show you that
.data where global tables, variables, etc. stand. objdump -s -j .data .process.o will hexdump it.
.bss don't look for bits of .bss in your file: there's none. That's where your uninitialized arrays and variable are, and the loader 'knows' they should be filled with zeroes ... there's no point storing more zeroes on your disk than there already are, is it?
.rodata that's where your strings go, usually the things you forgot when linking and that cause your kernel not to work. objdump -s -j .rodata .process.o will hexdump it. Note that depending on the compiler, you may have more sections like this.
.comment & .note just comments put there by the compiler/linker toolchain
.stab & .stabstr debugging symbols & similar information.

  注:要想了解详细的ELF文件格式见http://wiki.osdev.org/ELF。此文只介绍与主题相关的知识。

从表中的粗体字可以知道.rodata区段便是ELF文件字符串的存储位置,使用objdump -s -j .rodata filename命令可以获取所有字符串信息,然后就可以提取URL了。

更多相关文章

  1. Android布局文件中控件的高度与宽度属性设置
  2. Android读取assets目录下文件数据内容
  3. Android工程中R.java文件的重新生成——注意资源文件的错误
  4. Android内核开发:系统分区与镜像文件的烧写
  5. 关于Android 动态加载 jar 文件
  6. Android系统编译―Android.mk文件的简单介绍
  7. android 工程中重新生成gen文件夹或R.java 文件
  8. [转载]Android布局文件中命名空间的解析
  9. Android Layout布局文件里的android:layout_height等属性不起作

随机推荐

  1. EditText的输入限制设置
  2. 【引用】Android的CTS测试
  3. 设置EditText可点击但是不可编辑
  4. adb pm 指令介绍
  5. [转]Android(安卓)JNI层实现文件的read、
  6. Android Fragment viewPage TabLayout用
  7. Android触摸屏事件派发机制详解与源码分
  8. Android心得4.3--SQLite数据库--execSQL(
  9. Android : 网络版学生系统
  10. Android Studio 技巧之【Extract Constan