-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolve.sh
81 lines (68 loc) · 1.5 KB
/
solve.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
#!/bin/bash
if [[ -f "./correctWord.txt" ]]; then
rm ./correctWord.txt
fi
cat ./banner
echo ""
echo "LANGUAGES"
echo "========="
printf "\n1. Espanol (es)\n"
echo "2. English (en)"
echo "3. Portuguese (pt)"
echo "4. French (fr)"
echo "5. German (de)"
echo ""
read -p "Choose Language: " lang
echo ""
case $lang in
es)
;;
en)
;;
pt)
;;
fr)
;;
de)
;;
*)
echo "## Error! Select from the above list: (xy) and without brackets."
exit 1
;;
esac
printf "\n[+] Checking if crunch is installed ...\n"
command -v crunch 1> /dev/null
if [[ $? -ne 0 ]]; then
printf "[X] Crunch is not installed. Please install it using 'sudo apt install crunch'\n"
exit 1
fi
printf "[+] Crunch is already installed.\n"
echo ""
read -p "Enter the scrambled word: " scram
printf "[+] Generating possible combinations ...\n\n"
crunch 0 0 -p $scram > temp1
printf "\n[+] Sorting the generated list ...\n"
cat temp1 | sort > temp2
printf "[+] Finding the correct word ...\n"
case $lang in
es)
comm -12 temp2 dict/espanolDictionary.txt > ./correctWord.txt
;;
en)
comm -12 temp2 dict/englishDictionary.txt > ./correctWord.txt
;;
pt)
comm -12 temp2 dict/portugueseDictionary.txt > ./correctWord.txt
;;
fr) comm -12 temp2 dict/frenchDictionary.txt > ./correctWord.txt
;;
de)
comm -12 temp2 dict/germanDictionary.txt > ./correctWord.txt
;;
esac
echo "[+] Removing temporary files ..."
rm temp*
sleep 1
echo "[+] Result saved in the file: ./correctWord.txt"
printf "\nResult: \n=======\n"
cat correctWord.txt