如何解决我从Google Drive下载数据的curl脚本出现异常
我使用以下脚本下载Darpa数据,这对我的安全性研究很有用。该脚本将按正确的顺序下载文件,最后使用md5sum对其进行验证。它在一开始就可以正常工作,但是当它结束时,我发现许多人未通过验证。而且我发现此脚本下载的对应文件都是3103b,这很奇怪(它们不应该那么小而且大小相同)。这是zsh打印的图片:
function download_file(){
fileId=$2
fileName=$1
curl -sc /tmp/cookie "https://drive.google.com/uc?export=download&id=${fileId}" > /dev/null
code="$(awk '/_warning_/ {print $NF}' /tmp/cookie)"
curl -Lb /tmp/cookie "https://drive.google.com/uc?
export=download&confirm=${code}&id=${fileId}" -o ${fileName}
}
function download_list(){
echo $1
input="$1/filelist"
while IFS= read -r line
do
# echo "$line"
items=($line)
download_file "$1/${items[0]}" ${items[1]}
done < "$input"
}
function validate(){
input="$1/bins.md5sum"
while IFS= read -r line
do
# echo "$line"
items=($line)
md5sumstring=`md5sum $1/${items[1]}`
md5sum=($md5sumstring[0])
if [ "$md5sum" = "${items[0]}" ]; then
echo "$md5sum has the value '${items[0]}'"
else
echo "$1/${items[1]} is not valid"
fi
#download_file "$1/${items[0]}" ${items[1]}
done < "$input"
}
download_list "./Engagement5/Data/cadets/"
download_list "./Engagement5/Data/clearscope/"
download_list "./Engagement5/Data/fivedirections/"
download_list "./Engagement5/Data/marple/"
download_list "./Engagement5/Data/theia/"
download_list "./Engagement5/Data/trace/"
validate "./Engagement5/Data/cadets/"
validate "./Engagement5/Data/clearscope/"
validate "./Engagement5/Data/fivedirections/"
validate "./Engagement5/Data/marple/"
validate "./Engagement5/Data/theia/"
validate "./Engagement5/Data/trace/"
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。