File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 155
155
echo -e " $( napalm --user " $DEVUSERNAME " --password " $DEVPASSWORD " --vendor " $VENDOR " " $DEVICE " call --method-kwargs " command='$CMD '" " $METHOD " | sed ' s/^"//;s/"$//;s/\\"/"/g' ) " > " $CMDFILE "
156
156
done
157
157
158
+ echo " #### Preparing obfuscate script"
159
+ echo " ## IP addresses"
160
+ IPs=$( cat " $CODIR /$TYPE /" * .txt \
161
+ | sed -rn ' s/.*[^0-9\.](([0-9]{1,3}\.){3}[0-9]{1,3})[^0-9\.].*/\1/gp' \
162
+ | sort \
163
+ | uniq
164
+ )
165
+ echo $IPs
166
+
167
+ for a in $IPs
168
+ do
169
+ oa=${a}
170
+ oa=${oa// 2/ 3}
171
+ oa=${oa// 4/ 3}
172
+ oa=${oa// 5/ 3}
173
+ oa=${oa// 6/ 7}
174
+ oa=${oa// 8/ 7}
175
+ oa=${oa// 9/ 7}
176
+
177
+ oa=" -e s/$a /$oa /g "
178
+
179
+ oIPs=" $oIPs$oa "
180
+ done
181
+
182
+ echo " ## MAC addresses"
183
+ MACs=$( cat " $CODIR /$TYPE /" * .txt \
184
+ | sed -rn -e ' s/.*[^0-9\.:a-f-](([[:xdigit:]]{2}[:.-]?){5}[[:xdigit:]]{2})[^0-9\.:a-f-].*/\1/gp' \
185
+ | sort \
186
+ | uniq
187
+ )
188
+ echo $MACs
189
+
190
+ for m in $MACs
191
+ do
192
+ om=${m}
193
+ om=${om// 1/ 2}
194
+ om=${om// 3/ 2}
195
+ om=${om// 6/ 2}
196
+ om=${om// 8/ 2}
197
+ om=${om// b/ 2}
198
+ om=${om// e/ 2}
199
+ om=${om// 4/ a}
200
+ om=${om// 5/ a}
201
+ om=${om// 7/ a}
202
+ om=${om// 9/ a}
203
+ om=${om// c/ a}
204
+ om=${om// d/ a}
205
+
206
+ om=" -e s/$m /$om /g "
207
+
208
+ oMACs=" $oMACs$om "
209
+ done
210
+
211
+ echo " ## Obfuscate"
212
+ echo oIPS=$oIPs
213
+ echo oMACs=$oMACs
214
+ sed -ri $oMACs $oIPs " $CODIR /$TYPE /" * .txt
215
+
216
+ echo " ###################################################"
217
+ echo " ## Do not forget obfuscate other output: ##"
218
+ echo " ## passwords, secrets, keys, certificates ##"
219
+ echo " ## descriptions, names and other ... ##"
220
+ echo " ###################################################"
You can’t perform that action at this time.
0 commit comments