Ejemplo n.º 1
0
Archivo: features.py Proyecto: ru0/xcat
async def detect_features(requester: Requester) -> List[Feature]:
    returner = []

    for feature in features:
        if callable(feature.tests):
            checks = [await feature.tests(requester)]
        else:
            checks = await asyncio.gather(
                *[requester.check(test) for test in feature.tests])

        returner.append((feature, all(checks)))

    return returner
Ejemplo n.º 2
0
Archivo: payloads.py Proyecto: ru0/xcat
async def detect_payload(requester: Requester) -> List[Injection]:
    working = requester.target_parameter_value

    returner = []

    for injector in injectors:
        result_futures = [
            requester.check(test_payload.format(working=working))
            for (test_payload, expected) in injector.test_payloads
        ]

        results = await asyncio.gather(*result_futures)

        for idx, (test_payload, expected) in enumerate(injector.test_payloads):
            if results[idx] == expected:
                continue
            break
        else:
            returner.append(injector)

    return returner