-
Notifications
You must be signed in to change notification settings - Fork 0
/
unrat.sh
executable file
·223 lines (198 loc) · 5.41 KB
/
unrat.sh
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
#!/usr/bin/env sh
CYCLES=1
SILENT=0
NO_TOR=0
USERID=17
TOR_PORT=9053
TOR_PID=""
CONTENT_SIZE=10
DOMAIN="https://example.donotexist"
succ=0
fail=0
current_cycle=1
send_data() {
curl -s -o /dev/null -X POST "$DOMAIN/$1" \
-H "userid: $USERID" \
-H "Content-Type: application/json" \
-d "$2"
if [[ $? -eq 0 ]]; then
echo "Successfully uploaded $filepath"
succ=$((succ+1)) # Increment the success counter
else
echo "Failed to upload $filepath"
fail=$((fail+1)) # Increment the failure counter
fi
}
start_tor() {
if [ "$NO_TOR" == "0" ]; then
kill_tor
tor --SocksPort $TOR_PORT &
TOR_PID=$!
export "ALL_PROXY=socks5://127.0.0.1:$TOR_PORT"
fi
}
kill_tor() {
if [ "$NO_TOR" == "0" ]; then
kill $TOR_PID
fi
}
run_command() {
if [ "$SILENT" == 1 ]; then
"$@" > /dev/null 2>&1 # Suppress output
else
"$@" # Show output
fi
}
# Function to display help
function show_help {
echo "Usage: unrat [OPTIONS]"
echo " -h Show this help message."
echo " -n Do not use Tor, ip is exposed."
echo " -l Only log, python scripts are silent."
echo
echo "Options:"
echo " -u USERID Set the user ID (default: 17)."
echo " -c CYCLES Set the number of cycles (default: 1)."
echo " -s CONTENT_SIZE Set the content size (default: 100)."
echo " -p TOR_PORT Set the Tor port (default: 9053)."
echo " -d DOMAIN Set the domain (default: https://example.donotexist)."
exit 0
}
# Parse options
while getopts ":hnlu:c:s:p:d:" opt; do
case $opt in
h)
show_help
exit 0
;;
n)
NO_TOR=1
;;
l)
SILENT=1
;;
u)
USERID=$OPTARG
;;
c)
CYCLES=$OPTARG
;;
s)
CONTENT_SIZE=$OPTARG
;;
p)
TOR_PORT=$OPTARG
;;
d)
DOMAIN=$OPTARG
;;
\?)
echo "Invalid option: -$OPTARG" >&2
show_help
exit 1
;;
:)
echo "Option -$OPTARG requires an argument." >&2
show_help
exit 1
;;
esac
done
if [[ -z "$CYCLES" || "$CYCLES" -le 0 ]]; then
echo "CYCLES is not set or invalid. Set to 1."
CYCLES=1
fi
if [[ -z "$CONTENT_SIZE" || "$CONTENT_SIZE" -le 0 ]]; then
echo "CONTENT_SIZE is not set or invalid. Set to 10."
CONTENT_SIZE=10
fi
echo "Settings:"
echo " USERID $USERID"
echo " SILENT $SILENT"
echo " NO_TOR $NO_TOR"
echo " CYCLES $CYCLES"
echo " DOMAIN $DOMAIN"
echo " TOR_PORT $TOR_PORT"
echo " CONTENT_SIZE $CONTENT_SIZE"
echo
echo "------------------------------"
echo
while [[ $current_cycle -le $CYCLES ]] ; do
tempfolder="tmp$(date +%s%N | cut -b1-13)"
mkdir $tempfolder && echo Created $tempfolder || {
echo "Cannot create tmp folder. Exiting"
exit 1
}
cd $tempfolder
run_command start_tor
# Running python gen scripts
echo "Generating..."
CONTENT_DIRECTORIES=("browser_ext" "discord" "sus_files" "wallet")
run_command python ../gen_browsers_ext.py $((RANDOM % CONTENT_SIZE + 1))
run_command python ../gen_cookies.py $((RANDOM % CONTENT_SIZE + 1))
run_command python ../gen_discord.py $((RANDOM % CONTENT_SIZE + 1))
run_command python ../gen_usernames_passwds.py $((RANDOM % CONTENT_SIZE + 1))
run_command python ../gen_wallets.py $((RANDOM % CONTENT_SIZE + 1))
run_command python ../gen_sus.py $((RANDOM % CONTENT_SIZE + 1))
echo "...Generated"
# Single files
# .
# ├── cookies
# │ └── cookies.json
# ├── discord
# │ └── discord-tokens.txt
# └── passwords
# └── passwords.json
#
if [ "$NO_TOR" == "0" ]; then
while true; do
# Check if Tor is running
if ! pgrep -x "tor" > /dev/null; then
echo "Tor is not running."
exit 0
fi
# Check if Tor is listening on the expected ports
if netstat -tuln | grep ":$TOR_PORT" > /dev/null 2>&1; then
echo "Tor is running and listening on the required ports."
break
else
echo "Tor is running but not listening on the expected ports."
fi
sleep 0.2
done
fi
echo "Sending data"
# Send false cookies
send_data "webdata" "$(cat cookies/cookies.json)"
# Send false passwords
send_data "pw" "@passwords/passwords.json"
# Send rest of generated content
for folder in "${CONTENT_DIRECTORIES[@]}"; do
# Find all files in the folder recursively
for filepath in "$folder"/*; do
if [[ -f "$filepath" ]]; then # Make sure it's a file
# Use curl to send the file with POST request
curl -s -o /dev/null -X POST "$DOMAIN/delivery" \
-H "userid: $USERID" \
-F "file=@$filepath"
if [[ $? -eq 0 ]]; then
echo "Successfully uploaded $filepath"
succ=$((succ+1)) # Increment the success counter
else
echo "Failed to upload $filepath"
fail=$((fail+1)) # Increment the failure counter
fi
fi
done
done
cd ../
rm -r $tempfolder
sleep 0.5
echo "Cycle: $current_cycle"
((current_cycle++))
done
kill_tor > /dev/null 2>&1
echo
echo "------------------------------"
echo "Succesfully sent: $succ"
echo "Failed: $fail"