Skip to content

Make C/S/X prompt case-insensitive in exploitation actions #105

@godylockz

Description

@godylockz

Currently, in coercer/core/tasks/execute.py, the exploitation prompt expects only uppercase C, S, X as valid answers:

while next_action_answer not in ["C", "S", "X"]:
    next_action_answer = input(
        "Continue (C) | Skip this function (S) | Stop exploitation (X) ? "
    )
    if len(next_action_answer) > 0:
        next_action_answer = (
            next_action_answer.strip()[0].upper()
        )

This can be frustrating for users who input c, s, or x (lowercase), as the loop does not accept those and they must re-enter their answer.

Suggested fix:
Make the prompt case-insensitive by always converting the first character to uppercase and checking accordingly. For example, update the while condition:

while next_action_answer not in ["C", "S", "X"]:
    next_action_answer = input(
        "Continue (C) | Skip this function (S) | Stop exploitation (X) ? "
    )
    if len(next_action_answer) > 0:
        next_action_answer = next_action_answer.strip()[0].upper()

or even better, pre-normalize input for the check:

while True:
    next_action_answer = input(
        "Continue (C) | Skip this function (S) | Stop exploitation (X) ? "
    )
    if next_action_answer:
        next_action_answer = next_action_answer.strip().upper()
        if next_action_answer and next_action_answer[0] in ["C", "S", "X"]:
            next_action_answer = next_action_answer[0]
            break

This allows both lowercase and uppercase input, improving user experience.

File reference:
coercer/core/tasks/execute.py#L237

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions