• Login
Community
  • Login

find config files that do not contain username and password

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
4 Posts 2 Posters 791 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    Justin Lang
    last edited by Mar 25, 2021, 3:44 PM

    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

    P 1 Reply Last reply Mar 25, 2021, 4:03 PM Reply Quote 0
    • P
      PeterJones @Justin Lang
      last edited by Mar 25, 2021, 4:03 PM

      @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…)

      J 1 Reply Last reply Mar 25, 2021, 4:40 PM Reply Quote 0
      • J
        Justin Lang @PeterJones
        last edited by Mar 25, 2021, 4:40 PM

        @PeterJones

        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

        P 1 Reply Last reply Mar 25, 2021, 4:54 PM Reply Quote 0
        • P
          PeterJones @Justin Lang
          last edited by Mar 25, 2021, 4:54 PM

          @Justin-Lang ,

          I replied in the second topic you created.

          1 Reply Last reply Reply Quote 0
          4 out of 4
          • First post
            4/4
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors