__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ 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:

[email protected]: ~ $
"""test passlib.apps"""
#=============================================================================
# imports
#=============================================================================
from __future__ import with_statement
# core
import logging; log = logging.getLogger(__name__)
# site
# pkg
from passlib import apps, hash as hashmod
from passlib.tests.utils import TestCase
# module

#=============================================================================
# test predefined app contexts
#=============================================================================
class AppsTest(TestCase):
    """perform general tests to make sure contexts work"""
    # NOTE: these tests are not really comprehensive,
    #       since they would do little but duplicate
    #       the presets in apps.py
    #
    #       they mainly try to ensure no typos
    #       or dynamic behavior foul-ups.

    def test_master_context(self):
        ctx = apps.master_context
        self.assertGreater(len(ctx.schemes()), 50)

    def test_custom_app_context(self):
        ctx = apps.custom_app_context
        self.assertEqual(ctx.schemes(), ("sha512_crypt", "sha256_crypt"))
        for hash in [
            ('$6$rounds=41128$VoQLvDjkaZ6L6BIE$4pt.1Ll1XdDYduEwEYPCMOBiR6W6'
                'znsyUEoNlcVXpv2gKKIbQolgmTGe6uEEVJ7azUxuc8Tf7zV9SD2z7Ij751'),
            ('$5$rounds=31817$iZGmlyBQ99JSB5n6$p4E.pdPBWx19OajgjLRiOW0itGny'
                 'xDGgMlDcOsfaI17'),
        ]:
            self.assertTrue(ctx.verify("test", hash))

    def test_django16_context(self):
        ctx = apps.django16_context
        for hash in [
            'pbkdf2_sha256$29000$ZsgquwnCyBs2$fBxRQpfKd2PIeMxtkKPy0h7SrnrN+EU/cm67aitoZ2s=',
            'sha1$0d082$cdb462ae8b6be8784ef24b20778c4d0c82d5957f',
            'md5$b887a$37767f8a745af10612ad44c80ff52e92',
            'crypt$95a6d$95x74hLDQKXI2',
            '098f6bcd4621d373cade4e832627b4f6',
        ]:
            self.assertTrue(ctx.verify("test", hash))

        self.assertEqual(ctx.identify("!"), "django_disabled")
        self.assertFalse(ctx.verify("test", "!"))

    def test_django_context(self):
        ctx = apps.django_context
        for hash in [
            'pbkdf2_sha256$29000$ZsgquwnCyBs2$fBxRQpfKd2PIeMxtkKPy0h7SrnrN+EU/cm67aitoZ2s=',
        ]:
            self.assertTrue(ctx.verify("test", hash))

        self.assertEqual(ctx.identify("!"), "django_disabled")
        self.assertFalse(ctx.verify("test", "!"))

    def test_ldap_nocrypt_context(self):
        ctx = apps.ldap_nocrypt_context
        for hash in [
            '{SSHA}cPusOzd6d5n3OjSVK3R329ZGCNyFcC7F',
            'test',
        ]:
            self.assertTrue(ctx.verify("test", hash))

        self.assertIs(ctx.identify('{CRYPT}$5$rounds=31817$iZGmlyBQ99JSB5'
                'n6$p4E.pdPBWx19OajgjLRiOW0itGnyxDGgMlDcOsfaI17'), None)

    def test_ldap_context(self):
        ctx = apps.ldap_context
        for hash in [
            ('{CRYPT}$5$rounds=31817$iZGmlyBQ99JSB5n6$p4E.pdPBWx19OajgjLRiOW0'
                'itGnyxDGgMlDcOsfaI17'),
            '{SSHA}cPusOzd6d5n3OjSVK3R329ZGCNyFcC7F',
            'test',
        ]:
            self.assertTrue(ctx.verify("test", hash))

    def test_ldap_mysql_context(self):
        ctx = apps.mysql_context
        for hash in [
            '*94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29',
            '378b243e220ca493',
        ]:
            self.assertTrue(ctx.verify("test", hash))

    def test_postgres_context(self):
        ctx = apps.postgres_context
        hash = 'md55d9c68c6c50ed3d02a2fcf54f63993b6'
        self.assertTrue(ctx.verify("test", hash, user='user'))

    def test_phppass_context(self):
        ctx = apps.phpass_context
        for hash in [
            '$P$8Ja1vJsKa5qyy/b3mCJGXM7GyBnt6..',
            '$H$8b95CoYQnQ9Y6fSTsACyphNh5yoM02.',
            '_cD..aBxeRhYFJvtUvsI',
        ]:
            self.assertTrue(ctx.verify("test", hash))

        h1 = "$2a$04$yjDgE74RJkeqC0/1NheSSOrvKeu9IbKDpcQf/Ox3qsrRS/Kw42qIS"
        if hashmod.bcrypt.has_backend():
            self.assertTrue(ctx.verify("test", h1))
            self.assertEqual(ctx.default_scheme(), "bcrypt")
            self.assertEqual(ctx.handler().name, "bcrypt")
        else:
            self.assertEqual(ctx.identify(h1), "bcrypt")
            self.assertEqual(ctx.default_scheme(), "phpass")
            self.assertEqual(ctx.handler().name, "phpass")

    def test_phpbb3_context(self):
        ctx = apps.phpbb3_context
        for hash in [
            '$P$8Ja1vJsKa5qyy/b3mCJGXM7GyBnt6..',
            '$H$8b95CoYQnQ9Y6fSTsACyphNh5yoM02.',
        ]:
            self.assertTrue(ctx.verify("test", hash))
        self.assertTrue(ctx.hash("test").startswith("$H$"))

    def test_roundup_context(self):
        ctx = apps.roundup_context
        for hash in [
            '{PBKDF2}9849$JMTYu3eOUSoFYExprVVqbQ$N5.gV.uR1.BTgLSvi0qyPiRlGZ0',
            '{SHA}a94a8fe5ccb19ba61c4c0873d391e987982fbbd3',
            '{CRYPT}dptOmKDriOGfU',
            '{plaintext}test',
        ]:
            self.assertTrue(ctx.verify("test", hash))

