diff --git a/sa/profiles/3Com/4500/profile.py b/sa/profiles/3Com/4500/profile.py index 8b6909c640f7f8b5d6e537c7ce28f093b7244e7c..ed36519ff8bf60173db1ab3cd23d90794fafdf48 100644 --- a/sa/profiles/3Com/4500/profile.py +++ b/sa/profiles/3Com/4500/profile.py @@ -15,7 +15,7 @@ class Profile(BaseProfile): pattern_username = rb"^Username:" pattern_password = rb"^(Password:|Please input password:)" pattern_more = [ - (rb"^\s+---- More ----$", " "), + (rb"^\s+---- More ----$", b" "), (rb"The current configuration will be written to the device. Are you sure? [Y/N]:", b"Y"), (rb"(To leave the existing filename unchanged, press the enter key):", b"\n"), (rb"flash:/startup.cfg exists, overwrite? [Y/N]:", b"Y"), diff --git a/sa/profiles/3Com/SuperStack3_4500/profile.py b/sa/profiles/3Com/SuperStack3_4500/profile.py index b495c864cd3b9d2c10ca832dc52a41b958cb25f1..e1b1f09172d3d5889f3b351ea27bdab2f5c2bea2 100644 --- a/sa/profiles/3Com/SuperStack3_4500/profile.py +++ b/sa/profiles/3Com/SuperStack3_4500/profile.py @@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "3Com.SuperStack3_4500" pattern_more = [ - (rb"^\s+---- More ----$", " "), + (rb"^\s+---- More ----$", b" "), (rb"The current configuration will be written to the device. Are you sure? [Y/N]:", b"Y"), (rb"(To leave the existing filename unchanged, press the enter key):", b"\n"), (rb"flash:/startup.cfg exists, overwrite? [Y/N]:", b"Y"), diff --git a/sa/profiles/Cisco/IOS/profile.py b/sa/profiles/Cisco/IOS/profile.py index 6abd68cc0b9bc70ceabb339b93f5be973e1a2aa9..c23bf6a4064ffb73026263bd6849e173a19f8c59 100644 --- a/sa/profiles/Cisco/IOS/profile.py +++ b/sa/profiles/Cisco/IOS/profile.py @@ -15,21 +15,23 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Cisco.IOS" pattern_more = [ - (r"^ --More-- ", " "), - (r"(?:\?|interfaces)\s*\[confirm\]", "\n"), - (r"^Destination filename \[\S+\]", "\n"), - (r"^Proceed with reload\?\s*\[confirm\]", "y\n"), + (rb"^ --More-- ", b" "), + (rb"(?:\?|interfaces)\s*\[confirm\]", b"\n"), + (rb"^Destination filename \[\S+\]", b"\n"), + (rb"^Proceed with reload\?\s*\[confirm\]", b"y\n"), ] - pattern_unprivileged_prompt = r"^\S+?>" - pattern_syntax_error = r"% Invalid input detected at|% Ambiguous command:|% Incomplete command." - pattern_operation_error = "Command authorization failed." + pattern_unprivileged_prompt = rb"^\S+?>" + pattern_syntax_error = ( + rb"% Invalid input detected at|% Ambiguous command:|% Incomplete command." + ) + pattern_operation_error = rb"Command authorization failed." command_disable_pager = "terminal length 0" - command_super = "enable" + command_super = b"enable" command_enter_config = "configure terminal" command_leave_config = "end" command_exit = "exit" command_save_config = "copy running-config startup-config\n" - pattern_prompt = r"^(?P[a-zA-Z0-9/.]\S{0,35})(?:[-_\d\w]+)?(?:\(config[^\)]*\))?#" + pattern_prompt = rb"^(?P[a-zA-Z0-9/.]\S{0,35})(?:[-_\d\w]+)?(?:\(config[^\)]*\))?#" can_strip_hostname_to = 20 requires_netmask_conversion = True convert_mac = BaseProfile.convert_mac_to_cisco diff --git a/sa/profiles/Cisco/IOSXR/profile.py b/sa/profiles/Cisco/IOSXR/profile.py index 8a31ce6a30d6f1dd5f32db419f300f61e83bed80..5ca6271842678f802786e3ac5d13ee3bd145265a 100644 --- a/sa/profiles/Cisco/IOSXR/profile.py +++ b/sa/profiles/Cisco/IOSXR/profile.py @@ -18,7 +18,7 @@ class Profile(BaseProfile): name = "Cisco.IOSXR" pattern_more = [(rb"^ --More--", b"\r")] - pattern_unprivileged_prompt = r"^\S+?>" + pattern_unprivileged_prompt = rb"^\S+?>" pattern_syntax_error = rb"% Invalid input detected at" command_disable_pager = "terminal length 0" command_super = b"enable" diff --git a/sa/profiles/Eltex/ESR/profile.py b/sa/profiles/Eltex/ESR/profile.py index 811d941f3808fa0ff3bcf0644a9b75f30f5777aa..61c0f12a3b174e231dbad013c36b82f065dc21a1 100644 --- a/sa/profiles/Eltex/ESR/profile.py +++ b/sa/profiles/Eltex/ESR/profile.py @@ -12,19 +12,20 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.ESR" + pattern_more = [ - (r"^More: , Quit: q, One line: $", " "), - (r"^More\? Enter - next line; Space - next page; Q - quit; R - show the rest.", "r"), - (r"\[Yes/press any key for no\]", "Y"), + (rb"^More: , Quit: q, One line: $", b" "), + (rb"^More\? Enter - next line; Space - next page; Q - quit; R - show the rest.", b"r"), + (rb"\[Yes/press any key for no\]", b"Y"), ] - pattern_unprivileged_prompt = r"^\S+> " - pattern_syntax_error = r"^% (Unrecognized command|Incomplete command|Wrong number of parameters or invalid range, size or characters entered)$" + pattern_unprivileged_prompt = rb"^\S+> " + pattern_syntax_error = rb"^% (Unrecognized command|Incomplete command|Wrong number of parameters or invalid range, size or characters entered)$" command_disable_pager = "terminal datadump" - command_super = "enable" + command_super = b"enable" command_enter_config = "configure" command_leave_config = "end" command_save_config = "copy running-config startup-config" - pattern_prompt = r"^\S+#" + pattern_prompt = rb"^\S+#" convert_interface_name = BaseProfile.convert_interface_name_cisco INTERFACE_TYPES = { diff --git a/sa/profiles/Eltex/LTE/profile.py b/sa/profiles/Eltex/LTE/profile.py index 042e93f5a52314f92b652c140ca9021e0f6a8d23..d28bfde249a2a98523c0d65371c6926de4836b92 100644 --- a/sa/profiles/Eltex/LTE/profile.py +++ b/sa/profiles/Eltex/LTE/profile.py @@ -12,18 +12,19 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.LTE" - pattern_username = r"(?" - pattern_syntax_error = r"\n(Command not found|Incomplete command|Invalid argument)" - pattern_operation_error = r"Data verify failed, bad MAC!" - username_submit = "\r" - password_submit = "\r" - command_submit = "\r" + pattern_syntax_error = rb"\n(Command not found|Incomplete command|Invalid argument)" + pattern_operation_error = rb"Data verify failed, bad MAC!" + username_submit = b"\r" + password_submit = b"\r" + command_submit = b"\r" command_enter_config = "configure" command_leave_config = "exit" command_save_config = "save" - pattern_prompt = r"^\S+[#>]" + pattern_prompt = rb"^\S+[#>]" class switch(object): """Switch context manager to use with "with" statement""" diff --git a/sa/profiles/Eltex/LTP/profile.py b/sa/profiles/Eltex/LTP/profile.py index 4e379689645568d066e8c021eb9b677c838a54a5..3a4138317e00c0cd470cc70a5fabc705f56ba384 100644 --- a/sa/profiles/Eltex/LTP/profile.py +++ b/sa/profiles/Eltex/LTP/profile.py @@ -15,24 +15,25 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.LTP" - pattern_username = r"(?)([Uu]ser ?[Nn]ame|[Ll]ogin): ?" - pattern_more = [(r"--More-- ", " "), (r"\[Yes/press any key for no\]", "Y")] - pattern_unprivileged_prompt = r"^\S+>" + + pattern_username = rb"(?)([Uu]ser ?[Nn]ame|[Ll]ogin): ?" + pattern_more = [(rb"--More-- ", b" "), (rb"\[Yes/press any key for no\]", b"Y")] + pattern_unprivileged_prompt = rb"^\S+>" pattern_syntax_error = ( - r"(Command not found. Use '?' to view available commands|" - r"Incomplete command\s+|Invalid argument\s+|Unknown command)" + rb"(Command not found. Use '?' to view available commands|" + rb"Incomplete command\s+|Invalid argument\s+|Unknown command)" ) # command_disable_pager = "terminal datadump" # command_super = "enable" - username_submit = "\r" - password_submit = "\r" - command_submit = "\r" + username_submit = b"\r" + password_submit = b"\r" + command_submit = b"\r" command_enter_config = "configure" command_leave_config = "exit" command_save_config = "save" - pattern_prompt = r"^\S+#" + pattern_prompt = rb"^\S+#" class switch(object): """Switch context manager to use with "with" statement""" diff --git a/sa/profiles/Eltex/MA4000/profile.py b/sa/profiles/Eltex/MA4000/profile.py index 4318ff00ac4e9ccbfd447e8a69ea71c8e3ace451..d324da6bf8d20217c6aacd8ec50497fe3ea870fd 100644 --- a/sa/profiles/Eltex/MA4000/profile.py +++ b/sa/profiles/Eltex/MA4000/profile.py @@ -15,15 +15,16 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.MA4000" - pattern_username = r"^\S+ login: " - pattern_more = [(r"^--More-- ", " "), (r"\[Yes/press any key for no\]", "Y")] + + pattern_username = rb"^\S+ login: " + pattern_more = [(rb"^--More-- ", b" "), (rb"\[Yes/press any key for no\]", b"Y")] rogue_chars = [ re.compile(br"\r\s{9}\r"), re.compile(br"^\s+VLAN Table\r\n\s+\~+\r\n", re.MULTILINE), b"\r", ] - pattern_syntax_error = r"^Unknown command" - pattern_prompt = r"^(?P\S+)# " + pattern_syntax_error = rb"^Unknown command" + pattern_prompt = rb"^(?P\S+)# " command_exit = "exit" telnet_naws = b"\x00\x7f\x00\x7f" diff --git a/sa/profiles/Eltex/MES/profile.py b/sa/profiles/Eltex/MES/profile.py index e20d8514e64e3e7c7c6e7a2b118b8631ef9bb538..fe260bfce092d01c5d827a386184e7422bcc43e8 100644 --- a/sa/profiles/Eltex/MES/profile.py +++ b/sa/profiles/Eltex/MES/profile.py @@ -18,27 +18,28 @@ from noc.core.snmp.render import render_mac class Profile(BaseProfile): name = "Eltex.MES" + pattern_more = [ - (r"^More: , Quit: q, One line: $", " "), - (r"\[Yes/press any key for no\]", "Y"), - (r", Quit: q or ", " "), - (r"q or +z", " "), - (r"Overwrite file \[startup-config\].... \(Y\/N\)", "Y"), - (r"Would you like to continue \? \(Y\/N\)\[N\]", "Y"), - (r"Clear Logging File \? \(Y\/N\)\[N\]", "Y"), + (rb"^More: , Quit: q, One line: $", b" "), + (rb"\[Yes/press any key for no\]", b"Y"), + (rb", Quit: q or ", b" "), + (rb"q or +z", b" "), + (rb"Overwrite file \[startup-config\].... \(Y\/N\)", b"Y"), + (rb"Would you like to continue \? \(Y\/N\)\[N\]", b"Y"), + (rb"Clear Logging File \? \(Y\/N\)\[N\]", b"Y"), ] - pattern_unprivileged_prompt = r"^(?P\S+)>\s*" + pattern_unprivileged_prompt = rb"^(?P\S+)>\s*" pattern_syntax_error = ( - r"% (Unrecognized command|Incomplete command|" - r"Wrong number of parameters or invalid range, size or " - r"characters entered)" + rb"% (Unrecognized command|Incomplete command|" + rb"Wrong number of parameters or invalid range, size or " + rb"characters entered)" ) command_disable_pager = "terminal datadump" - command_super = "enable" + command_super = b"enable" command_enter_config = "configure" command_leave_config = "end" command_save_config = "copy running-config startup-config" - pattern_prompt = r"^(?P[A-Za-z0-9-_ \:\.\*\'\,\(\)\/]+)?" r"(?:\(config[^\)]*\))?#" + pattern_prompt = rb"^(?P[A-Za-z0-9-_ \:\.\*\'\,\(\)\/]+)?(?:\(config[^\)]*\))?#" rogue_chars = [re.compile(rb"\d+-\w+-\d+\s\d+:\d+:\d+\s\%\S+\:.+"), b"\r"] # to one SNMP GET request snmp_metrics_get_chunk = 10 diff --git a/sa/profiles/Eltex/MES24xx/profile.py b/sa/profiles/Eltex/MES24xx/profile.py index 3cfa50ccb425f5ee181e866291a109a6ee4eda67..3e50feea9494ff93128d41cefc1b69607315f3ca 100644 --- a/sa/profiles/Eltex/MES24xx/profile.py +++ b/sa/profiles/Eltex/MES24xx/profile.py @@ -16,15 +16,14 @@ from noc.core.validators import is_int class Profile(BaseProfile): name = "Eltex.MES24xx" - pattern_more = [(r"--More--", " ")] - pattern_prompt = r"(?P\S+)(?:\(config[^\)]*\))?#\s*" - pattern_unprivileged_prompt = r"^(?P\S+)>\s*" - pattern_syntax_error = r"^% Invalid (?:Command|input detected at)$" + + pattern_more = [(rb"--More--", b" ")] + pattern_prompt = rb"(?P\S+)(?:\(config[^\)]*\))?#\s*" + pattern_unprivileged_prompt = rb"^(?P\S+)>\s*" + pattern_syntax_error = rb"^% Invalid (?:Command|input detected at)$" # command_disable_pager = "set cli pagination off" - need conf t mode - config_tokenizer = "line" - config_tokenizer_settings = {"line_comment": "!"} - command_submit = "\r" - command_super = "enable" + command_submit = b"\r" + command_super = b"enable" command_enter_config = "configure" command_leave_config = "end" rogue_chars = [ diff --git a/sa/profiles/Eltex/MES5448/profile.py b/sa/profiles/Eltex/MES5448/profile.py index e03b8c3feda6fc5eb7703e01f0398be296ab1b1e..d4c1b832cdee3ec891439e9917565d2e90595a12 100644 --- a/sa/profiles/Eltex/MES5448/profile.py +++ b/sa/profiles/Eltex/MES5448/profile.py @@ -25,14 +25,15 @@ def render_regexp(oid, value): class Profile(BaseProfile): name = "Eltex.MES5448" - pattern_more = [(r"--More-- or \(q\)uit", " ")] - pattern_unprivileged_prompt = r"^(?P\S+)>" - pattern_prompt = r"^(?P\S+)#" + + pattern_more = [(rb"--More-- or \(q\)uit", b" ")] + pattern_unprivileged_prompt = rb"^(?P\S+)>" + pattern_prompt = rb"^(?P\S+)#" pattern_syntax_error = ( - r"^% (Unrecognized command|Incomplete command|" - r"Wrong number of parameters or invalid range, size or " - r"characters entered)$" + rb"^% (Unrecognized command|Incomplete command|" + rb"Wrong number of parameters or invalid range, size or " + rb"characters entered)$" ) - command_super = "enable" + command_super = b"enable" command_disable_pager = "terminal length 0" snmp_display_hints = {"1.3.6.1.4.1.4413.1.1.1.1.4.9.0": render_regexp} diff --git a/sa/profiles/Eltex/PON/profile.py b/sa/profiles/Eltex/PON/profile.py index 107c12be4476f49f27d3248b74fb4e9f3fdd0d82..531b061609340efbfbc0792dc20cdc80e3c863e4 100644 --- a/sa/profiles/Eltex/PON/profile.py +++ b/sa/profiles/Eltex/PON/profile.py @@ -12,19 +12,17 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.PON" - pattern_username = r"(?" - pattern_syntax_error = ( - r"^(Command not found. Use '?' to view available commands|" - + r"Incomplete command\s+|Invalid argument\s+)" - ) + + pattern_username = rb"(?" + pattern_syntax_error = rb"^(Command not found. Use '?' to view available commands|Incomplete command\s+|Invalid argument\s+)" # command_disable_pager = "terminal datadump" # command_super = "enable" command_enter_config = "configure" command_leave_config = "exit" command_save_config = "save" - pattern_prompt = r"^\S+#" + pattern_prompt = rb"^\S+#" # convert_interface_name = BaseProfile.convert_interface_name_cisco class switch(object): diff --git a/sa/profiles/Eltex/RG/profile.py b/sa/profiles/Eltex/RG/profile.py index 1c9729424aab09de6b3194cc7b307ba5c1c5f503..12c1348a577709fcf8a7b9c9baf8dadc60407a81 100644 --- a/sa/profiles/Eltex/RG/profile.py +++ b/sa/profiles/Eltex/RG/profile.py @@ -12,13 +12,13 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.RG" - pattern_username = r"^\S+ [Ll]ogin:" - pattern_password = r"^[Pp]assword:" - pattern_syntax_error = r"Permission denied" - pattern_unprivileged_prompt = r"^\S+@(?P\S+):~\$" - pattern_prompt = r"^\S+@(?P\S+):~#" + + pattern_username = rb"^\S+ [Ll]ogin:" + pattern_password = rb"^[Pp]assword:" + pattern_syntax_error = rb"Permission denied" + pattern_unprivileged_prompt = rb"^\S+@(?P\S+):~\$" + pattern_prompt = rb"^\S+@(?P\S+):~#" command_exit = "exit" - command_more = "\n" PLATFORMS = {"46": "RG-1404GF-W"} diff --git a/sa/profiles/Eltex/SMG/profile.py b/sa/profiles/Eltex/SMG/profile.py index be69ab05e4b249a7bd6e865471d74e7be89b28ca..daed19fd79a0a85a1c75fdaf5f256452ea69e81d 100644 --- a/sa/profiles/Eltex/SMG/profile.py +++ b/sa/profiles/Eltex/SMG/profile.py @@ -12,7 +12,8 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.SMG" + # pattern_username = r"^\S+ login: " # pattern_prompt = r"^(?P\S+)# " - pattern_prompt = r"(SMG2016> )|(/[\w/]+ # )" + pattern_prompt = rb"(SMG2016> )|(/[\w/]+ # )" command_exit = "exit" diff --git a/sa/profiles/Eltex/TAU/profile.py b/sa/profiles/Eltex/TAU/profile.py index 0034fa5954c873aca7cef3a816cd5c111b335946..52e340613de7550d526102e1a8156d82ff486ebf 100644 --- a/sa/profiles/Eltex/TAU/profile.py +++ b/sa/profiles/Eltex/TAU/profile.py @@ -15,19 +15,19 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.TAU" - pattern_username = r"^\S+ [Ll]ogin:" - pattern_password = r"^[Pp]assword:" - pattern_unprivileged_prompt = r"^(?P\S+)>\s*" - pattern_prompt = r"^(\S+# |> |config> |\[\S+\]\s*|root@\S+:(~|/\S+)\$)" - pattern_more = ( - r'Press any key to continue|\| Press any key to continue \| Press "q" to exit \| ' - ) - pattern_syntax_error = r"Syntax error: Unknown command|-sh: .+: not found" + + pattern_username = rb"^\S+ [Ll]ogin:" + pattern_password = rb"^[Pp]assword:" + pattern_unprivileged_prompt = rb"^(?P\S+)>\s*" + pattern_prompt = rb"^(\S+# |> |config> |\[\S+\]\s*|root@\S+:(~|/\S+)\$)" + pattern_more = [ + (rb'Press any key to continue|\| Press any key to continue \| Press "q" to exit \| ', b"\n") + ] + pattern_syntax_error = rb"Syntax error: Unknown command|-sh: .+: not found" command_exit = "exit" - command_more = "\n" command_enter_config = "config" command_leave_config = "exit" - command_super = "enable" + command_super = b"enable" rogue_chars = [re.compile(rb"\^J"), b"\r"] matchers = { diff --git a/sa/profiles/Eltex/WOP/profile.py b/sa/profiles/Eltex/WOP/profile.py index 33bc4d92c68a4172ff41bba0c9555edd4e30c996..12a6fdd47e6824e444ec771d14e659b2de6ab068 100644 --- a/sa/profiles/Eltex/WOP/profile.py +++ b/sa/profiles/Eltex/WOP/profile.py @@ -12,11 +12,12 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.WOP" - pattern_prompt = r"^(?P\S+)\s*#|~ #" - command_more = "\n" - command_submit = "\n" + + pattern_prompt = rb"^(?P\S+)\s*#|~ #" + command_more = b"\n" + command_submit = b"\n" command_exit = "exit" - pattern_syntax_error = r"Invalid command\." + pattern_syntax_error = rb"Invalid command\." INTERFACE_TYPES = { "lo": "loopback", # Loopback diff --git a/sa/profiles/Eltex/WOPLR/profile.py b/sa/profiles/Eltex/WOPLR/profile.py index 2a3066ebb9a9f320f9bdfe2f63c172336fae1f9a..f4ee3da69446c0d8f3f2a82a3e3245f8c40c668a 100644 --- a/sa/profiles/Eltex/WOPLR/profile.py +++ b/sa/profiles/Eltex/WOPLR/profile.py @@ -15,9 +15,10 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Eltex.WOPLR" - pattern_prompt = r"^(?P\S+)\s*#|~ #" + + pattern_prompt = rb"^(?P\S+)\s*#|~ #" command_exit = "exit" - pattern_syntax_error = r"Invalid command\." + pattern_syntax_error = rb"Invalid command\." rx_physical = re.compile(r"^(wlan|eth|br|tun|gre)\d+$") diff --git a/sa/profiles/Force10/SFTOS/profile.py b/sa/profiles/Force10/SFTOS/profile.py index d0d973c605ff43379ed064b53b2de54847aa620a..b84db15f9c67b4c8bdb312466d02802e3861da9e 100644 --- a/sa/profiles/Force10/SFTOS/profile.py +++ b/sa/profiles/Force10/SFTOS/profile.py @@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Force10.SFTOS" - pattern_more = rb"^--More-- or \(q\)uit" + pattern_more = [(rb"^--More-- or \(q\)uit", b"\n")] pattern_unprivileged_prompt = rb"^(?P\S+?)>" pattern_prompt = rb"^(?P\S+?)#" pattern_syntax_error = rb"% Invalid input detected at " diff --git a/sa/profiles/Huawei/MA5300/profile.py b/sa/profiles/Huawei/MA5300/profile.py index 743ceb6153e78ca6d40d5f1f29954395b07ad91a..b42bab00ae2e5f9579b699340d663ae8700c8db0 100644 --- a/sa/profiles/Huawei/MA5300/profile.py +++ b/sa/profiles/Huawei/MA5300/profile.py @@ -46,7 +46,7 @@ class Profile(BaseProfile): re.compile(br"\n\r\s+Line \d+ operating, attempt of the Line -\d+ denied!\n\r"), re.compile(br"\r\n\s+Note: Terminal users login \(IP: \S+ \)"), re.compile(br"\r\nWarning: Battery is low power!"), - "\r", + b"\r", ] # to one SNMP GET request snmp_metrics_get_chunk = 30 diff --git a/sa/profiles/Linux/Alt/profile.py b/sa/profiles/Linux/Alt/profile.py index 98c13d6e6ffa7fdf201a262e3b35f15601cd4b47..8c5000aad668d36cbe766e4d23f785212890fd40 100644 --- a/sa/profiles/Linux/Alt/profile.py +++ b/sa/profiles/Linux/Alt/profile.py @@ -33,7 +33,7 @@ class Profile(BaseProfile): (rb"Is this ok \[y/N\]: ", b"y\n"), ] command_disable_pager = "LANG=en_US.UTF-8; PATH=$PATH:/sbin:/usr/sbin; PROMPT_COMMAND=''" - command_super = "sudo bash" + command_super = b"sudo bash" command_exit = "exit" INTERFACE_TYPES = { diff --git a/sa/profiles/Linux/Astra/profile.py b/sa/profiles/Linux/Astra/profile.py index 8d4b8e3028f8284e8d99ebca16cbe60f855343dc..51dd2612742017c9a73c3d73988e6547c35142e2 100644 --- a/sa/profiles/Linux/Astra/profile.py +++ b/sa/profiles/Linux/Astra/profile.py @@ -18,28 +18,27 @@ class Profile(BaseProfile): name = "Linux.Astra" # supported_schemes = [NOCProfile.TELNET, NOCProfile.SSH] - pattern_username = r"^((?!Last)\S+ login|[Ll]ogin):" - pattern_password = r"^[Pp]assword:" + pattern_username = rb"^((?!Last)\S+ login|[Ll]ogin):" + pattern_password = rb"^[Pp]assword:" """ "user@debian-test-virtual:~$ " "root@debian-test-virtual:/home/user# " """ - pattern_unprivileged_prompt = r"\S+@\S+(:\~$|\$)\s" - pattern_prompt = r"\S+@\S+#\s" + pattern_unprivileged_prompt = rb"\S+@\S+(:\~$|\$)\s" + pattern_prompt = rb"\S+@\S+#\s" pattern_syntax_error = ( - r"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" - r"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" - r"\w+: \w+: \w+: No such file or directory)" + rb"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" + rb"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" + rb"\w+: \w+: \w+: No such file or directory)" ) pattern_more = [ - (r"Install package.*\[N/y\]\s$", "\n"), - (r"Is this ok \[y/N\]: ", "y\n"), + (rb"Install package.*\[N/y\]\s$", b"\n"), + (rb"Is this ok \[y/N\]: ", b"y\n"), ] command_disable_pager = "LANG=en_US.UTF-8; PATH=$PATH:/sbin:/usr/sbin; PROMPT_COMMAND=''" - command_super = "sudo bash" + command_super = b"sudo bash" command_exit = "exit" - command_more = "\n" INTERFACE_TYPES = { "et": "physical", # No comment diff --git a/sa/profiles/Linux/Debian/profile.py b/sa/profiles/Linux/Debian/profile.py index 0f0cd782f842b11d11e16a9062261966568446fe..6afac5603f729ab5d5cd4cd86d12aee3c6f57bbc 100644 --- a/sa/profiles/Linux/Debian/profile.py +++ b/sa/profiles/Linux/Debian/profile.py @@ -14,24 +14,23 @@ class Profile(BaseProfile): name = "Linux.Debian" # supported_schemes = [NOCProfile.TELNET, NOCProfile.SSH] - pattern_username = r"^((?!Last)\S+ login|[Ll]ogin):" - pattern_password = r"^[Pp]assword:" + pattern_username = rb"^((?!Last)\S+ login|[Ll]ogin):" + pattern_password = rb"^[Pp]assword:" """ "user@debian-test-virtual:~$ " "root@debian-test-virtual:/home/user# " """ - pattern_prompt = r"\S+@\S+(#|:\~$|\$)\s" + pattern_prompt = rb"\S+@\S+(#|:\~$|\$)\s" pattern_syntax_error = ( - r"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" - r"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" - r"\w+: \w+: \w+: No such file or directory)" + rb"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" + rb"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" + rb"\w+: \w+: \w+: No such file or directory)" ) - pattern_more = [(r"Install package.*\[N/y\]\s$", "\n"), (r"Is this ok \[y/N\]: ", "y\n")] + pattern_more = [(rb"Install package.*\[N/y\]\s$", b"\n"), (rb"Is this ok \[y/N\]: ", b"y\n")] command_disable_pager = "LANG=en_US.UTF-8 ; PATH=$PATH:/sbin:/usr/sbin ; PROMPT_COMMAND=''" - command_super = "sudo bash" + command_super = b"sudo bash" command_exit = "exit" - command_more = "\n" # def setup_session(self, script): # script.cli("config", ignore_errors=True) diff --git a/sa/profiles/Linux/RHEL/profile.py b/sa/profiles/Linux/RHEL/profile.py index 08339dfb69c3eed3b37e9a3b0785ee8e3e88fe9d..b7881d41e7952d1c879ab7b5798f43021c9f5292 100644 --- a/sa/profiles/Linux/RHEL/profile.py +++ b/sa/profiles/Linux/RHEL/profile.py @@ -14,19 +14,18 @@ class Profile(BaseProfile): name = "Linux.RHEL" # supported_schemes = [NOCProfile.TELNET, NOCProfile.SSH] - pattern_username = r"^((?!Last)\S+ login|[Ll]ogin):" - pattern_password = r"^[Pp]assword:" + pattern_username = rb"^((?!Last)\S+ login|[Ll]ogin):" + pattern_password = rb"^[Pp]assword:" # use default BASH promt PS1='[\u@\h \W]\$ ' # pattern_prompt = r"^\[\S+@\S+\s\S+](#|\$)\s" - pattern_prompt = r"\[\S+@\S+\s\S+](#|\$)\s" + pattern_prompt = rb"\[\S+@\S+\s\S+](#|\$)\s" pattern_syntax_error = ( - r"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" - r"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" - r"\w+: \w+: \w+: No such file or directory)" + rb"^(bash: \S+: command not found...\r\n|-\w+: \w+: not found|" + rb"-\w+: \w+: No such file or directory|\w+: \w+: command not found|" + rb"\w+: \w+: \w+: No such file or directory)" ) - pattern_more = [(r"Install package.*\[N/y\]\s$", "\n"), (r"Is this ok \[y/N\]: ", "y\n")] + pattern_more = [(rb"Install package.*\[N/y\]\s$", b"\n"), (rb"Is this ok \[y/N\]: ", b"y\n")] command_disable_pager = "LANG=en_US.UTF-8 ; PATH=$PATH:/sbin:/usr/sbin ; PROMPT_COMMAND=''" - command_super = "sudo bash" + command_super = b"sudo bash" command_exit = "exit" - command_more = "\n" diff --git a/sa/profiles/Raisecom/RCIOS/profile.py b/sa/profiles/Raisecom/RCIOS/profile.py index 7de22172c1fde1f37e9e1d626c85dd0b6dcf550e..aaa817bc6b97fb35490a1fd60a1290c367494dd1 100644 --- a/sa/profiles/Raisecom/RCIOS/profile.py +++ b/sa/profiles/Raisecom/RCIOS/profile.py @@ -15,7 +15,7 @@ class Profile(BaseProfile): pattern_username = rb"^([Uu]ser ?[Nn]ame|[Ll]ogin): ?" pattern_unprivileged_prompt = rb"^(?P\S+)> " - pattern_super_password = r"^Enable: " + pattern_super_password = rb"^Enable: " cli_retries_super_password = 2 command_super = b"enable" pattern_prompt = rb"^(?P\S+)# " diff --git a/sa/profiles/SKS/SKS/profile.py b/sa/profiles/SKS/SKS/profile.py index eb68d948df292fe1c542515ff74300c3521968f5..c54426926d93690d44e9388ab02e3002d7bc8e07 100644 --- a/sa/profiles/SKS/SKS/profile.py +++ b/sa/profiles/SKS/SKS/profile.py @@ -28,7 +28,7 @@ class Profile(BaseProfile): ) command_super = b"enable" command_disable_pager = "terminal datadump" - rogue_chars = [re.compile(rb"\r\n##+#\r\n"), "\r"] + rogue_chars = [re.compile(rb"\r\n##+#\r\n"), b"\r"] pattern_more = [ (rb"More: , Quit: q or CTRL+Z, One line: ", b"a"), (rb"^ --More-- ", b" "), diff --git a/sa/profiles/ZTE/ZXR10/profile.py b/sa/profiles/ZTE/ZXR10/profile.py index 70da182bfa01d2021dd773ad6f4b2cd10623dae7..890e7ffe9b4d7bf9630d2a346c4e42b0267b88b2 100644 --- a/sa/profiles/ZTE/ZXR10/profile.py +++ b/sa/profiles/ZTE/ZXR10/profile.py @@ -27,7 +27,7 @@ class Profile(BaseProfile): command_enter_config = "configure terminal" command_leave_config = "exit" command_save_config = "write\n" - pattern_prompt = r"^(?P\S+?)(?:-\d+)?(?:\(config[^\)]*\))?#" + pattern_prompt = rb"^(?P\S+?)(?:-\d+)?(?:\(config[^\)]*\))?#" requires_netmask_conversion = True convert_mac = BaseProfile.convert_mac_to_cisco config_volatile = [r"^ntp clock-period .*?^"] diff --git a/sa/profiles/Zhone/Bitstorm/profile.py b/sa/profiles/Zhone/Bitstorm/profile.py index 4077bf400cac09f38ba7f343d756c095ec24b444..032e85f8c0c8983f0abc01ebf3b19cea5ef5c3a3 100644 --- a/sa/profiles/Zhone/Bitstorm/profile.py +++ b/sa/profiles/Zhone/Bitstorm/profile.py @@ -25,8 +25,8 @@ class Profile(BaseProfile): pattern_prompt = ( rb"^[\s\*]*(?P[\S\s]+)(?]" ) - pattern_syntax_error = r"Syntax error" - pattern_operation_error = r"ERROR: Permission denied." + pattern_syntax_error = rb"Syntax error" + pattern_operation_error = rb"ERROR: Permission denied." pattern_more = [(rb" for next page, for next line, A for all, Q to quit", b"a")] command_exit = "exit" diff --git a/sa/profiles/Zyxel/ZyNOS/profile.py b/sa/profiles/Zyxel/ZyNOS/profile.py index 48325b64635ef6bb9118d90a0ceced0954279ea8..39861c2a5488cf632e237c62a5d61d64631f9bd5 100644 --- a/sa/profiles/Zyxel/ZyNOS/profile.py +++ b/sa/profiles/Zyxel/ZyNOS/profile.py @@ -28,9 +28,9 @@ class Profile(BaseProfile): command_save_config = "write memory" command_enter_zynos = "mode zynos" command_exit_zynos = "sys cli newCLI" - pattern_syntax_error = "Invalid (command|input)" + pattern_syntax_error = b"Invalid (command|input)" # enable_cli_session = False - rogue_chars = [rb"\x1b7", "\r"] + rogue_chars = [rb"\x1b7", b"\r"] config_volatile = [r"^time\s+(\d+|date).*?^"] rx_ifname = re.compile(r"^swp(?P\d+)$") diff --git a/sa/profiles/Zyxel/ZyNOS_EE/profile.py b/sa/profiles/Zyxel/ZyNOS_EE/profile.py index 6cabf7de0257736604ffa1764035b1713d7d73e8..7346e9f2ccfa274a6846c1d9947b988bda2bb512 100644 --- a/sa/profiles/Zyxel/ZyNOS_EE/profile.py +++ b/sa/profiles/Zyxel/ZyNOS_EE/profile.py @@ -13,7 +13,7 @@ from noc.core.profile.base import BaseProfile class Profile(BaseProfile): name = "Zyxel.ZyNOS_EE" - pattern_password = "Password: " + pattern_password = b"Password: " pattern_prompt = rb"^\S+?> " pattern_more = [(rb"^-- more --.*?$", b" ")] pattern_syntax_error = rb"^Valid commands are:"