-
-
Notifications
You must be signed in to change notification settings - Fork 76
Security functions
With these functions is possible to know the current protection level, and to set/clear the current session password.
Especially because, if you look at the source code, there is an encoding function that translates the plain password before send it to the PLC.
PASSWORD HACKING IS VERY FAR FROM THE AIM OF THIS PROJECT
Detailed information about the protection level can be found in §33.19 of "System Software for S7-300/400 System and Standard Functions".
Function | Purpose |
---|---|
SetSessionPassword | Send the password to the PLC to meet its security level (login) |
ClearSessionPassword | Clears the password set for the current session (logout) |
GetProtection | Gets the CPU protection level info |
Send the password to the PLC to meet its security level.
public int SetSessionPassword(string Password);
Name | Type | Note |
---|---|---|
Address | string | 8 chars UTF-8 string |
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.
A password accepted by a PLC is an 8 chars string, a greater password will be truncated, and a smaller one will be "right space padded".
Clears the password set for the current session (logout).
public int ClearSessionPassword()
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.
Gets the CPU protection level info.
public int GetProtection(ref S7Protection Protection)
Name | Type | Note |
---|---|---|
Protection | S7Protection | see definition below |
public struct S7Protection
{
public ushort sch_schal;
public ushort sch_par;
public ushort sch_rel;
public ushort bart_sch;
public ushort anl_sch;
};
Name | Value | Meaning |
---|---|---|
sch_schal | 1,2,3 | Protection level set with the mode selector. |
sch_par | 0,1,2,3 | Password level, 0 : no password |
sch_rel | 0,1,2,3 | Valid protection level of the CPU |
bart_sch | 0,1,2,3,4 | Mode selector setting (1:RUN, 2:RUN-P, 3:STOP, 4:MRES, 0:undefined or cannot be determined) |
anl_sch | 0,1,2 | Startup switch setting (1:CRST, 2:WRST, 0:undefined, does not exist or cannot be determined) |
See also §33.19 of "System Software for S7-300/400 System and Standard Functions"
- 0 : The function was accomplished with no errors.
- Other values : see the Errors Code List.