-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgenAvatar.sh
executable file
·290 lines (214 loc) · 5.63 KB
/
genAvatar.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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
#!/bin/bash
# This script was developped to assist in Spear Phishing Campaign / Red Team
# Version="version 1.0.0"
# V1: Date Created : 19/01/2021
##### (Cosmetic) Colour output
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
BLUE="\033[01;34m" # Heading
BOLD="\033[01;01m" # Highlight
RESET="\033[00m" # Normal
usage ()
{
##### echo -e " $version \n"
printf " $version \n"
echo -e " Example: ./genAvatar.sh -c -n 5 -o FRA -s M / \n"
echo "OPTIONS:"
echo "-c Include common ratio"
echo "-n number of name to generate"
echo "-o Origin - check origin.txt for list"
echo "-s Sex, can be either M or F (Male or Female)"
echo "-h Displays this help text"
echo -e "\n"
echo "Running with no options => Please use arguments"
echo -e " ######################################################### "
}
while getopts "hcn:o:s:" opt; do
case $opt in
h) usage;
;;
c) common="1"
;;
n) numb="$OPTARG"
;;
o) origin="$OPTARG"
;;
s) sex="$OPTARG"
;;
\?) echo "Invalid option -$OPTARG" >&2
;;
esac
done
call_each()
{
#header
#init
#intro
#Argus
getOrigin
#getSname
#getFname
getConso
}
Argus()
{
echo $common
echo $numb
echo $origin
echo $sex
}
getOrigin()
{
case "$origin" in
FRA) echo -e ""
echo -e "${BOLD}${YELLOW}Origin: French${RESET}"
echo "****************************"
opaths="Origin/French/FRA_Surname.txt"
opathf="Origin/French/FRA_FirstName.txt"
cat $opaths | sort -R | head -n $numb > /tmp/sout.txt
if [ "$sex" ]; then
if [ "$sex" = "M" ]; then
cat $opathf | grep Male | sort -R | head -n $numb > /tmp/fout.txt
else
:
cat $opathf | grep Female | sort -R | head -n $numb > /tmp/fout.txt
fi
else
:
cat $opathf | sort -R | head -n $numb > /tmp/fout.txt
fi
echo -e ""
;;
AFR) echo "Origin: African"
;;
ALG) echo -e ""
echo -e "${BOLD}${YELLOW}Origin: Algerian${RESET}"
echo "****************************"
opaths="Origin/Algerian/ALG_Surname.txt"
opathf="Origin/Algerian/ALG_FirstName.txt"
cat $opaths | sort -R | head -n $numb > /tmp/sout.txt
if [ "$sex" ]; then
if [ "$sex" = "M" ]; then
cat $opathf | grep Male | sort -R | head -n $numb > /tmp/fout.txt
else
:
cat $opathf | grep Female | sort -R | head -n $numb > /tmp/fout.txt
fi
else
:
cat $opathf | sort -R | head -n $numb > /tmp/fout.txt
fi
echo -e ""
;;
MRN) echo -e ""
echo -e "${BOLD}${YELLOW}Origin: Moroccan${RESET}"
echo "****************************"
opaths="Origin/Moroccan/MRN_Surname.txt"
opathf="Origin/Moroccan/MRN_FirstName.txt"
cat $opaths | sort -R | head -n $numb > /tmp/sout.txt
if [ "$sex" ]; then
if [ "$sex" = "M" ]; then
cat $opathf | grep Male | sort -R | head -n $numb > /tmp/fout.txt
else
:
cat $opathf | grep Female | sort -R | head -n $numb > /tmp/fout.txt
fi
else
:
cat $opathf | sort -R | head -n $numb > /tmp/fout.txt
fi
echo -e ""
;;
CHN) echo -e ""
echo -e "${BOLD}${YELLOW}Origin: Chinese${RESET}"
echo "****************************"
opaths="Origin/Chinese/CHN_Surname.txt"
opathf="Origin/Chinese/CHN_FirstName.txt"
cat $opaths | sort -R | head -n $numb > /tmp/sout.txt
if [ "$sex" ]; then
if [ "$sex" = "M" ]; then
cat $opathf | grep Male | sort -R | head -n $numb > /tmp/fout.txt
else
:
cat $opathf | grep Female | sort -R | head -n $numb > /tmp/fout.txt
fi
else
:
cat $opathf | sort -R | head -n $numb > /tmp/fout.txt
fi
echo -e ""
;;
SPN) echo "Origin: Spanish"
;;
ITA) echo "Origin: Italien"
;;
LBN) echo "Origin: Lebanese"
;;
RUS) echo -e ""
echo -e "${BOLD}${YELLOW}Origin: Russian${RESET}"
echo "****************************"
opaths="Origin/Russian/RUS_Surname.txt"
opathf="Origin/Russian/RUS_FirstName.txt"
cat $opaths | sort -R | head -n $numb > /tmp/sout.txt
if [ "$sex" ]; then
if [ "$sex" = "M" ]; then
cat $opathf | grep Male | sort -R | head -n $numb > /tmp/fout.txt
else
:
cat $opathf | grep Female | sort -R | head -n $numb > /tmp/fout.txt
fi
else
:
cat $opathf | sort -R | head -n $numb > /tmp/fout.txt
fi
echo -e ""
;;
*) echo "$origin is not processed"
;;
esac
}
#getSname()
#{
#}
#getFname()
#{
#}
getConso()
{
if [ "$common" ]; then
echo -e "${BOLD}${GREEN}Firstname | Surname | Commonality (Greater-More Common)${RESET}"
echo "--------------------------------------------------------"
else
:
echo -e "${BOLD}${GREEN}Firstname | Surname${RESET}"
echo "--------------------------------------------------------"
fi
count=$numb
while [ $count -ne 0 ]
do
fname=$( sed "$count!d" /tmp/fout.txt | cut -d "," -f 1 )
sname=$( sed "$count!d" /tmp/sout.txt | cut -d "," -f 1 )
fnrat=$( sed "$count!d" /tmp/fout.txt | cut -d "," -f 3 )
snrat=$( sed "$count!d" /tmp/sout.txt | cut -d "," -f 2 )
#echo $fname
#echo $sname
#echo $fnrat
#echo $snrat
if [ "$common" ]; then
pratio=$(expr $fnrat + $snrat)
ratio=$(expr $pratio / 9000)
fi
#echo $ratio
echo $fname $sname $ratio
let "count-=1"
done
echo "--------------------------------------------------------"
rm /tmp/fout.txt
rm /tmp/sout.txt
}
if [ "$numb" ] && [ "$origin" ]; then
call_each
else
:
fi