HttpEngine (http.py)

Nettacker · scraping

Manages asynchronous HTTP requests and responses for web scanning tasks.

#!/usr/bin/env python

import asyncio
import copy
import random
import re
import time

import aiohttp
import uvloop

from nettacker.core.lib.base import BaseEngine
from nettacker.core.utils.common import (
    get_http_header_key,
    get_http_header_value,
    replace_dependent_response,
    reverse_and_regex_condition,
)

asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())


async def perform_request_action(action, request_options):
    start_time = time.time()
    async with action(**request_options) as response:
        return {
            "reason": response.reason,
            "url": str(response.url),
            "status_code": str(response.status),
            "content": await response.content.read(),
            "headers": dict(response.headers),
            "responsetime": ti

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key