-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathP0lyn0m1c0n.sh
131 lines (112 loc) · 5.48 KB
/
P0lyn0m1c0n.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
#!/bin/bash
echo '
██████╗ ██████╗ ██╗ ██╗ ██╗███╗ ██╗ ██████╗ ███╗ ███╗ ██╗ ██████╗ ██████╗ ███╗ ██╗
██╔══██╗██╔═████╗██║ ╚██╗ ██╔╝████╗ ██║██╔═████╗████╗ ████║███║██╔════╝██╔═████╗████╗ ██║
██████╔╝██║██╔██║██║ ╚████╔╝ ██╔██╗ ██║██║██╔██║██╔████╔██║╚██║██║ ██║██╔██║██╔██╗ ██║
██╔═══╝ ████╔╝██║██║ ╚██╔╝ ██║╚██╗██║████╔╝██║██║╚██╔╝██║ ██║██║ ████╔╝██║██║╚██╗██║
██║ ╚██████╔╝███████╗██║ ██║ ╚████║╚██████╔╝██║ ╚═╝ ██║ ██║╚██████╗╚██████╔╝██║ ╚████║
╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝'
echo -e '
_________________________________
%::::::::::::::::::::::::::::::::##
%::::::::::::::::::::::::::::::::##..
%::::::::::::::::::::::::::::::::##....
%:::::::::7777777777:::::::::::::##......
%:::::::::77777777777::::::::::::##.......#
%::::::::::7. .77..777:::::::::::##.......#
%:::::::::::77777777777::::::::::##.......#
%:::::::::::::777.77777::::::::::##.......#
%::::::::::::::777.777:::::::::::##.......#
%::::::::::::::::77.77:::::::::::##.......#
%:::::::::::::::::77777::::::::::##.......#
%::::::::::::::::::::::::::::::::##.......#
##################################**....#
!!................................**..#
!!................................**#
###################################
'
# Check if target name is supplied
if [ -z "$1" ]; then
echo "Target name not supplied!!!"
exit 1
fi
# Check if sponge command is available
if ! command -v sponge &> /dev/null; then
echo 'Error: sponge is not installed. Please install moreutils package.'
exit 1
fi
# Function to generate permutations and substitutions
generate_variations() {
local word="$1"
local prefix="$2"
local year="$3"
for ((i = 2005; i <= year; i++)); do
echo "${prefix}${word}${i}"
echo "${i}${word}${prefix}"
echo "${i}.${word}"
echo "${word}.${i}"
echo "${i}_${word}"
echo "${word}_${i}"
echo "${i}-${word}"
echo "${word}-${i}"
echo "${word}${i}."
echo "${i}${word}."
done
}
# Function to perform substitutions
perform_substitutions() {
local word="$1"
local substitutions="$2"
for substitution in "${substitutions[@]}"; do
echo "${word}${substitution}"
echo "${substitution}${word}"
done
}
# Function to generate variations with substitutions
generate_variations_with_substitutions() {
local word="$1"
local substitutions=("${@:2}")
for substitution in "${substitutions[@]}"; do
generate_variations "$word$substitution" "$substitution"
done
}
# Main script
# Set target and year
target="$1"
year=$(date +"%Y")+1
# Convert target to lowercase, uppercase, leet speak, and leet speak uppercase
target_lc="${target,,}"
target_uc="${target^^}"
target_leet="$(echo "$target_lc" | tr 'aeio' '4310')"
target_leet_uc="$(echo "$target_uc" | tr 'AEIO' '4310')"
# Create file name
filename="P0lyn0m1c0n_${target_lc}.txt"
# Read words from basedic.txt in the current directory
basedic_file="basedic.txt"
if [ ! -f "$basedic_file" ]; then
echo "Error: $basedic_file not found in the current directory."
exit 1
fi
# Read words from basedic.txt into an array
mapfile -t basedic < "$basedic_file"
# Append variations and substitutions to the file
generate_variations "$target_lc" "" "$year" | sponge "$filename"
generate_variations "$target_leet" "" "$year" | sponge -a "$filename"
generate_variations "$target_uc" "" "$year" | sponge -a "$filename"
generate_variations_with_substitutions "$target_uc" 'a' 'e' 'i' 'o' | sponge -a "$filename"
generate_variations "$target_leet_uc" "" "$year" | sponge -a "$filename"
generate_variations_with_substitutions "$target_leet_uc" 'a' 'e' 'i' 'o' | sponge -a "$filename"
# Append base dictionary variations to the file
for word in "${basedic[@]}"; do
generate_variations "$word" "" "$year" | sponge -a "$filename"
perform_substitutions "$word" 'A' 'E' 'I' 'O' | sponge -a "$filename"
done
# Append target with base dictionary variations to the file
for word in "${basedic[@]}"; do
word_uc="${word^}"
word_uc_leet="$(echo "$word_uc" | tr 'AEIO' '4310')"
perform_substitutions "$word" "$target_lc" "$target_uc" "$target_leet" "$target_leet_uc" | sponge -a "$filename"
perform_substitutions "$word_uc" "$target_lc" "$target_uc" "$target_leet" "$target_leet_uc" | sponge -a "$filename"
perform_substitutions "$word_uc_leet" "$target_lc" "$target_uc" "$target_leet" "$target_leet_uc" | sponge -a "$filename"
done
echo "Variations and substitutions have been saved to $filename"