Closed famewolf closed 8 years ago
Thanks for letting me know. I originally used dos2unix and unix2dos because sed didn't seem to like it when non-unix line endings were provided. I haven't really used this script in a while, but I can take a look. Feel free to fork.
@famewolf: I did a quick look and I think the auth-user-pass being repeated should now be fixed. (I have yet to verify as I'm currently not at home) I didn't do repeated runs previously, so I'm not surprised there was an issue like this.
I will look into making the changes your friend provided when I'm at home. Thanks again!
I've confirmed your latest commit fixes the problem so I'll remove my poor sed attempt that wasn't doing the job in my copy. ;) If you have time to explain HOW adding a dot asterisk (github filters out the asterisk in comments) fixed things I would love to learn. (I learned most of what i know about sed from trying to figure your code out. )
@famewolf: The dot indicates any character (except some control characters) The asterisk after means zero or more of the previous character.
So .* means zero or more of any character. The dollar sign character indicates a match to the end of the line.
Without the dot-asterisk before the $, lines in the file that have something at the end (i.e. auth-user-pass username_password.txt) would not get excluded by the grep -v command when they should have been.
You have the zip files being checked for date but apparently the part that writes the auth-user-pass line to the ovpn runs each time because if you run the script 4 times back to back such as cron would do if running it daily you will end up with 4 auth-user-pass lines in the .ovpn files. I realize you have a grep that should exclude the auth-user-pass from the old ovpn but somehow it's still getting copied.
A friend also changed the lines looking for username and password to:
grep "Username:" index.html | tr -cd '\11\12\15\40-\176' | tr -d ' \t' | sed 's/<[^>]_>//g' | sort -du | cut -d: -f2 > usernamepassword.txt grep "Password:" index.html | tr -cd '\11\12\15\40-\176' | tr -d ' \t' | sed 's/<[^>]>//g' | sort -du | cut -d: -f2 >> username_password.txt
This handles non printable characters as well as stripping html tags out. We didn't use dos2unix or unix2dos...not sure if they are still needed.