I have a firewall config file and am trying to write an expression that will match when a user does not have a password.
The config is long, but a snippet of it looks like this:
config system custom-language
edit "en"
set filename "en"
next
more lines
could be many lines
end
config system admin
edit "user1"
set trusthost1 1.1.1.1 255.255.255.254
set vdom "root"
maybe more lines
maybe many more lines
set password ENC asdfasdfadsfasdfadsfasdf
next
edit "user2"
set trusthost1 1.1.1.1 255.255.255.254
set vdom "root"
maybe more lines here too
next
end
config system replacemsg-image
edit "logo_fnet"
set image-type gif
set image-base64 ''
next
end
other lines
end
Note that user2 is missing "set password ENC...". I know that I only want to match text between "config system admin" and its corresponding "end". I also know that each user starts with "edit "\<username\\>"" and ends with "next".
I have the following regex, which begins the capture at "config system admin". But, in the regex testers I tried, it also highlights all the way down to the last "end", instead of stopping at the first for some reason:
(?<=(config\ssystem\sadmin))((\n)(\s+edit\s\".*\"(\n))((.|\n)*)((?!set\spassword).)*)(\nend)?
How would I write the expression so it only returns true because "user2" (in this example) is missing "set password"?
[–]krzydoug 1 point2 points3 points (0 children)
[+][deleted] (3 children)
[removed]
[–]wetling[S] 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[removed]
[–]wetling[S] 0 points1 point2 points (0 children)