Exemple #1
0
async def test_github_io_false_positive():
    respx.get("https://victim.com/").mock(return_value=httpx.Response(
        200, text="There isn't a GitHub Pages site here"))

    respx.head("https://github.com/falsepositive").mock(
        return_value=httpx.Response(200, text="I'm registered"))

    takeover = TakeoverChecker()
    assert not await takeover.check("victim.com", "falsepositive.github.io")
Exemple #2
0
async def test_github_io_true_positive():
    respx.get("https://victim.com/").mock(return_value=httpx.Response(
        200, text="There isn't a GitHub Pages site here"))

    respx.head("https://github.com/truepositive").mock(
        return_value=httpx.Response(404, text="No such user"))

    takeover = TakeoverChecker()
    assert await takeover.check("victim.com", "truepositive.github.io")
Exemple #3
0
async def test_myshopify_true_positive():
    respx.get("https://victim.com/").mock(return_value=httpx.Response(
        200, text="Sorry, this shop is currently unavailable"))

    myshopify_api_url = (
        "https://app.shopify.com/services/signup/check_availability.json?"
        f"shop_name=falsepositive&[email protected]")
    respx.get(myshopify_api_url).mock(
        return_value=httpx.Response(200, json={"status": "available"}))

    takeover = TakeoverChecker()
    assert await takeover.check("victim.com", "falsepositive.myshopify.com")