I'm looking for two scripts, can anyone help me on this.
The first one to scan log files in /xxxx/xxxx/xxxx/USERLOGS and /xxxx/xxxxx/xxx/xxx/xxx/Logs and list out all files and the offending lines that have a readable password.
Check the accuracy of the script to see if it is missing lines with unmasked passwords or returning lines that have masked passwords.
grep "password=" * | egrep -v "XXXXXXXX|password=[\" ]*&"
Appreciate your help.
Are you searching for a specific password or any password= ? What is masked in this milieu?
So, there are many strings to compare? How many?
Many strings and it may be numeric and characters.
Well, we can egrep 'aaa|bbb|ccc|...|zzz' for all of them, but it will be a long command line and might run slow. Exposed, too. We could egrep in parallel, though. You can do it as lines in sed in a file -- no exposure.
#!/usr/bin/sed -f
/\<aaa\>/b
/\<bbb\>/b
.
.
.
/\<zzz\>/b
d
In sed d is delete and 'b nothing' is branch to end of script is print and next.