Anonfile.de
Info
This script should be interchangeable with any XFS pro site that has the latest API mod installed.
Just need to change the base url, the API keys and the tag from tag_db.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158 | #!/bin/bash
#*************************#
# ./up_anon_api.sh [file1] [file2] [file3]...
#
# This does not require a premium account, you
# just need to register an account with an email address
# and generate an API key (works with one, or many)
#
# (folder management only works if single API key used)
#*************************#
cpass="$RANDOM$RANDOM$RANDOM"
TorPort=${TorPort:-9050}
base="https://anonfile.de/api"
#*************************#
ar_anKey[0]=''
#ar_anKey[1]=''
#ar_anKey[2]=''
#ar_anKey[3]=''
#*************************#
tag_db="" # path to tag_db.txt
readydir="" # directory to save/append existing links file
an_folder="" # fld_id="yourfolderid"
#*************************#
tag () {
for t in "$@"; do
printf '%b\n' "$(grep -Po "^$t=\K.*" "$tag_db")"
done
}
torcurl() {
curl --proxy "socks5h://${cpass}@127.0.0.1:${TorPort}" \
-A "Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0" \
--connect-timeout 10 -4 \
"$@"
}
tor_check () {
tor_status=$(jq -r '.IsTor' <(torcurl -s "https://check.torproject.org/api/ip"))
[[ "$tor_status" == 'true' ]] || exit 1
}
GetRandomAnKey() {
arrSize=${#ar_anKey[@]}
index=$((RANDOM % arrSize))
RandomAnKey=${ar_anKey[$index]}
(( arrSize > 1 )) && an_folder=""
}
ready_up () {
GetRandomAnKey
apikey="$RandomAnKey"
}
#*************************#
tor_check
mapfile -t arrFiles < <(printf '%s\n' "$@")
for input in "${arrFiles[@]}"; do {
fp="$(echo -n "$(realpath "$input")")"
file="$(basename "${fp}")"
[[ ! -f "$fp" ]] && {
echo -e "\nerror: file ${file} not found. skipping\n" |
tee -a 'fails.txt'
continue
}
size=$(stat -c %s "$fp")
(( size > 2048000000 )) && {
echo -e "\nfile ${file} too large. skipping\n" |
tee -a 'fails.txt'
continue
}
ready_up && echo -e "\nUploading: $file\nwith key: $apikey"
[[ -n $an_folder ]] && echo -e "to folder (id): $an_folder\n"
init=$(torcurl -s \
"${base}/upload/server?key=${apikey}")
sess_id=$(jq -r .sess_id <<< "$init")
result=$(jq -r .result <<< "$init")
response=$(torcurl "$result" \
-F "sess_id=$sess_id" \
-F "utype=prem" \
-F "file_0=@$fp")
success=$(jq -e '.[].file_code' > /dev/null <<< "$response")
[[ $success -eq 0 ]] && filecode=$(jq -r '.[].file_code' <<< "$response")
[[ -n "$filecode" ]] && {
if grep -Eqi 'undef' <<< "$filecode"; then
echo -e "\nerror - ${file}\nresult: undef" |
tee -a 'fails.txt'
continue
else
link="https://anonfile.de/${filecode}"
echo -e "\n$file - success\n$link" | tee -a 'success.txt'
mkdir -p "${readydir}/${file}-BBCode"
echo -e "$(tag anon) - $link" >> "${readydir}/${file}-BBCode/${file}.txt"
[[ -n "$an_folder" ]] && {
torcurl -s "${base}/file/set_folder" \
-F "file_code=$filecode" \
-F "fld_id=$an_folder" \
-F "key=$apikey" > /dev/null 2>&1
sleep 2;
check=$(torcurl -s "${base}/folder/list" \
-F "fld_id=$an_folder" \
-F "key=$apikey")
if grep -Eqi "$filecode" <<< "$check"; then
echo -e "\nsuccessfully moved $file to $an_folder" |
tee -a 'success.txt'
else
echo -e "\nerror - ${file}\nresult: failed to move to folder" |
tee -a 'fails.txt'
fi
}
ready="${readydir}/${file}-BBCode/${file}"
if [[ ! -f "${ready}" ]]; then
cp "${fp}" "${ready}"
fi
fi
}
[[ -z "$filecode" ]] && {
echo -e "\nerror - ${file}\nresult: upload failed" |
tee -a 'fails.txt'
}
} done
echo -e "\nall files processed\n"; sleep 2;
[[ -f 'success.txt' ]] && {
tag s_line
echo -e "\nsuccess log:"
cat 'success.txt'
sleep 2;
rm -f 'success.txt'
printf "\\n"
}
[[ -f 'fails.txt' ]] && {
tag s_line
echo -e "\nfail log:"
cat 'fails.txt'
sleep 2;
rm -f 'fails.txt'
printf "\\n"
}
read -rsn1 -p "Press any key to exit"; echo -e "\n"
exit 0
|