-
Notifications
You must be signed in to change notification settings - Fork 670
Expand file tree
/
Copy pathclient_encrypt_malicious.py
More file actions
36 lines (25 loc) · 1.06 KB
/
client_encrypt_malicious.py
File metadata and controls
36 lines (25 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from opcua import Client
from opcua import ua
import time
import random
import logging
logging.basicConfig(level=logging.DEBUG)
if __name__ == '__main__':
client = Client("opc.tcp://localhost:4841/freeopcua/server/")
## one can set different sets of key/cert for testing
#client.load_private_key('key.pem')
#client.load_client_certificate('cert.pem')
client.load_private_key('private-key-example.pem')
client.load_client_certificate('certificate-example.der')
client.set_security_string("Basic256,SignAndEncrypt,cert.pem,key.pem")
#client.set_security_string("Basic256,SignAndEncrypt,certificate-example.der,private-key-example.pem")
## this doesn't work because this cert.key pair is used for encryption of data
#client.set_security_string("Basic256,SignAndEncrypt,cert.pem,private-key-example.pem")
time.sleep(5)
client.connect()
print("connectedddd")
var_temp = client.get_node("ns=2;i=12")
var_vibration = client.get_node("ns=2;i=15")
while True:
var_temp.get_value()
time.sleep(10)