Skip to content

Commit a71a517

Browse files
authored
Use dot notation for commands (#119)
1 parent 8256eca commit a71a517

21 files changed

+23
-23
lines changed

CIS/cisco_ios/13_banner_rules/rule_134_set_the_banner_text_for_webauth_banner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
commands={'chk_cmd': 'show ip admission auth-proxy-banner http'}
88
)
99
def rule_134_set_the_banner_text_for_webauth_banner(commands, ref):
10-
banner_text = commands['chk_cmd']
10+
banner_text = commands.chk_cmd
1111
assert 'Unauthorized access is prohibited' in banner_text, ref + " - Missing or incorrect banner text."

CIS/cisco_ios/15_snmp_rules/rule_1510_require_aes_128_as_minimum_for_snmp_server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def rule_1510_require_aes_128_as_minimum_for_snmp_server(configuration, commands
2222
AssertionError: If any SNMPv3 user is not configured with AES 128 encryption.
2323
"""
2424

25-
snmp_users_output = commands['show_snmp_user'].splitlines()
25+
snmp_users_output = commands.show_snmp_user.splitlines()
2626
snmp_v3_users_aes128 = [line for line in snmp_users_output if 'AES 128' in line or 'AES128' in line]
2727

2828
# Verify that there is at least one SNMPv3 user configured with AES 128

CIS/cisco_ios/15_snmp_rules/rule_159_set_priv_for_each_snmp_server_group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
commands={'show_snmp_group': 'show snmp group'}
88
)
99
def rule_159_set_priv_for_each_snmp_server_group(configuration, commands, device, devices):
10-
snmp_groups_output = commands['show_snmp_group'].splitlines()
10+
snmp_groups_output = commands.show_snmp_group.splitlines()
1111
snmp_v3_priv_groups = [
1212
line for line in snmp_groups_output
1313
if 'v3' in line and 'auth' in line and 'priv' in line

CIS/cisco_ios/16_login_enhancements/rule_163_configuring_kerberos.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def rule_163_configuring_kerberos(configuration, commands, device, devices):
2323
AssertionError: If Kerberos is not configured correctly or credentials are not set properly.
2424
"""
2525

26-
kerberos_cred_output = commands['show_kerberos_cred']
27-
config_lines = commands['show_running_config'].splitlines()
26+
kerberos_cred_output = commands.show_kerberos_cred
27+
config_lines = commands.show_running_config.splitlines()
2828

2929
# Check if Kerberos is enabled
3030
assert 'kerberos' in config_lines, "Kerberos is not enabled on this device."

CIS/cisco_ios/16_login_enhancements/rule_164_configure_web_interface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def rule_164_configure_web_interface(configuration, commands, device, devices):
2323
AssertionError: If configurations are not set correctly.
2424
"""
2525

26-
ip_admission_output = commands['show_ip_admission']
27-
config_lines = commands['show_running_config'].splitlines()
26+
ip_admission_output = commands.show_ip_admission
27+
config_lines = commands.show_running_config.splitlines()
2828

2929
# Check SISF-Based Device Tracking is enabled
3030
assert 'device-tracking' in config_lines, \

CIS/cisco_ios/32_border_router_filtering/rule_321_set_ip_access_list_extended_to_forbid_private_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def rule_321_set_ip_access_list_extended_to_forbid_private_source_addresses_from
2424
other specified ranges.
2525
"""
2626

27-
access_list_output = commands['show_ip_access_list'].splitlines()
27+
access_list_output = commands.show_ip_access_list.splitlines()
2828
required_deny_entries = [
2929
'deny ip 127.0.0.0 0.255.255.255 any log',
3030
'deny ip 10.0.0.0 0.255.255.255 any log',

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3311_set_key_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3331_set_key_chain(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_config = commands['key_chain_config']
11+
key_chain_config = commands.key_chain_config
1212

1313
# Verifying that a key chain is configured for EIGRP
1414
assert 'key chain' in key_chain_config, ref

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3312_set_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3332_set_key(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_config = commands['key_chain_config']
11+
key_chain_config = commands.key_chain_config
1212

1313
# Verifying that the key is properly set within a key chain
1414
assert 'key' in key_chain_config, ref

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3313_set_key_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3313_set_key_string(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_detail = commands['key_chain_detail']
11+
key_chain_detail = commands.key_chain_detail
1212

1313
# Verifying that the 'key-string' is configured within the key chain
1414
assert 'key-string' in key_chain_detail, ref

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3314_set_address_family_ipv4_autonomous_system.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3314_set_address_family_ipv4_autonomous_system(commands, ref):
1010
# Extracting the EIGRP address family configuration from the command output
11-
eigrp_config = commands['eigrp_config']
11+
eigrp_config = commands.eigrp_config
1212

1313
# Verifying that the 'address-family ipv4 autonomous-system' is configured for EIGRP
1414
assert 'address-family ipv4 autonomous-system' in eigrp_config, ref

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3315_set_af_interface_default.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3315_set_af_interface_default(commands, ref):
1010
# Extracting the EIGRP address family interface configuration from the command output
11-
eigrp_af_config = commands['eigrp_af_config']
11+
eigrp_af_config = commands.eigrp_af_config
1212

1313
# Verifying that 'af-interface default' is configured within the EIGRP address family
1414
assert 'af-interface default' in eigrp_af_config, ref

CIS/cisco_ios/331_require_eigrp_auth_if_used/rule_3316_set_authentication_key_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3316_set_authentication_key_chain(commands, ref):
1010
# Extracting the EIGRP address family key chain configuration from the command output
11-
eigrp_key_chain_config = commands['eigrp_key_chain_config']
11+
eigrp_key_chain_config = commands.eigrp_key_chain_config
1212

1313
# Verifying that the 'authentication key-chain' is set within the EIGRP address family configuration
1414
assert 'authentication key-chain' in eigrp_key_chain_config, ref

CIS/cisco_ios/332_require_ospf_auth_if_used/rule_3321_set_authetnication_message_digest_for_ospf_area.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3321_set_authentication_message_digest_for_ospf_area(commands, ref):
1010
# Extracting the OSPF configuration section from the command output
11-
ospf_config = commands['ospf_config']
11+
ospf_config = commands.ospf_config
1212

1313
# Checking if 'authentication message-digest' is configured in the OSPF section
1414
assert 'area' in ospf_config and 'authentication message-digest' in ospf_config, ref

CIS/cisco_ios/332_require_ospf_auth_if_used/rule_3322_set_ip_ospf_message_digest_key_md5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def rule_3322_set_ip_ospf_message_digest_key_md5(commands, ref):
1111
# modify the rule to iterate through a list of interfaces if needed.
1212

1313
# Extracting the OSPF MD5 key configuration from the command output
14-
interface_config = commands['interface_config']
14+
interface_config = commands.interface_config
1515

1616
# Verifying the presence of the OSPF MD5 key in the interface configuration
1717
assert 'ip ospf message-digest-key' in interface_config and 'md5' in interface_config, ref

CIS/cisco_ios/333_require_ripv2_auth_if_used/rule_3331_set_key_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3331_set_key_chain(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_config = commands['key_chain_config']
11+
key_chain_config = commands.key_chain_config
1212

1313
# Verifying that a key chain is configured for RIPv2
1414
assert 'key chain' in key_chain_config, ref

CIS/cisco_ios/333_require_ripv2_auth_if_used/rule_3332_set_key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3332_set_key(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_config = commands['key_chain_config']
11+
key_chain_config = commands.key_chain_config
1212

1313
# Verifying that the key is properly set within a key chain
1414
assert 'key' in key_chain_config, ref

CIS/cisco_ios/333_require_ripv2_auth_if_used/rule_3333_set_key_string.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
)
99
def rule_3333_set_key_string(commands, ref):
1010
# Extracting the key chain configuration from the command output
11-
key_chain_detail = commands['key_chain_detail']
11+
key_chain_detail = commands.key_chain_detail
1212

1313
# Verifying that the 'key-string' is configured within the key chain
1414
assert 'key-string' in key_chain_detail, ref

CIS/cisco_ios/333_require_ripv2_auth_if_used/rule_3334_set_ip_rip_authentication_key_chain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def rule_3334_set_ip_rip_authentication_key_chain(commands, ref):
1010
# Replace {interface_name} and {rip_key-chain_name} with the actual interface and key chain names you want to test.
1111

1212
# Extracting the RIP v2 authentication configuration from the command output
13-
interface_rip_config = commands['interface_rip_config']
13+
interface_rip_config = commands.interface_rip_config
1414

1515
# Verifying that the RIP v2 authentication key chain is properly configured on the interface
1616
assert 'ip rip authentication key-chain' in interface_rip_config, ref

CIS/cisco_ios/333_require_ripv2_auth_if_used/rule_3335_set_ip_rip_authentication_mode_to_md5.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def rule_3335_set_ip_rip_authentication_mode_to_md5(commands, ref):
1010
# Replace {interface_name} with the actual interface you want to test.
1111

1212
# Extracting the RIP v2 MD5 authentication mode configuration from the command output
13-
interface_rip_mode_config = commands['interface_rip_mode_config']
13+
interface_rip_mode_config = commands.interface_rip_mode_config
1414

1515
# Verifying that the RIP v2 authentication mode is set to MD5 on the interface
1616
assert 'ip rip authentication mode md5' in interface_rip_mode_config, ref

CIS/cisco_ios/334_require_bgp_auth_if_used/3341_require_bgp_auth_if_used.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def rule_3341_require_bgp_auth_if_used(commands, ref):
1818
1919
The test checks if BGP is configured and if so, ensures the 'neighbor password' for authentication is present.
2020
"""
21-
bgp_config = commands['bgp_config']
21+
bgp_config = commands.bgp_config
2222
if 'router bgp' not in bgp_config:
2323
return # BGP is not configured; no action needed
2424
assert 'neighbor' in bgp_config and 'password' in bgp_config, ref

CIS/cisco_ios/334_require_bgp_auth_if_used/rule_3341_require_bgp_auth_if_used.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def rule_3341_require_bgp_auth_if_used(commands, ref):
1818
1919
The test checks if BGP is configured and if so, ensures the 'neighbor password' for authentication is present.
2020
"""
21-
bgp_config = commands['bgp_config']
21+
bgp_config = commands.bgp_config
2222
if 'router bgp' not in bgp_config:
2323
return # BGP is not configured; no action needed
2424
assert 'neighbor' in bgp_config and 'password' in bgp_config, ref

0 commit comments

Comments
 (0)