find config files that do not contain username and password
-
I have several network configuration files in a folder. I want to find a config file that are not configured username and password. Is there a way to use regex to find all config files that do not contain the line username and password? thanks
-
@Justin-Lang said in find config files that do not contain username and password:
I have several network configuration files in a folder. I want to find a config file that are not configured username and password. Is there a way to use regex to find all config files that do not contain the line username and password? thanks
Yes.
Unfortunately, since you told us nothing about the format of the file (you could give us a dummied up version with fake data, but that keeps the same format – spaces, colons, etc --, select the text data, and hit the
</>button to mark it as “literal” text for the forum)

– if you give us example data, someone might be able to hazard a guess as to the regex that will work. If you give us examples of files that should match (ie, do not contain user/pw) and files that shouldn’t match (ie, do contain user/pw), that will be better.With that regex, you would then use Search > Find in Files, it will list the files that match (or, in this case, the ones that match not having the user/pw – typing so negatively is difficult; I feel sorry for the non-native-English-speakers reading this reply right now…)
-
service nagle
no service pad
service timestamps debug datetime localtime
service timestamps log datetime localtime
service password-encryption
logging buffered 15000
logging console critical
logging monitor warnings
enable secret 0 cisco
username admin password cisco
^
line con 0
line vty 0 4
exec-timeout 30 0
privilege level 15
transport preferred ssh
transport input ssh
transport output ssh
line vty 5 15
exec-timeout 30 0
privilege level 15
transport preferred ssh
transport input ssh
transport output ssh
ntp source Loopback0
ntp server 10.1.0.6
ntp server 10.1.0.7
ntp server 10.1.0.8 prefer
port-channel load-balance src-dst-ip -
I replied in the second topic you created.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login