├── LICENSE ├── README.md ├── backup.sh ├── bbb.jpg └── web_backup.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 chauncey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **正如其名,免费不限量备份数据,不限于网站数据,图片、数据库文件等任何资源。** 2 | 3 | ## 如何工作 4 | 5 | 现在很多的大型网站有提供上传图片功能,并且允许上传的图片体积还不小,那么就可以将此利用起来**将文件包装为图片进行上传**。例如以往很多人在图片里藏毒,藏密码,这里只是藏了一个文件而已。 6 | 7 | 对于大的文件只需要进行分片存储上传就行了,恢复时按顺序合成就能得到完整有效的文件。 8 | 9 | **所以本质是白嫖了大厂的云存储,且下载时能够得到满速下载。** 10 | 11 | ## 如何去做 12 | 13 | 如示例中的 bash 脚本一样,我提供了两个文件。 14 | 15 | - backup.sh 免费备份脚本 16 | - web_backup.sh 备份网站示例脚本 17 | 18 | 前者是主要备份脚本工作的内容流程,后者是如何将其利用起来定期备份你的网站数据,里面都有参考。 19 | 20 | 简单示例: 21 | 22 | **备份网站** 23 | 24 | 你将得到 `web.tar.gz.fbi`文件元信息文件(或种子文件),用来恢复数据。 25 | 26 | ``` 27 | ./backup.sh upload /tmp/web.tar.gz 28 | ``` 29 | 30 | **恢复数据** 31 | 32 | ``` 33 | ./backup.sh download web.tar.gz.fbi 34 | ``` 35 | 36 | ## 数据安全 37 | 38 | 脚本中并没有对数据进行加密,你所上传的文件虽然是被打碎了,但依然可以被对方网站人员拿到进行合并,且URL一般具有公开匿名访问特征,任何人都可以访问到。 39 | 40 | **所以它更大的意义是用于备份,为了保证数据安全,建议你采用 zip 将文件进行打包加密,或 openssl 进行加密,再去备份。**(web_backup.sh 有演示) 41 | 42 | 密码使用建议为双字节字符,如`お早う2022everyday!`、`圣诞快乐2o21🎄~`等 43 | 44 | **能够存储多久?** 45 | 46 | 这个是一个不确定性问题,有可能很长,有可能很短,取决于厂商风控,以及不被访问的图片会不会被定期归档删除等。 47 | 48 | **建议用来做每日计划任务备份,过于久远的不要考虑,可以用来缓解近期的数据丢失等问题。** 49 | 50 | 51 | 52 | ## 价值意义 53 | 54 | 在此之前我也已经用过此类方式一年多了,不过都是极小量的数据备份和朋友间的文件分享等,即没有滥用所以能够稳定的使用。 55 | 56 | 分享这个脚本出来一定会被滥用,且遭到对方厂商风控封禁等,或很快无法使用,但思路是一样简单的,有需要的可以根据此思路写出更多程序来掩盖特征,来对抗文件特征检查等风控行为。 57 | 58 | 在此之前看到很多人拿 TG 当网盘备份数据,确实也更方便,不限容量,文件永久保存,接口都是公开透明的,等等一系列的优点。但 TG 只有一个,无论它是不是付费的,但它保留有你免费的权益,起码它是在用心做软件的,**我更希望你们将白嫖的行为移动到这群只为利益的无良大厂上**。 59 | 60 | 61 | 62 | **若脚本内的接口不能用了,可自行替换更多其他厂商的接口,也建议直接拿到后改掉接口不要用默认的上传接口,也不要在我的帖子中回复任何厂商名字、关键字。** 63 | 64 | 65 | 66 | 思路扩展,不要这么局限性了~ 67 | 68 | - 其实你仔细观察就会发现,很多厂商是没有设置 CORS 限制的,也就意味着你可以将视频文件进行上传,并通过 JS 分片拉取,再转换成视频流渲染在网页里。 69 | 70 | - 还有就是你与你朋友分享文件时,用网盘过于麻烦还限速,为什么不用这种东西进行分享呢? 71 | 72 | 自己发现更多的乐趣吧~ 73 | 74 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # author: ellermister 3 | # Backup files to the cloud for free 4 | 5 | chunkBytesSize=$(expr 1024 \* 5) # KB 6 | outPath=outs 7 | realImage=bbb.jpg 8 | action=$1 9 | filePath=$2 10 | 11 | # 上传图片 12 | upload_image(){ 13 | local img_path=$1 14 | a9ih0st="YUhSMGNITTZMeTlpWVdscWFXRm9ZVzh1WW1GcFpIVXVZMjl0TDJKMWFXeGtaWEpwYm01bGNpOWhjR2t2WTI5dWRHVnVkQzltYVd4bApMM1Z3Ykc5aFpBbz0K" 15 | curl -s $(echo "$a9ih0st"|base64 -d|base64 -d) \ 16 | -H 'Accept: application/json' \ 17 | -H 'Accept-Language: en-US,en;q=0.9,zh-CN;q=0.8,zh;q=0.7' \ 18 | -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/533.37' \ 19 | -H 'Cache-Control: no-cache' \ 20 | -H 'Connection: keep-alive' \ 21 | -F 'no_compress=1' \ 22 | -F 'id=WU_FILE_0' \ 23 | -F 'is_avatar=0' \ 24 | -F "media=@$img_path" \ 25 | | grep -o -P '(?<="org_url":").*?(?=")' 26 | } 27 | 28 | 29 | # 伪装为图片 30 | disguised_as_image(){ 31 | cat $realImage $1 > "$1.jpg" 32 | echo "$1.jpg" 33 | } 34 | 35 | # 分割到文件块 36 | split_to_chunk_file(){ 37 | echo "chunk file : $1" 38 | local filePath=$1 39 | local fileName=$(basename "$filePath") 40 | 41 | if [[ -z $filePath || ! -f $filePath ]];then 42 | echo "filePath not found!" 43 | exit 44 | fi 45 | 46 | fileSize=$(du -b $filePath | awk '{print $1}') 47 | echo "The filesize is:$fileSize" 48 | echo "chunk size is: $chunkBytesSize" 49 | 50 | subFileNum=$(expr $fileSize / $(expr $chunkBytesSize \* 1024 )) 51 | if [ $(expr $fileSize % $chunkBytesSize) -ne 0 ];then 52 | subFileNum=$(expr $subFileNum + 1) 53 | fi 54 | echo "sub file number: $subFileNum" 55 | 56 | echo "$fileName will be divided into $subFileNum" 57 | local i=1 58 | local skipnum=0 59 | while [ $i -le $subFileNum ] 60 | do 61 | echo "$fileName$i" 62 | dd if=$filePath of="$outPath/$fileName.$i" bs=1024 count=$chunkBytesSize skip=$skipnum 63 | i=$(expr $i + 1) 64 | skipnum=$(expr $skipnum + $chunkBytesSize) 65 | done 66 | echo "$fileName has been divided into $subFileNum" 67 | 68 | i=1 69 | echo -e "fileName=$fileName\nfileSize=$fileSize\nchunkBytesSize=$chunkBytesSize\nsubFileNum=$subFileNum" > "$fileName.fbi" 70 | while [ $i -le $subFileNum ] 71 | do 72 | echo "disguised as a image: $outPath/$fileName.$i" 73 | fakeImage=$(disguised_as_image "$outPath/$fileName.$i") 74 | 75 | fakeImageUrl=$(upload_image "$fakeImage") 76 | echo "splitFiles[$i]=$fakeImageUrl" >> "$fileName.fbi" 77 | 78 | # delete temp file 79 | rm -f "$fakeImage" "$outPath/$fileName.$i" 80 | i=$(expr $i + 1) 81 | done 82 | 83 | echo "Done !" 84 | } 85 | 86 | # 恢复备份文件 87 | recover_backup_file(){ 88 | fbHeadFile=$1 89 | source $fbHeadFile 90 | if [ -z $fileName ];then 91 | echo "Invalid meta information file!" 92 | exit 1 93 | fi 94 | echo $fileName; 95 | 96 | realfileSize=$(du -b $realImage | awk '{print $1}') 97 | 98 | i=1 99 | rm -f "$outPath/finish.tmp" 100 | touch "$outPath/finish.tmp" 101 | while [ $i -le $subFileNum ] 102 | do 103 | packFileUrl=${splitFiles[$i]} 104 | echo $packFileUrl 105 | wget $packFileUrl -O "$outPath/tmp.$i" 106 | dd if="$outPath/tmp.$i" of="$outPath/tmp.output.$i" bs=$realfileSize skip=1 107 | cat "$outPath/finish.tmp" "$outPath/tmp.output.$i" > "$outPath/finish.tmp2" 108 | mv "$outPath/finish.tmp2" "$outPath/finish.tmp" 109 | rm -f "$outPath/tmp.output.$i" "$outPath/tmp.$i" 110 | i=$(expr $i + 1) 111 | done 112 | 113 | mv "$outPath/finish.tmp" "$outPath/$fileName" 114 | } 115 | 116 | if [[ -z $action || -z $filePath ]];then 117 | echo "Usage: ./backup.sh [ACTION] [FILENAME]" 118 | echo "" 119 | echo -e "./backup.sh upload pyinstall.exe \t backup file to cloud" 120 | echo -e "./backup.sh download pyinstall.exe.fbi \t recover backup file from cloud" 121 | exit 1 122 | fi 123 | 124 | if [ ! -f $filePath ];then 125 | echo "$filePath: not exist!" 126 | exit 1 127 | fi 128 | 129 | if [ ! -f $realImage ];then 130 | echo "$realImage: not exist!" 131 | exit 1 132 | fi 133 | 134 | if [ ! -d $outPath ];then 135 | mkdir $outPath 136 | fi 137 | 138 | if [ $action == "upload" ];then 139 | split_to_chunk_file $filePath 140 | elif [ $action == "download" ];then 141 | recover_backup_file $filePath 142 | fi 143 | 144 | # 备份文件 145 | # ./backup.sh upload pyinstall.exe 146 | 147 | # 恢复文件 148 | # ./backup.sh download pyinstall.exe.fbi 149 | -------------------------------------------------------------------------------- /bbb.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ellermister/free-backup/d2e1a7413450e77a75fe8491d59071ce21ac96f8/bbb.jpg -------------------------------------------------------------------------------- /web_backup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | cd /web/ 3 | backup_dir="/mnt/shells/backups" 4 | today=$(date "+%Y%m%d%H") 5 | filename="backup-web-${today}.tar.gz" 6 | password="(U74EJzxy3CN%r8(uUr^hvgz9nF(1N5Y" 7 | tg_token="11111111:aaaaaaaaaaaaa" 8 | tg_chat_id=111111 9 | 10 | # 加密打包备份 11 | echo "Packing backup $filename" 12 | tar -czf - .[!.]* * --exclude=vendor --exclude=.git | openssl des3 -salt -k "$password" -out $backup_dir/$filename 13 | 14 | cd - 15 | 16 | # 备份文件 17 | ./backup.sh "upload" "$backup_dir/$filename" 18 | 19 | # 推送元数据文件到TG 20 | curl -F document=@"$filename.fbi" -F "caption=#free_backups $filename.fbi" "https://api.telegram.org/bot$tg_token/sendDocument?chat_id=$tg_chat_id" 21 | rm -f "$backup_dir/$filename" "$filename.fbi" 22 | 23 | 24 | # 解密参考 25 | # mkdir test 26 | # openssl des3 -d -k "$password" -salt -in backups/backup-web-202200000000.tar.gz | tar zxvf - -C test --------------------------------------------------------------------------------