And*_*mbu 9 linux skype avatar
我在 Linux 上使用 Skype。
我在哪里可以找到我的联系人头像的 Skype 缓存的图像?
这是一个更清晰的脚本,从 main.db 文件中提取低清晰度和高清晰度头像,并将它们保存到以相应的 Skype 用户名命名的文件中。
您将需要 sqlite3 和 xxd 来运行此脚本。
main.db 数据库的内容相当容易理解,只要稍加想象,就可以从中提取出更多内容。
#!/bin/bash
if (( $# != 1 ))
then
echo "Usage: $0 folder"
echo "Where folder is of the form /home/username/.Skype/username"
exit 1
fi
# Magic string used at the beginning of JPEG files
magic=FFD8FFE0
# We read main.db and extract the Skype name, the avatar image and the
# attachments (which often contain a high-def version of the avatar image)
sqlite3 "$1/main.db" "select skypename,hex(avatar_image),hex(profile_attachments) from Contacts;" |\
while read line
do
IFS='|'
# We convert the line into an array
a=($line)
if [[ -n ${a[1]} ]] # There is an avatar_image
then
# We strip everything before the magic string, convert it back to binary, and save it to a file
echo $magic${a[1]#*$magic} | xxd -r -p > ${a[0]}_small.jpg
fi
if [[ -n ${a[2]} ]] # There is a profile_attachments
then
# Same as above
echo $magic${a[2]#*$magic} | xxd -r -p > ${a[0]}.jpg
fi
done
Run Code Online (Sandbox Code Playgroud)
小智 5
我也想获得那些 Skype 头像,所以我使用 whitequark 的答案制作了一个小 bash 脚本,它就是这样做的。这里是:
#!/bin/bash
如果 [ \( $# -lt 1 \) ];
然后
echo "用法:$0 文件夹";
echo "文件夹的格式为 /home/username/.Skype/username";
出口;
fi;
对于 i 在 `ls $1` 中;
做
如果 [ -f $1/$i ];
然后
#echo "i: $i";
filedump=`hexdump -v -e '"" 1/1 "%02x" ""' $1/$i | sed -e 's/ffd8ffe0/\nffd8ffe0/g'`;
nocc=`echo "$filedump" | wc -l`; # \n 字符的出现次数。意味着我们的单词出现了 nocc-1
#echo "nocc: $nocc";
if [ "$nocc" -ge 2 ];
然后
k=0;
old_IFS=$IFS; #字段分隔符
IFS=$'\n';
偏移=0;
对于 $filedump 中的 j;
做
w=`echo $j | wc -m`; # 给出实际的字母计数+1
w=$[w-1];
偏移=$[偏移+w];
#echo "偏移量:$offset";
filename1="${i}_${k}_notclean.jpg";
filename2="${i}_${k}.jpg";
dd ibs=1 if=$1/$i of=$filename1 skip=`echo "$offset/2" | bc`状态= noxfer;
如果 [`du $filename1 | cut -f1` -gt 0 ];
然后
转换 $filename1 $filename2; #convert 其实只是用来去除图片后的数据
fi;
rm $文件名1;
k=$[k+1];
完毕;
IFS=$old_IFS;
fi;
fi;
完毕
| 归档时间: |
|
| 查看次数: |
8091 次 |
| 最近记录: |