Esempio n. 1
0
    if str != "":
        val = int(str)
        for i in range(0, 3):
            t.getNode(i).addNoiseTraceReading(val)

for i in range(0, 3):
    t.getNode(i).createNoiseModel()
    print "Creating noise model for ", i


for i in range(0, 10):
    t.runNextEvent()

key = [0xB0, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x10, 0x11, 0x12]
msg = SecureKeyMsg()
msg.set_crc(70)
msg.set_data(key)
pkt = t.newPacket()
pkt.setData(msg.data)
pkt.setType(msg.get_amType())
pkt.setDestination(0)
pkt.deliver(0, t.time())
msg.set_crc(40)
pkt = t.newPacket()
pkt.setData(msg.data)
pkt.setType(msg.get_amType())
pkt.setDestination(1)
pkt.deliver(1, t.time())


for i in range(0, 500):
Esempio n. 2
0
for i in range(1, 4):
  t.getNode(i).createNoiseModel()
  print "Creating noise model for ",i;


for i in range(0, 10):
  t.runNextEvent();

#Send the rigth key to the first two nodes
key = [0x00,0x01,0x02,0x03,0x05,0x06,0x07,0x08,0x0A,0x0B,0x0C,0x0D,0x0F,0x10,0x11,0x12];
msg = SecureKeyMsg()
msg.set_nodeid(0);
msg.set_IV(0);
msg.set_data(key); 
msg.set_crc(0);
pkt = t.newPacket();
pkt.setData(msg.data)
pkt.setType(msg.get_amType())
pkt.setDestination(1)
pkt.deliver(1, t.time()+1)
pkt = t.newPacket();
pkt.setData(msg.data)
pkt.setType(msg.get_amType())
pkt.setDestination(2)
pkt.deliver(2, t.time()+1)

#Send the wrong key to the thirth nodes (the man in the middle)
fake_key = [0xdd,0xa1,0x02,0x04,0x05,0xff,0x07,0x08,0x0A,0x0B,0x0C,0x0D,0x0F,0x10,0x11,0x12];
msg1 = SecureKeyMsg()
msg1.set_nodeid(0);