-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathalldecoder.sh
More file actions
executable file
路187 lines (153 loc) 路 4.33 KB
/
Copy pathalldecoder.sh
File metadata and controls
executable file
路187 lines (153 loc) 路 4.33 KB
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
#!/bin/bash
# ===== COLORS =====
GREEN="\e[1;32m"
CYAN="\e[1;36m"
YELLOW="\e[1;33m"
WHITE="\e[1;37m"
RESET="\e[0m"
clear
echo -e "${CYAN} /\ /\ /\ "
echo -e "${CYAN} / \ / \ / \ "
echo -e "${GREEN} / /\ \ / /\ \ / /\ \ "
echo -e "${GREEN} / / \ \ / / \ \ / / \ \ "
echo -e "${YELLOW} / /----\ \ / /----\ \ / /----\ \ "
echo -e "${YELLOW} /_/ \_\ /_/ \_\ /_/ \_\ "
echo ""
echo -e "${WHITE}=====================================${RESET}"
echo -e "${CYAN} ALLDECODER TOOLKIT${RESET}"
echo -e "${GREEN} Creator: Nur${RESET}"
echo -e "${WHITE}=====================================${RESET}"
echo ""
# =========================
# COLORS (JOHN STYLE)
# =========================
GREEN="\e[92m"
RED="\e[91m"
YELLOW="\e[93m"
ORANGE="\e[33m"
BLUE="\e[94m"
RESET="\e[0m"
# =========================
# EDITOR INPUT
# =========================
echo -e "${BLUE}鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲"
echo " UNIVERSAL DECODER ENGINE v11"
echo -e "鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲鈺愨晲${RESET}"
echo -e "${GREEN}[*] Opening nano input editor...${RESET}"
TMPFILE=$(mktemp)
nano "$TMPFILE"
INPUTS=$(cat "$TMPFILE")
echo -e "${GREEN}[+] Input loaded successfully${RESET}"
echo "----------------------------------"
# =========================
# FUNCTIONS
# =========================
decode_base64() {
echo "$1" | base64 -d 2>/dev/null
}
decode_base32() {
echo "$1" | base32 -d 2>/dev/null
}
decode_hex() {
echo "$1" | xxd -r -p 2>/dev/null
}
decode_url() {
echo "$1" | sed 's/%/\\x/g' | xargs -0 printf "%b"
}
decode_html() {
echo "$1" | sed -e 's/</</g' -e 's/>/>/g' -e 's/&/&/g'
}
decode_binary() {
local bin=$(echo "$1" | tr -d ' ')
echo "$bin" | awk '{
while (length($0)>0) {
printf "%c", strtonum("0b" substr($0,1,8))
$0=substr($0,9)
}
}' 2>/dev/null
}
decode_rot13() {
echo "$1" | tr 'A-Za-z' 'N-ZA-Mn-za-m'
}
is_valid_ascii() {
[[ "$1" =~ ^[[:print:]]+$ ]]
}
# =========================
# STORAGE
# =========================
FINAL=""
# =========================
# PROCESS INPUT
# =========================
while IFS= read -r line; do
[[ -z "$line" ]] && continue
echo -e "${GREEN}[INPUT]${RESET} $line"
# BASE64
out=$(decode_base64 "$line")
if [[ -n "$out" && "$out" != "$line" ]]; then
echo -e "[BASE64] ${ORANGE}$out${RESET}"
FINAL+="[BASE64] $line => $out\n"
fi
# BASE32
out=$(decode_base32 "$line")
if [[ -n "$out" && "$out" != "$line" ]]; then
echo -e "[BASE32] ${ORANGE}$out${RESET}"
FINAL+="[BASE32] $line => $out\n"
fi
# HEX
if [[ "$line" =~ ^[0-9a-fA-F]+$ ]] && (( ${#line} % 2 == 0 )); then
out=$(decode_hex "$line")
if [[ -n "$out" ]]; then
echo -e "[HEX] ${ORANGE}$out${RESET}"
FINAL+="[HEX] $line => $out\n"
fi
fi
# URL
if [[ "$line" == *"%"* ]]; then
out=$(decode_url "$line")
echo -e "[URL] ${ORANGE}$out${RESET}"
FINAL+="[URL] $line => $out\n"
fi
# HTML
if [[ "$line" == *"&"* ]]; then
out=$(decode_html "$line")
echo -e "[HTML] ${ORANGE}$out${RESET}"
FINAL+="[HTML] $line => $out\n"
fi
# BINARY (FIXED 馃敟)
if [[ "$line" =~ ^[01\ ]+$ ]]; then
out=$(decode_binary "$line")
if [[ -n "$out" ]]; then
echo -e "[BINARY] ${ORANGE}$out${RESET}"
FINAL+="[BINARY] $line => $out\n"
else
echo -e "${RED}[-] Binary decode failed${RESET}"
fi
fi
# ROT13 (ONLY IF TEXT)
if [[ "$line" =~ [A-Za-z] ]]; then
out=$(decode_rot13 "$line")
if [[ "$out" != "$line" ]]; then
echo -e "[ROT13] ${ORANGE}$out${RESET}"
FINAL+="[ROT13] $line => $out\n"
fi
fi
# ERROR HANDLING
if [[ -z "$out" ]]; then
echo -e "${RED}[-] No valid decode found${RESET}"
fi
echo "----------------------------------"
done <<< "$INPUTS"
# =========================
# FINAL OUTPUT
# =========================
echo -e "${BLUE}[+] FINAL RESULTS:${RESET}"
echo "----------------------------------"
while IFS= read -r line; do
[[ -z "$line" ]] && continue
key=$(echo "$line" | cut -d ' ' -f1-2)
val=$(echo "$line" | cut -d '=' -f2-)
# clean spacing
val=$(echo "$val" | sed 's/^ *//')
echo -e "${GREEN}${key} => ${ORANGE}${val}${RESET}"
done <<< "$(echo -e "$FINAL")"