Skip to content

GremlinNetworkAttackHelper hostname setter broken #66

@davebrown-exit107

Description

@davebrown-exit107

When using children of GremlinNetworkAttackHelper (GremlinPacketLossAttack, GremlinLatencyAttack, GremlinBlackholeAttack), the hostnames parameter behaves in an unexpected manner when given a list.

In the general case of GremlinNetworkAttackHelper will return a list consisting of only the last element of the input list.

hostnames = [
            'www.gremlin.com',
            '^api.gremlin.com',
            ]
attack = GremlinNetworkAttackHelper(hostnames=hostnames)

expected: ['www.gremlin.com', '^api.gremlin.com'] (<class 'list'>)
actual attack.hostnames: ['^api.gremlin.com'] (<class 'list'>)

In more specific cases of actual attacks (e.g. GremlinPacketLossAttack), the same behavior shows up, except that the output of the api_model() call is a list of elements of the string that was the last element of the input list.

hostnames = [
            'www.gremlin.com',
            '^api.gremlin.com',
            ]
attack = GremlinNetworkAttackHelper(hostnames=hostnames)

expected: {'type': 'packet_loss', 'commandType': 'Packet Loss', 'args': ['-l', '60', '-r', '1', '-p', '^53', '-h', 'www.gremlin.com,^api.gremlin.com']}
actual attack.hostnames: {'type': 'packet_loss', 'commandType': 'Packet Loss', 'args': ['-l', '60', '-r', '1', '-p', '^53', '-h', '^,a,p,i,.,g,r,e,m,l,i,n,.,c,o,m']}

hostnames-list-example.py.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions