Beispiel #1
0
def x_ping_all(console=True):
    '''
        Example - Have all the relays send a ping
    '''
    # Create and propagate a cortex of relays
    core = propagate(console)

    # Inject ping packets for each of the relays
    for relay in core.relays:
        # Create a spark
        spark = Spark(origin=core.relays[relay].name,
                      destination=None,
                      mode='ping')
        spark.encode_spark()
        this_spark = spark.get_spark()
        core.inject(this_spark)

    # Process the packets
    core.route_buffer()

    # Show the results
    core.show_local()
    core.show_relay_stats()
    core.compare_mappings()

    return core.get_logs()
Beispiel #2
0
def x_create_spark():
    '''
        Example - Create a ping spark from relay 1
    '''
    spark = Spark(origin=1, destination=None, mode='ping')

    # Add two actions to the message
    spark.add_action("RUN")
    spark.add_action("RESTART")

    # Show the spark
    spark.show_spark()

    # Encode the spark and show the result
    spark.encode_spark()
    this_spark = spark.get_spark()
    print(this_spark)
Beispiel #3
0
def x_ping_one(console=True):
    '''
        Example - Automatic ping injection
    '''
    # Create and propagate cortex of relays
    core = propagate(console)

    spark = Spark(origin=4, destination=None, mode='ping')
    spark.encode_spark()
    this_spark = spark.get_spark()
    core.inject(this_spark)

    # Process the packets
    core.route_buffer()

    # Show the resulks
    core.show_local()
    core.show_relay_stats()
    core.compare_mapping()
Beispiel #4
0
def x_inject_ping(console=True):
    '''
        Example - Manual ping injection
    '''
    # Create and propagate cortex of relays
    core = propagate(console)

    # Create a spark
    spark = Spark(origin=1, destination=None, mode='ping')
    spark.encode_spark()
    this_spark = spark.get_spark()

    print(this_spark)
    print("\n")

    # Inject spark in to the cortex
    core.inject(this_spark)
    core.route_buffer()

    core.show_local()
    core.show_relay_stats()
Beispiel #5
0
def x_complex(console=True):
    '''
        Example - complex
    '''
    # Create and propagate a cortex of relays
    core = propagate(console)

    # Inject ting packet
    spark = Spark(origin=1, destination=None, mode='ting')
    spark.encode_spark()
    this_spark = spark.get_spark()
    core.inject(this_spark)

    # Inject a ping packet
    spark = Spark(origin=12, destination=None, mode='ping')
    spark.encode_spark()
    this_spark = spark.get_spark()
    core.inject(this_spark)

    # Create an explorer spark
    spark = Spark(origin=1, destination=None, mode='explorer')
    spark.encode_spark()
    this_spark = spark.get_spark()

    core.inject(this_spark)

    core.route_buffer()

    core.show_relay_stats()
    core.compare_mappings()