Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/750.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix PAN-OS banner parsing by removing IOS-style banner end normalization.
5 changes: 2 additions & 3 deletions netutils/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,11 +1522,10 @@ def _build_banner(self, config_line: str) -> t.Optional[str]:
if not self.is_banner_end(line):
banner_config.append(line)
else:
line = normalise_delimiter_caret_c(self.banner_end, line)
banner_config.append(line.strip())
line = "\n".join(banner_config)
if line.endswith("^C"):
banner, end, _ = line.rpartition("^C")
if line.endswith('"'):
banner, end, _ = line.rpartition('"')
line = banner + end
self._update_config_lines(line.strip())
self._current_parents = self._current_parents[:-1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
parents=(),
),
ConfigLine(
config_line="************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************\n\n^C",
config_line='************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************\n\n"',
parents=('set deviceconfig system login-banner "',),
),
ConfigLine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
parents=(),
),
ConfigLine(
config_line="************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************^C",
config_line='************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************"',
parents=('set deviceconfig system login-banner "',),
),
ConfigLine(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@
ConfigLine(config_line="set deviceconfig system hostname firewall1", parents=()),
ConfigLine(config_line='set deviceconfig system login-banner "', parents=()),
ConfigLine(
config_line="************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************\n\n^C",
config_line='************************************************************************\n* firewall1.example.com * [PROD VM500 firewalls]\n************************************************************************\n* WARNING *\n* Unauthorized access to this device or devices attached to *\n* or accessible from this network is strictly prohibited. *\n* Possession of passwords or devices enabling access to this *\n* device or devices does not constitute authorization. Unauthorized *\n* access will be prosecuted to the fullest extent of the law. *\n* *\n************************************************************************\n\n"',
parents=('set deviceconfig system login-banner "',),
),
ConfigLine(
Expand Down