Update 'yq/ha_faking_secrets_with_docker.sh'
This commit is contained in:
parent
5d749419be
commit
32e41b30ef
@ -14,14 +14,20 @@ yq() {
|
||||
docker run --rm -i -v "${PWD}":/workdir mikefarah/yq "$@"
|
||||
}
|
||||
|
||||
### fake passwords
|
||||
yq eval '.[] = "fake_password"' secrets.yaml > fake_pwds.yaml
|
||||
yq eval '... comments=""' secrets.yaml > no_comments.yaml
|
||||
|
||||
### fake ips
|
||||
yq eval '(.[] | select(. == "*.*.*.*")) |= "127.0.0.1"' secrets.yaml > fake_ips.yaml
|
||||
yq eval 'del( .[] | select(. != "*gmail*") )' no_comments.yaml > e.yaml
|
||||
yq eval 'del( .[] | select(. != "*http*") )' no_comments.yaml > http.yaml
|
||||
yq eval 'del( .[] | select(. != "*rtsp*") )' no_comments.yaml >> http.yaml
|
||||
yq eval 'del( .[] | select(. != "192*") )' no_comments.yaml > ips.yaml
|
||||
yq eval '.[] = "fake_password"' no_comments.yaml > fake_pwds.yaml; rm no_comments.yaml
|
||||
|
||||
### merging all into one
|
||||
yq eval-all 'select(fi == 0) * select(filename == "fake_ips.yaml")' fake_pwds.yaml fake_ips.yaml > fake_secrets.yaml
|
||||
|
||||
### clean up..
|
||||
rm fake_pwds.yaml fake_ips.yaml
|
||||
yq eval '.[] = "please@dont.try"' e.yaml > emails.yaml; rm e.yaml
|
||||
yq eval '.[] = "http://not_that_easy.com"' http.yaml > urls.yaml; rm http.yaml
|
||||
yq eval '.[] = "127.0.0.1"' ips.yaml > ip.yaml; rm ips.yaml
|
||||
|
||||
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' emails.yaml urls.yaml > 1.yaml; rm emails.yaml urls.yaml
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' 1.yaml ip.yaml > 2.yaml;rm 1.yaml ip.yaml
|
||||
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' fake_pwds.yaml 2.yaml > fake_secrets.yaml;rm fake_pwds.yaml 2.yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user