1 Star 0 Fork 0

cococc12 / libc-database

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
identify 889 Bytes
一键复制 编辑 原始数据 按行查看 历史
152334H 提交于 2020-09-06 19:34 . make identify position independent (#31)
#!/bin/bash
set -o pipefail
help() {
echo >&2 "Usage: $0 path/to/libc.so"
echo >&2 " OR $0 bid=<BUILD_ID>"
echo >&2 " OR $0 md5=<MD5>"
echo >&2 " OR $0 sha1=<SHA1>"
echo >&2 " OR $0 sha256=<SHA256>"
exit 2
}
if [[ $# != 1 ]]; then
help
fi
arg="$1"
if [ -f "$arg" ]; then
libc="$(readlink -f "$arg")"
fi
cd "$(dirname "$0")"
if [[ -f "$libc" ]]; then
arg="sha1=$(sha1sum "$libc" | awk '{print $1}')"
fi
case "$arg" in
bid=*)
hash="${arg#"bid="}"
tool="file"
regex="=$hash,"
;;
md5=*)
hash="${arg#"md5="}"
tool="md5sum"
regex="$hash "
;;
sha1=*)
hash="${arg#"sha1="}"
tool="sha1sum"
regex="$hash "
;;
sha256=*)
hash="${arg#"sha256="}"
tool="sha256sum"
regex="$hash "
;;
*)
help
esac
ls -1 db/*.so | xargs $tool | grep -- "$regex" | perl -n -e '/([^\/: ]+)\.so/&&print "$1\n"'
1
https://gitee.com/cococc12/libc-database.git
git@gitee.com:cococc12/libc-database.git
cococc12
libc-database
libc-database
master

搜索帮助