#=============================================================================
# eof
#=============================================================================

Filemanager

Name Type Size Permission Actions
__pycache__ Folder 0755
__init__.py File 20 B 0644
__main__.py File 82 B 0644
_test_bad_register.py File 541 B 0644
backports.py File 2.53 KB 0644
sample1.cfg File 243 B 0644
sample1b.cfg File 252 B 0644
sample1c.cfg File 490 B 0644
sample_config_1s.cfg File 238 B 0644
test_apache.py File 28.75 KB 0644
test_apps.py File 5.16 KB 0644
test_context.py File 72.8 KB 0644
test_context_deprecated.py File 28.6 KB 0644
test_crypto_builtin_md4.py File 5.53 KB 0644
test_crypto_des.py File 8.67 KB 0644
test_crypto_digest.py File 20 KB 0644
test_crypto_scrypt.py File 26.02 KB 0644
test_ext_django.py File 40.4 KB 0644
test_ext_django_source.py File 10.78 KB 0644
test_handlers.py File 67.02 KB 0644
test_handlers_argon2.py File 22.3 KB 0644
test_handlers_bcrypt.py File 28.86 KB 0644
test_handlers_cisco.py File 19.99 KB 0644
test_handlers_django.py File 15.17 KB 0644
test_handlers_pbkdf2.py File 18.35 KB 0644
test_handlers_scrypt.py File 4.09 KB 0644
test_hosts.py File 3.81 KB 0644
test_pwd.py File 7.02 KB 0644
test_registry.py File 9.03 KB 0644
test_totp.py File 64.25 KB 0644
test_utils.py File 45.04 KB 0644
test_utils_handlers.py File 31.38 KB 0644
test_utils_md4.py File 1.44 KB 0644
test_utils_pbkdf2.py File 11.91 KB 0644
test_win32.py File 1.88 KB 0644
tox_support.py File 2.42 KB 0644
utils.py File 144.17 KB 0644
Filemanager