403Webshell
Server IP : 199.250.200.62  /  Your IP : 216.73.217.89
Web Server : Apache
System : Linux vps37394.inmotionhosting.com 3.10.0-1160.119.1.vz7.224.4 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User : jasonp18 ( 1000)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/imh-dnskeyapi/tests/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/imh-dnskeyapi/tests/conftest.py
"""Pytest fixtures"""

import os
import shutil
import pytest

CONF = "/usr/local/cpanel/whostmgr/etc/imhapi/allowed_hosts.conf"

# pylint:disable=redefined-outer-name


@pytest.fixture
def allow_local():
    """Add 127.0.0.1 to ``CONF`` under authorized_ips"""
    shutil.copy(CONF, f"{CONF}.bak")
    with open(CONF, encoding='utf-8') as file:
        data = file.read().splitlines(keepends=True)
    with open(CONF, 'w', encoding='utf-8') as file:
        for line in data:
            if line.startswith('authorized_ips='):
                line = f"{line.rstrip()},127.0.0.1\n"
            file.write(line)
    yield
    os.rename(f"{CONF}.bak", CONF)


@pytest.fixture
def access_hash():
    """Read /root/.accesshash or raise IOError"""
    with open('/root/.accesshash', encoding='utf-8') as hash_file:
        hash_lines = hash_file.read().splitlines()
    return ''.join(hash_lines)

Youez - 2016 - github.com/yon3zu
LinuXploit