Repository: intentionet/netconan (language: python)

Issue:
incorrect fortinet password removal
fortinet passwords are encrypted in config, using the following syntax:
```
set password ENC <hash>
```

Netconan outputs the following after it anonymizes the password:
```
set password netconanRemoved0 <hash>
```

The has is not removed by the ENC syntax is (IE this is just stating Encrypted hash to follow.


Discussion / hints:
Thanks @ryanmerolle - we'll fix this right off!

Fix patch:
diff --git a/netconan/default_pwd_regexes.py b/netconan/default_pwd_regexes.py
index 6b30c05..2effdcb 100644
--- a/netconan/default_pwd_regexes.py
+++ b/netconan/default_pwd_regexes.py
@@ -49,7 +49,7 @@
 # Some of these regexes need to be updated to support quote enclosed passwords
 # which is allowed for at least some syntax on Juniper devices
 default_pwd_line_regexes = [
-    [(r'(?P<prefix>(password|passwd)( level \d+)?( \d+)? )(\S+)', 5)],
+    [(r'(?P<prefix>(password|passwd)( level \d+)?( \d+)?( ENC)? )(\S+)', 6)],
     [(r'(?P<prefix>username( \S+)+ (password|secret)( \d| sha512)? )(\S+)', 5)],
     [(r'(?P<prefix>(enable )?secret( \d)? )(\S+)', 4)],
     [(r'(?P<prefix>ip ftp password( \d)? )(\S+)', 3)],


Test patch:
diff --git a/tests/unit/test_sensitive_item_removal.py b/tests/unit/test_sensitive_item_removal.py
index 4f73fab..c42d039 100644
--- a/tests/unit/test_sensitive_item_removal.py
+++ b/tests/unit/test_sensitive_item_removal.py
@@ -21,6 +21,12 @@
 import pytest
 
 # Tuple format is config_line, sensitive_text (should not be in output line)
+
+# TODO(https://github.com/intentionet/netconan/issues/3):
+# Add more Arista config lines
+arista_password_lines = [
+    ('username noc secret sha512 {}', '$6$RMxgK5ALGIf.nWEC$tHuKCyfNtJMCY561P52dTzHUmYMmLxb/Mxik.j3vMUs8lMCPocM00/NAS.SN6GCWx7d/vQIgxnClyQLAb7n3x0')
+]
 # TODO(https://github.com/intentionet/netconan/issues/3):
 # Add in additional test lines (these are just first pass from IOS)
 cisco_password_lines = [
@@ -103,6 +109,11 @@
     ('rf-switch snmp-community {}', 'RemoveMe')
 ]
 
+# TODO(https://github.com/intentionet/netconan/issues/3):
+fortinet_password_lines = [
+    ('password ENC {}', 'SH2nlSm9QL9tapcHPXIqAXvX7vBJuuqu22hpa0JX0sBuKIo7z2g0Kz/+0KyH4E=')
+]
+
 # TODO(https://github.com/intentionet/netconan/issues/4):
 # Add more Juniper config lines
 juniper_password_lines = [
@@ -124,12 +135,6 @@
     ('hello-authentication-key {}', '$9$i.m5OBEevLz3RSevx7-VwgZj5TFCA0Tz9p'),
 ]
 
-# TODO(https://github.com/intentionet/netconan/issues/3):
-# Add more Arista config lines
-arista_password_lines = [
-    ('username noc secret sha512 {}', '$6$RMxgK5ALGIf.nWEC$tHuKCyfNtJMCY561P52dTzHUmYMmLxb/Mxik.j3vMUs8lMCPocM00/NAS.SN6GCWx7d/vQIgxnClyQLAb7n3x0')
-]
-
 misc_password_lines = [
     ('my password is ', '$1$salt$abcdefghijklmnopqrs'),
     ('set community {} trailing text', 'RemoveMe'),
@@ -137,9 +142,12 @@
     ('set community {}', 'a1234')
 ]
 
-sensitive_lines = (cisco_password_lines +
-                   cisco_snmp_community_lines + juniper_password_lines +
-                   arista_password_lines + misc_password_lines)
+sensitive_lines = (arista_password_lines +
+                   cisco_password_lines +
+                   cisco_snmp_community_lines +
+                   fortinet_password_lines +
+                   juniper_password_lines +
+                   misc_password_lines)
 
 sensitive_items_and_formats = [
     ('094F4107180B', _sensitive_item_formats.cisco_type7),