src/eric7/Plugins/CheckerPlugins/CodeStyleChecker/Security/Checks/snmpSecurity.py

branch
eric7
changeset 10683
779cda568acb
parent 10439
21c28b0f9e41
child 11090
f5f5f5803935
equal deleted inserted replaced
10682:47be220abdaf 10683:779cda568acb
30 (checkWeakCryptography, ("S509",)), 30 (checkWeakCryptography, ("S509",)),
31 ], 31 ],
32 } 32 }
33 33
34 34
35 def checkInsecureVersion(reportError, context, config): # noqa: U100 35 def checkInsecureVersion(reportError, context, _config):
36 """ 36 """
37 Function to check for the use of insecure SNMP version like 37 Function to check for the use of insecure SNMP version like
38 v1, v2c. 38 v1, v2c.
39 39
40 @param reportError function to be used to report errors 40 @param reportError function to be used to report errors
41 @type func 41 @type func
42 @param context security context object 42 @param context security context object
43 @type SecurityContext 43 @type SecurityContext
44 @param config dictionary with configuration data 44 @param _config dictionary with configuration data (unused)
45 @type dict 45 @type dict
46 """ 46 """
47 if context.callFunctionNameQual == "pysnmp.hlapi.CommunityData" and ( 47 if context.callFunctionNameQual == "pysnmp.hlapi.CommunityData" and (
48 context.checkCallArgValue("mpModel", 0) 48 context.checkCallArgValue("mpModel", 0)
49 or context.check_call_arg_value("mpModel", 1) 49 or context.check_call_arg_value("mpModel", 1)
56 "M", 56 "M",
57 "H", 57 "H",
58 ) 58 )
59 59
60 60
61 def checkWeakCryptography(reportError, context, config): # noqa: U100 61 def checkWeakCryptography(reportError, context, _config):
62 """ 62 """
63 Function to check for the use of insecure SNMP cryptography 63 Function to check for the use of insecure SNMP cryptography
64 (i.e. v3 using noAuthNoPriv). 64 (i.e. v3 using noAuthNoPriv).
65 65
66 @param reportError function to be used to report errors 66 @param reportError function to be used to report errors
67 @type func 67 @type func
68 @param context security context object 68 @param context security context object
69 @type SecurityContext 69 @type SecurityContext
70 @param config dictionary with configuration data 70 @param _config dictionary with configuration data (unused)
71 @type dict 71 @type dict
72 """ 72 """
73 if ( 73 if (
74 context.callFunctionNameQual == "pysnmp.hlapi.UsmUserData" 74 context.callFunctionNameQual == "pysnmp.hlapi.UsmUserData"
75 and context.callArgsCount < 3 75 and context.callArgsCount < 3

eric ide

mercurial