-/bin/sh not found

      1 #! /bin/bash
      2 LIB_CUR_REL=
      3 LIB_CUR_ABS=
      4
      5 get_binary_dependency()
      6 {
      7     readelf -d $1 | grep NEEDED | sed -n 's,.*\[\(.*\)\],\1,p'
      8 }
      9
     10 expand_path()
     11 {
     12     LIB_CUR_ABS=
     13     for i in /lib /usr/lib ${LD_LIBRARY_PATH}
     14     do
     15         for j in $@
     16         do
     17             if [ -f ${i}/${j} ]
     18             then
     19                 LIB_CUR_ABS="${LIB_CUR_ABS} ${i}/${j}"
     20             fi
     21         done
     22     done
     23 }
     24
     25 get_abs_dependency()
     26 {
     27     TMP=$(get_binary_dependency $@)
     28 }
     29
     30 LIB_CUR_REL="$(get_binary_dependency $@)"
     31 expand_path ${LIB_CUR_REL}
     32
     33 #for i in ${LIB_CUR_ABS}
     34 #do
     35 #   echo $i
     36 #done
     37
提取应用程序中所需的动态库,基本上对了,不过今天用这个分析出动态库的时候还是少了一个,ld-linux-so.2(动态编译后执行当然需要它了!!)

当然了分析动态库还未结束,因为分析出来的动态库还依赖其它文件,这个脚本没有做进一步分析

posted on 2013-01-19 20:07  阿加  阅读(522)  评论(0编辑  收藏  举报

导航