id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
40,400 | manager.py | jumpserver_jumpserver/apps/assets/automations/ping_gateway/manager.py | import socket
import paramiko
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from assets.const import AutomationTypes, Connectivity
from assets.models import Gateway
from common.utils import get_logger
logger = get_logger(__name__)
class PingGatewayManager:
def __init... | 4,987 | Python | .py | 123 | 28.829268 | 84 | 0.576415 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,401 | manager.py | jumpserver_jumpserver/apps/assets/automations/base/manager.py | import hashlib
import json
import os
import shutil
from socket import gethostname
import yaml
from django.conf import settings
from django.utils import timezone
from django.utils.translation import gettext as _
from sshtunnel import SSHTunnelForwarder
from assets.automations.methods import platform_automation_methods... | 13,260 | Python | .py | 296 | 32.844595 | 110 | 0.579653 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,402 | manager.py | jumpserver_jumpserver/apps/assets/automations/gather_facts/manager.py | from assets.const import AutomationTypes
from common.utils import get_logger
from .format_asset_info import FormatAssetInfo
from ..base.manager import BasePlaybookManager
logger = get_logger(__name__)
class GatherFactsManager(BasePlaybookManager):
def __init__(self, *args, **kwargs):
super().__init__(*ar... | 1,206 | Python | .py | 28 | 35.821429 | 72 | 0.65158 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,403 | format_asset_info.py | jumpserver_jumpserver/apps/assets/automations/gather_facts/format_asset_info.py | __all__ = ['FormatAssetInfo']
class FormatAssetInfo:
def __init__(self, tp):
self.tp = tp
@staticmethod
def posix_format(info):
for cpu_model in info.get('cpu_model', []):
if cpu_model.endswith('GHz') or cpu_model.startswith("Intel"):
break
else:
... | 1,015 | Python | .py | 27 | 27.851852 | 74 | 0.544898 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,404 | asset.py | jumpserver_jumpserver/apps/assets/signal_handlers/asset.py | # -*- coding: utf-8 -*-
#
from django.db.models.signals import (
m2m_changed, pre_delete, post_delete, pre_save, post_save
)
from django.dispatch import receiver
from django.utils.translation import gettext_noop
from assets.models import Asset, Node, Host, Database, Device, Web, Cloud
from assets.tasks import test... | 3,996 | Python | .py | 88 | 39.715909 | 94 | 0.70944 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,405 | node_assets_mapping.py | jumpserver_jumpserver/apps/assets/signal_handlers/node_assets_mapping.py | # -*- coding: utf-8 -*-
#
from django.db.models.signals import (
post_save, post_delete, m2m_changed
)
from django.dispatch import receiver
from django.utils.functional import lazy
from assets.models import Node, Asset
from common.decorators import merge_delay_run
from common.signals import django_ready
from comm... | 2,370 | Python | .py | 53 | 39.735849 | 95 | 0.726348 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,406 | node_assets_amount.py | jumpserver_jumpserver/apps/assets/signal_handlers/node_assets_amount.py | # -*- coding: utf-8 -*-
#
from operator import add, sub
from django.conf import settings
from django.db.models.signals import m2m_changed
from django.dispatch import receiver
from assets.models import Asset, Node
from common.const.signals import PRE_CLEAR, POST_ADD, PRE_REMOVE
from common.decorators import on_transac... | 2,251 | Python | .py | 56 | 34.071429 | 80 | 0.700472 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,407 | __init__.py | jumpserver_jumpserver/apps/assets/signal_handlers/__init__.py | from .asset import *
from .node_assets_amount import *
from .node_assets_mapping import *
| 90 | Python | .py | 3 | 29 | 34 | 0.781609 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,408 | favorite_asset.py | jumpserver_jumpserver/apps/assets/serializers/favorite_asset.py | # -*- coding: utf-8 -*-
#
from rest_framework import serializers
from common.serializers import BulkSerializerMixin
from ..models import FavoriteAsset
__all__ = ['FavoriteAssetSerializer']
class FavoriteAssetSerializer(BulkSerializerMixin, serializers.ModelSerializer):
user = serializers.HiddenField(
d... | 448 | Python | .py | 13 | 30.230769 | 80 | 0.750583 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,409 | gateway.py | jumpserver_jumpserver/apps/assets/serializers/gateway.py | # -*- coding: utf-8 -*-
#
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from .asset.common import AccountSecretSerializer
from .asset.host import HostSerializer
from ..models import Gateway, Asset
__all__ = ['GatewaySerializer', 'GatewayWithAccountSecretSerializer']
c... | 1,197 | Python | .py | 27 | 38.259259 | 98 | 0.723514 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,410 | my_asset.py | jumpserver_jumpserver/apps/assets/serializers/my_asset.py | # -*- coding: utf-8 -*-
#
from rest_framework import serializers
from django.utils.translation import gettext_lazy as _
from ..models import MyAsset
__all__ = ['MyAssetSerializer']
class MyAssetSerializer(serializers.ModelSerializer):
user = serializers.HiddenField(
default=serializers.CurrentUserDefau... | 1,237 | Python | .py | 31 | 32.483871 | 112 | 0.649708 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,411 | domain.py | jumpserver_jumpserver/apps/assets/serializers/domain.py | # -*- coding: utf-8 -*-
#
from django.db.models import Count, Q
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from assets.models.gateway import Gateway
from common.serializers import ResourceLabelsMixin
from common.serializers.fields import ObjectRelatedField
from orgs.m... | 3,105 | Python | .py | 66 | 40.181818 | 114 | 0.686839 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,412 | cagegory.py | jumpserver_jumpserver/apps/assets/serializers/cagegory.py | from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
__all__ = [
'TypeSerializer', 'CategorySerializer', 'ProtocolSerializer'
]
class TypeSerializer(serializers.Serializer):
label = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Label'... | 1,224 | Python | .py | 17 | 68.235294 | 106 | 0.76 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,413 | __init__.py | jumpserver_jumpserver/apps/assets/serializers/__init__.py | # -*- coding: utf-8 -*-
#
from .asset import *
from .automations import *
from .cagegory import *
from .domain import *
from .favorite_asset import *
from .gateway import *
from .node import *
from .platform import *
from .my_asset import *
| 242 | Python | .py | 11 | 20.909091 | 29 | 0.734783 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,414 | platform.py | jumpserver_jumpserver/apps/assets/serializers/platform.py | from django.db.models import QuerySet
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from rest_framework.validators import UniqueValidator
from assets.models import Asset
from common.serializers import (
WritableNestedModelSerializer, type_field_map, MethodSerializer,... | 11,647 | Python | .py | 244 | 37.471311 | 119 | 0.613382 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,415 | node.py | jumpserver_jumpserver/apps/assets/serializers/node.py | # -*- coding: utf-8 -*-
from django.utils.translation import gettext as _
from rest_framework import serializers
from orgs.mixins.serializers import BulkOrgResourceModelSerializer
from ..models import Asset, Node
__all__ = [
'NodeSerializer', "NodeAddChildrenSerializer",
"NodeAssetsSerializer", "NodeTaskSeria... | 2,564 | Python | .py | 66 | 30.863636 | 80 | 0.644282 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,416 | base.py | jumpserver_jumpserver/apps/assets/serializers/automations/base.py | from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from assets.models import Asset, Node, BaseAutomation, AutomationExecution
from common.const.choices import Trigger
from common.serializers.fields import ObjectRelatedField, LabeledChoiceField
from common.utils import get_log... | 3,292 | Python | .py | 73 | 37.356164 | 101 | 0.665834 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,417 | device.py | jumpserver_jumpserver/apps/assets/serializers/asset/device.py |
from assets.models import Device
from .common import AssetSerializer
__all__ = ['DeviceSerializer']
class DeviceSerializer(AssetSerializer):
class Meta(AssetSerializer.Meta):
model = Device
| 206 | Python | .py | 6 | 30.666667 | 40 | 0.780612 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,418 | host.py | jumpserver_jumpserver/apps/assets/serializers/asset/host.py | from django.utils.translation import gettext_lazy as _
from assets.models import Host
from .common import AssetSerializer
from .info.gathered import HostGatheredInfoSerializer
__all__ = ['HostSerializer']
class HostSerializer(AssetSerializer):
gathered_info = HostGatheredInfoSerializer(required=False, read_only... | 640 | Python | .py | 16 | 32.9375 | 104 | 0.678514 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,419 | cloud.py | jumpserver_jumpserver/apps/assets/serializers/asset/cloud.py | from assets.models import Cloud
from .common import AssetSerializer
__all__ = ['CloudSerializer']
class CloudSerializer(AssetSerializer):
class Meta(AssetSerializer.Meta):
model = Cloud
fields = AssetSerializer.Meta.fields
extra_kwargs = {
**AssetSerializer.Meta.extra_kwargs,
... | 400 | Python | .py | 13 | 22.769231 | 48 | 0.614583 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,420 | __init__.py | jumpserver_jumpserver/apps/assets/serializers/asset/__init__.py | # No pass
from .cloud import *
from .common import *
from .custom import *
from .database import *
from .device import *
from .gpt import *
from .host import *
from .web import *
| 179 | Python | .py | 9 | 18.888889 | 23 | 0.747059 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,421 | custom.py | jumpserver_jumpserver/apps/assets/serializers/asset/custom.py | from django.db.models import QuerySet
from django.utils.translation import gettext_lazy as _
from assets.models import Custom, Platform, Asset
from common.const import UUID_PATTERN
from common.serializers import create_serializer_class
from common.serializers.common import DictSerializer, MethodSerializer
from .common... | 2,039 | Python | .py | 42 | 40.309524 | 91 | 0.679597 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,422 | database.py | jumpserver_jumpserver/apps/assets/serializers/asset/database.py | from django.db.models import QuerySet
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from assets.models import Database, Platform
from assets.serializers.gateway import GatewayWithAccountSecretSerializer
from .common import AssetSerializer
__all__ = ['DatabaseSerializer'... | 2,575 | Python | .py | 57 | 36.122807 | 96 | 0.642829 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,423 | web.py | jumpserver_jumpserver/apps/assets/serializers/asset/web.py | from assets.models import Web
from .common import AssetSerializer
__all__ = ['WebSerializer']
class WebSerializer(AssetSerializer):
class Meta(AssetSerializer.Meta):
model = Web
fields = AssetSerializer.Meta.fields + [
'autofill', 'username_selector',
'password_selector', ... | 805 | Python | .py | 26 | 20.153846 | 51 | 0.505155 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,424 | common.py | jumpserver_jumpserver/apps/assets/serializers/asset/common.py | # -*- coding: utf-8 -*-
#
from django.db.models import F
from django.db.transaction import atomic
from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from accounts.models import Account
from accounts.serializers import AccountSerializer
from common.const import UUID_PATTERN
f... | 18,693 | Python | .py | 422 | 34.988152 | 119 | 0.632983 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,425 | gpt.py | jumpserver_jumpserver/apps/assets/serializers/asset/gpt.py | from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from assets.models import GPT
from .common import AssetSerializer
__all__ = ['GPTSerializer']
class GPTSerializer(AssetSerializer):
class Meta(AssetSerializer.Meta):
model = GPT
fields = AssetSerializer... | 1,013 | Python | .py | 28 | 26 | 80 | 0.561224 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,426 | spec.py | jumpserver_jumpserver/apps/assets/serializers/asset/info/spec.py | from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
from assets.const import FillType
from assets.models import Database, Web
from common.serializers.fields import LabeledChoiceField
class DatabaseSpecSerializer(serializers.ModelSerializer):
class Meta:
model = D... | 1,744 | Python | .py | 46 | 29.543478 | 84 | 0.652669 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,427 | gathered.py | jumpserver_jumpserver/apps/assets/serializers/asset/info/gathered.py | from django.utils.translation import gettext_lazy as _
from rest_framework import serializers
class HostGatheredInfoSerializer(serializers.Serializer):
vendor = serializers.CharField(max_length=64, required=False, allow_blank=True, label=_('Vendor'))
model = serializers.CharField(max_length=54, required=False... | 1,528 | Python | .py | 18 | 80.722222 | 120 | 0.752159 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,428 | signals.py | jumpserver_jumpserver/apps/authentication/signals.py | from django.dispatch import Signal
post_auth_success = Signal()
post_auth_failed = Signal()
user_auth_success = Signal()
user_auth_failed = Signal()
| 151 | Python | .py | 5 | 28.8 | 34 | 0.777778 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,429 | filters.py | jumpserver_jumpserver/apps/authentication/filters.py | from rest_framework import filters
from rest_framework.compat import coreapi, coreschema
class AuthKeyQueryDeclaration(filters.BaseFilterBackend):
def get_schema_fields(self, view):
return [
coreapi.Field(
name='authkey', location='query', required=True, type='string',
... | 475 | Python | .py | 13 | 25.230769 | 79 | 0.586957 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,430 | mixins.py | jumpserver_jumpserver/apps/authentication/mixins.py | # -*- coding: utf-8 -*-
#
import inspect
import time
from functools import partial
from typing import Callable
from django.conf import settings
from django.contrib import auth
from django.contrib.auth import (
BACKEND_SESSION_KEY, load_backend,
PermissionDenied, user_login_failed, _clean_credentials,
)
from dj... | 19,995 | Python | .py | 452 | 34.557522 | 108 | 0.640891 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,431 | tasks.py | jumpserver_jumpserver/apps/authentication/tasks.py | # -*- coding: utf-8 -*-
#
from celery import shared_task
from django.contrib.sessions.models import Session
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from ops.celery.decorator import register_as_period_task
@shared_task(
verbose_name=_('Clean expired session'),
... | 588 | Python | .py | 16 | 34 | 101 | 0.764085 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,432 | const.py | jumpserver_jumpserver/apps/authentication/const.py | from django.db.models import TextChoices
from authentication.confirm import CONFIRM_BACKENDS
from .confirm import ConfirmMFA, ConfirmPassword, ConfirmReLogin
from .mfa import MFAOtp, MFASms, MFARadius, MFACustom
RSA_PRIVATE_KEY = 'rsa_private_key'
RSA_PUBLIC_KEY = 'rsa_public_key'
CONFIRM_BACKEND_MAP = {backend.name... | 1,274 | Python | .py | 30 | 36.766667 | 77 | 0.734413 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,433 | apps.py | jumpserver_jumpserver/apps/authentication/apps.py | from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class AuthenticationConfig(AppConfig):
name = 'authentication'
verbose_name = _('App Authentication')
def ready(self):
from . import signal_handlers # noqa
from . import tasks # noqa
from . ... | 373 | Python | .py | 10 | 31.6 | 54 | 0.694444 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,434 | utils.py | jumpserver_jumpserver/apps/authentication/utils.py | # -*- coding: utf-8 -*-
#
import ipaddress
from urllib.parse import urljoin, urlparse
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from audits.const import DEFAULT_CITY
from users.models import User
from audits.models import UserLoginLog
from common.utils import get_logger, ... | 2,158 | Python | .py | 58 | 31.931034 | 65 | 0.69316 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,435 | tests.py | jumpserver_jumpserver/apps/authentication/tests.py | from common.utils import gen_key_pair, rsa_decrypt, rsa_encrypt
def test_rsa_encrypt_decrypt(message='test-password-$%^&*'):
""" 测试加密/解密 """
print('Need to encrypt message: {}'.format(message))
rsa_private_key, rsa_public_key = gen_key_pair()
print('RSA public key: \n{}'.format(rsa_public_key))
pr... | 642 | Python | .py | 11 | 52.636364 | 71 | 0.704065 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,436 | middleware.py | jumpserver_jumpserver/apps/authentication/middleware.py | import base64
from django.conf import settings
from django.contrib.auth import logout as auth_logout
from django.core.cache import cache
from django.http import HttpResponse
from django.shortcuts import redirect, reverse, render
from django.utils.deprecation import MiddlewareMixin
from django.utils.translation import ... | 6,517 | Python | .py | 140 | 34.314286 | 105 | 0.622607 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,437 | permissions.py | jumpserver_jumpserver/apps/authentication/permissions.py | import time
from django.conf import settings
from rest_framework import permissions
from authentication.const import ConfirmType
from authentication.models import ConnectionToken
from common.exceptions import UserConfirmRequired
from common.permissions import IsValidUser
from common.utils import get_object_or_none
fr... | 2,005 | Python | .py | 47 | 35.212766 | 101 | 0.682075 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,438 | notifications.py | jumpserver_jumpserver/apps/authentication/notifications.py | from django.template.loader import render_to_string
from django.utils.translation import gettext as _
from common.utils import get_logger
from common.utils.timezone import local_now_display
from notifications.notifications import UserMessage
logger = get_logger(__file__)
class DifferentCityLoginMessage(UserMessage)... | 2,131 | Python | .py | 63 | 25.015873 | 86 | 0.584795 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,439 | forms.py | jumpserver_jumpserver/apps/authentication/forms.py | # -*- coding: utf-8 -*-
#
from captcha.fields import CaptchaField, CaptchaTextInput
from django import forms
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from common.utils import get_logger, decrypt_password
logger = get_logger(__name__)
class EncryptedField(forms.CharFiel... | 2,518 | Python | .py | 65 | 31.923077 | 79 | 0.669405 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,440 | signal_handlers.py | jumpserver_jumpserver/apps/authentication/signal_handlers.py | from django.conf import settings
from django.contrib.auth import user_logged_in, BACKEND_SESSION_KEY
from django.core.cache import cache
from django.dispatch import receiver
from django_cas_ng.signals import cas_user_authenticated
from apps.jumpserver.settings.auth import AUTHENTICATION_BACKENDS_THIRD_PARTY
from audit... | 2,635 | Python | .py | 47 | 48.851064 | 96 | 0.743156 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,441 | private_token.py | jumpserver_jumpserver/apps/authentication/models/private_token.py | from django.db import models
from django.utils.translation import gettext_lazy as _
from rest_framework.authtoken.models import Token
class PrivateToken(Token):
"""Inherit from auth token, otherwise migration is boring"""
date_last_used = models.DateTimeField(null=True, blank=True, verbose_name=_('Date last u... | 386 | Python | .py | 8 | 44.375 | 98 | 0.754667 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,442 | sso_token.py | jumpserver_jumpserver/apps/authentication/models/sso_token.py | import uuid
from django.db import models
from django.utils.translation import gettext_lazy as _
from common.db.models import BaseCreateUpdateModel, CASCADE_SIGNAL_SKIP
class SSOToken(BaseCreateUpdateModel):
"""
类似腾讯企业邮的 [单点登录](https://exmail.qq.com/qy_mng_logic/doc#10036)
出于安全考虑,这里的 `token` 使用一次随即过期。但我们... | 808 | Python | .py | 15 | 42.066667 | 97 | 0.71 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,443 | ssh_key.py | jumpserver_jumpserver/apps/authentication/models/ssh_key.py | import sshpubkeys
from django.db import models
from django.utils.translation import gettext_lazy as _
from common.db.models import JMSBaseModel, CASCADE_SIGNAL_SKIP
from users.models import AuthMixin
from common.db import fields
class SSHKey(JMSBaseModel, AuthMixin):
name = models.CharField(max_length=128, verb... | 952 | Python | .py | 22 | 38.409091 | 98 | 0.716757 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,444 | temp_token.py | jumpserver_jumpserver/apps/authentication/models/temp_token.py | from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from common.db.models import JMSBaseModel
class TempToken(JMSBaseModel):
username = models.CharField(max_length=128, verbose_name=_("Username"))
secret = models.CharField(max_length=64, verbo... | 944 | Python | .py | 20 | 41.9 | 84 | 0.729847 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,445 | __init__.py | jumpserver_jumpserver/apps/authentication/models/__init__.py | from .access_key import *
from .connection_token import *
from .private_token import *
from .ssh_key import *
from .sso_token import *
from .temp_token import *
from ..backends.passkey.models import *
| 201 | Python | .py | 7 | 27.714286 | 39 | 0.773196 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,446 | access_key.py | jumpserver_jumpserver/apps/authentication/models/access_key.py | import uuid
from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
import common.db.models
from common.utils.random import random_string
def default_secret():
return random_string(36)
def default_ip_group():
return ["*"]
class AccessKey(model... | 1,341 | Python | .py | 29 | 40.482759 | 107 | 0.707467 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,447 | connection_token.py | jumpserver_jumpserver/apps/authentication/models/connection_token.py | import base64
import json
from datetime import timedelta
from django.conf import settings
from django.core.cache import cache
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from rest_framework.exceptions import PermissionDenied
from accounts.model... | 10,237 | Python | .py | 236 | 34.470339 | 113 | 0.648632 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,448 | 0002_auto_20190729_1423.py | jumpserver_jumpserver/apps/authentication/migrations/0002_auto_20190729_1423.py | # Generated by Django 4.1.13 on 2024-05-09 03:16
import common.db.models
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('assets', '0002_auto_20180105_1807'),
m... | 2,872 | Python | .py | 63 | 35.222222 | 205 | 0.623261 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,449 | 0001_initial.py | jumpserver_jumpserver/apps/authentication/migrations/0001_initial.py | # Generated by Django 4.1.13 on 2024-05-09 03:16
import authentication.models.access_key
import authentication.models.connection_token
import common.db.fields
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = ... | 7,937 | Python | .py | 121 | 51.752066 | 153 | 0.603201 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,450 | 0003_sshkey.py | jumpserver_jumpserver/apps/authentication/migrations/0003_sshkey.py | # Generated by Django 4.1.13 on 2024-07-29 02:25
import common.db.fields
import common.db.models
from django.conf import settings
from django.db import migrations, models
import uuid
def migrate_user_public_and_private_key(apps, schema_editor):
user_model = apps.get_model('users', 'User')
users = user_model.... | 2,507 | Python | .py | 45 | 44.911111 | 119 | 0.631922 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,451 | slack.py | jumpserver_jumpserver/apps/authentication/views/slack.py | from urllib.parse import urlencode
from django.conf import settings
from django.http.response import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.views import View
from rest_framework.exceptions import APIException
from rest_framework.permissions import AllowAny, IsAuthentica... | 4,372 | Python | .py | 91 | 41.318681 | 97 | 0.706021 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,452 | feishu.py | jumpserver_jumpserver/apps/authentication/views/feishu.py | from urllib.parse import urlencode
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.views import View
from rest_framework.exceptions import APIException
from rest_framewo... | 4,641 | Python | .py | 104 | 37.855769 | 98 | 0.693401 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,453 | dingtalk.py | jumpserver_jumpserver/apps/authentication/views/dingtalk.py | from urllib.parse import urlencode
from django.conf import settings
from django.contrib.auth import logout as auth_logout
from django.db.utils import IntegrityError
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
f... | 9,200 | Python | .py | 199 | 37.477387 | 118 | 0.667938 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,454 | wecom.py | jumpserver_jumpserver/apps/authentication/views/wecom.py | from urllib.parse import urlencode
from django.conf import settings
from django.http.request import HttpRequest
from django.http.response import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.views import View
from rest_framework.exceptions import APIException
from rest_framewo... | 7,205 | Python | .py | 152 | 39.105263 | 109 | 0.674785 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,455 | mixins.py | jumpserver_jumpserver/apps/authentication/views/mixins.py | # -*- coding: utf-8 -*-
#
from django.utils.translation import gettext_lazy as _
from common.utils import FlashMessageUtil
class METAMixin:
def get_next_url_from_meta(self):
request_meta = self.request.META or {}
next_url = None
referer = request_meta.get('HTTP_REFERER', '')
next_u... | 1,675 | Python | .py | 36 | 38.638889 | 90 | 0.641937 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,456 | login.py | jumpserver_jumpserver/apps/authentication/views/login.py | # ~*~ coding: utf-8 ~*~
#
from __future__ import unicode_literals
import datetime
import os
from typing import Callable
from urllib.parse import urlparse
from django.conf import settings
from django.contrib.auth import BACKEND_SESSION_KEY
from django.contrib.auth import login as auth_login, logout as auth_logout
fro... | 15,608 | Python | .py | 365 | 31.819178 | 99 | 0.596164 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,457 | utils.py | jumpserver_jumpserver/apps/authentication/views/utils.py | # -*- coding: utf-8 -*-
#
from django.shortcuts import reverse, redirect
def redirect_to_guard_view(comment=''):
continue_url = reverse('authentication:login-guard') + '?_=' + comment
return redirect(continue_url)
| 224 | Python | .py | 6 | 34.666667 | 74 | 0.708333 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,458 | mfa.py | jumpserver_jumpserver/apps/authentication/views/mfa.py | # -*- coding: utf-8 -*-
#
from __future__ import unicode_literals
from django.views.generic.edit import FormView
from django.shortcuts import redirect
from common.utils import get_logger
from .. import forms, errors, mixins
from .utils import redirect_to_guard_view
logger = get_logger(__name__)
__all__ = ['UserLogin... | 1,977 | Python | .py | 48 | 33.020833 | 74 | 0.646322 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,459 | __init__.py | jumpserver_jumpserver/apps/authentication/views/__init__.py | # -*- coding: utf-8 -*-
#
from .dingtalk import *
from .feishu import *
from .lark import *
from .login import *
from .mfa import *
from .slack import *
from .wecom import *
| 174 | Python | .py | 9 | 18.333333 | 23 | 0.70303 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,460 | base.py | jumpserver_jumpserver/apps/authentication/views/base.py | from functools import lru_cache
from django.conf import settings
from django.contrib.auth import logout as auth_logout
from django.db.utils import IntegrityError
from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _
from django.views import View
from rest_framewor... | 5,764 | Python | .py | 128 | 35.671875 | 91 | 0.644524 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,461 | lark.py | jumpserver_jumpserver/apps/authentication/views/lark.py | from django.utils.translation import gettext_lazy as _
from common.sdk.im.lark import URL
from common.utils import get_logger
from .feishu import (
FeiShuEnableStartView, FeiShuQRBindView, FeiShuQRBindCallbackView,
FeiShuQRLoginView, FeiShuQRLoginCallbackView
)
logger = get_logger(__file__)
class LarkEnable... | 1,343 | Python | .py | 34 | 35.294118 | 74 | 0.745356 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,462 | __init__.py | jumpserver_jumpserver/apps/authentication/mfa/__init__.py | from .otp import MFAOtp, otp_failed_msg
from .sms import MFASms
from .radius import MFARadius
from .custom import MFACustom
| 124 | Python | .py | 4 | 30 | 39 | 0.833333 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,463 | base.py | jumpserver_jumpserver/apps/authentication/mfa/base.py | import abc
from django.utils.translation import gettext_lazy as _
class BaseMFA(abc.ABC):
placeholder = _('Please input security code')
def __init__(self, user):
"""
:param user: Authenticated user, Anonymous or None
因为首页登录时,可能没法获取到一些状态
"""
self.user = user
def ... | 1,414 | Python | .py | 53 | 19.415094 | 59 | 0.629119 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,464 | radius.py | jumpserver_jumpserver/apps/authentication/mfa/radius.py | from django.conf import settings
from django.utils.translation import gettext_lazy as _
from .base import BaseMFA
from ..backends.radius import RadiusBackend
mfa_failed_msg = _("Radius verify code invalid")
class MFARadius(BaseMFA):
name = 'otp_radius'
display_name = 'Radius'
placeholder = _("Radius ver... | 1,117 | Python | .py | 35 | 25.314286 | 57 | 0.650467 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,465 | sms.py | jumpserver_jumpserver/apps/authentication/mfa/sms.py | from django.conf import settings
from django.utils.translation import gettext_lazy as _
from common.utils.verify_code import SendAndVerifyCodeUtil
from .base import BaseMFA
sms_failed_msg = _("SMS verify code invalid")
class MFASms(BaseMFA):
name = 'sms'
display_name = _("SMS")
placeholder = _("SMS veri... | 1,572 | Python | .py | 48 | 25.75 | 66 | 0.630637 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,466 | otp.py | jumpserver_jumpserver/apps/authentication/mfa/otp.py | from django.utils.translation import gettext_lazy as _
from django.shortcuts import reverse
from .base import BaseMFA
otp_failed_msg = _("OTP code invalid, or server time error")
class MFAOtp(BaseMFA):
name = 'otp'
display_name = _('OTP')
placeholder = _('OTP verification code')
def check_code(sel... | 1,291 | Python | .py | 36 | 28.972222 | 62 | 0.65456 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,467 | custom.py | jumpserver_jumpserver/apps/authentication/mfa/custom.py | from django.conf import settings
from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _
from common.utils import get_logger
from .base import BaseMFA
logger = get_logger(__file__)
mfa_custom_method = None
if settings.MFA_CUSTOM:
""" 保证自定义的方法在服务运行时不能被更改,只在第一次... | 1,645 | Python | .py | 44 | 29.681818 | 91 | 0.670828 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,468 | api_urls.py | jumpserver_jumpserver/apps/authentication/urls/api_urls.py | # coding:utf-8
#
from django.urls import path
from rest_framework.routers import DefaultRouter
from .. import api
from ..backends.passkey.urls import urlpatterns as passkey_urlpatterns
app_name = 'authentication'
router = DefaultRouter()
router.register('access-keys', api.AccessKeyViewSet, 'access-key')
router.regist... | 2,235 | Python | .py | 35 | 60.428571 | 115 | 0.746466 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,469 | view_urls.py | jumpserver_jumpserver/apps/authentication/urls/view_urls.py | # coding:utf-8
#
from django.db.transaction import non_atomic_requests
from django.urls import path, include
from users import views as users_view
from .. import views
app_name = 'authentication'
urlpatterns = [
# login
path('login/', non_atomic_requests(views.UserLoginView.as_view()), name='login'),
pa... | 5,282 | Python | .py | 69 | 71.289855 | 120 | 0.723646 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,470 | password.py | jumpserver_jumpserver/apps/authentication/api/password.py | import time
from django.core.cache import cache
from django.http import HttpResponseRedirect
from django.shortcuts import reverse
from django.template.loader import render_to_string
from django.utils.translation import gettext as _
from rest_framework.generics import CreateAPIView
from rest_framework.permissions impor... | 4,118 | Python | .py | 88 | 39.340909 | 99 | 0.69133 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,471 | feishu.py | jumpserver_jumpserver/apps/authentication/api/feishu.py | from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from common.permissions import IsValidUser
from common.utils import get_logger
logger = get_logger(__name__)
class FeiShuEventSubscriptionCallback(APIView):
"""
# https://open.fe... | 514 | Python | .py | 13 | 35.923077 | 67 | 0.779798 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,472 | ssh_key.py | jumpserver_jumpserver/apps/authentication/api/ssh_key.py | from common.api import JMSModelViewSet
from common.permissions import IsValidUser
from ..serializers import SSHKeySerializer
from users.notifications import ResetPublicKeySuccessMsg
class SSHkeyViewSet(JMSModelViewSet):
serializer_class = SSHKeySerializer
permission_classes = [IsValidUser]
filterset_field... | 673 | Python | .py | 15 | 40.133333 | 81 | 0.75841 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,473 | temp_token.py | jumpserver_jumpserver/apps/authentication/api/temp_token.py | from django.utils import timezone
from rest_framework.response import Response
from rest_framework.decorators import action
from rbac.permissions import RBACPermission
from common.api import JMSModelViewSet
from ..models import TempToken
from ..serializers import TempTokenSerializer
class TempTokenViewSet(JMSModelVi... | 1,014 | Python | .py | 24 | 37.041667 | 84 | 0.736041 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,474 | token.py | jumpserver_jumpserver/apps/authentication/api/token.py | # -*- coding: utf-8 -*-
#
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.generics import CreateAPIView
from common.utils import get_logger
from .. import serializers, errors
from ..mixins import AuthMixin
logger = get_logger(__name__)
__all__ = ['To... | 1,669 | Python | .py | 38 | 35.315789 | 81 | 0.669385 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,475 | mfa.py | jumpserver_jumpserver/apps/authentication/api/mfa.py | # -*- coding: utf-8 -*-
#
from django.shortcuts import get_object_or_404
from django.utils.translation import gettext as _
from rest_framework import exceptions
from rest_framework.generics import CreateAPIView
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_frame... | 3,304 | Python | .py | 84 | 31.190476 | 79 | 0.657043 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,476 | sso.py | jumpserver_jumpserver/apps/authentication/api/sso.py | from urllib.parse import urlencode
from uuid import UUID
from django.conf import settings
from django.contrib.auth import login
from django.http.response import HttpResponseRedirect
from rest_framework import serializers
from rest_framework import status
from rest_framework.decorators import action
from rest_framework... | 4,898 | Python | .py | 107 | 37.018692 | 114 | 0.681169 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,477 | __init__.py | jumpserver_jumpserver/apps/authentication/api/__init__.py | # -*- coding: utf-8 -*-
#
from .access_key import *
from .common import *
from .confirm import *
from .connection_token import *
from .feishu import *
from .lark import *
from .login_confirm import *
from .mfa import *
from .password import *
from .session import *
from .ssh_key import *
from .sso import *
from .temp_... | 356 | Python | .py | 16 | 21.1875 | 31 | 0.737463 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,478 | confirm.py | jumpserver_jumpserver/apps/authentication/api/confirm.py | # -*- coding: utf-8 -*-
#
import time
from django.utils.translation import gettext_lazy as _
from rest_framework import status
from rest_framework.decorators import action
from rest_framework.generics import RetrieveAPIView
from rest_framework.response import Response
from authentication.permissions import UserConfir... | 2,755 | Python | .py | 60 | 38.416667 | 89 | 0.691533 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,479 | lark.py | jumpserver_jumpserver/apps/authentication/api/lark.py | from common.utils import get_logger
from .feishu import FeiShuEventSubscriptionCallback
logger = get_logger(__name__)
class LarkEventSubscriptionCallback(FeiShuEventSubscriptionCallback):
pass
| 200 | Python | .py | 5 | 37.6 | 69 | 0.859375 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,480 | access_key.py | jumpserver_jumpserver/apps/authentication/api/access_key.py | # -*- coding: utf-8 -*-
#
from django.utils.translation import gettext as _
from rest_framework import serializers
from rest_framework.response import Response
from common.api import JMSModelViewSet
from rbac.permissions import RBACPermission
from ..const import ConfirmType
from ..permissions import UserConfirmation
... | 1,609 | Python | .py | 39 | 34.487179 | 89 | 0.702114 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,481 | common.py | jumpserver_jumpserver/apps/authentication/api/common.py | from django.utils.translation import gettext_lazy as _
from rest_framework.request import Request
from rest_framework.response import Response
from rest_framework.views import APIView
from authentication import errors
from authentication.const import ConfirmType
from authentication.permissions import UserConfirmation
... | 1,897 | Python | .py | 39 | 42.102564 | 95 | 0.702059 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,482 | connection_token.py | jumpserver_jumpserver/apps/authentication/api/connection_token.py | import base64
import json
import os
import urllib.parse
from django.conf import settings
from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from rest_framework import status, serializers
from rest_... | 23,542 | Python | .py | 511 | 35.896282 | 117 | 0.623775 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,483 | session.py | jumpserver_jumpserver/apps/authentication/api/session.py | import time
from threading import Thread
from django.conf import settings
from django.contrib.auth import logout
from django.contrib.auth.models import AnonymousUser
from rest_framework import generics
from rest_framework import status
from rest_framework.response import Response
from common.sessions.cache import use... | 2,179 | Python | .py | 49 | 37.122449 | 83 | 0.70109 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,484 | login_confirm.py | jumpserver_jumpserver/apps/authentication/api/login_confirm.py | # -*- coding: utf-8 -*-
#
from django.contrib.auth import logout as auth_logout
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.views import APIView
from common.utils import get_logger
from .. import errors, mixins
__all__ = ['TicketStatusApi']
logger ... | 1,505 | Python | .py | 35 | 34.142857 | 82 | 0.643902 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,485 | access_key.py | jumpserver_jumpserver/apps/authentication/tests/access_key.py | # Python 示例
# pip install requests drf-httpsig
import datetime
import json
import requests
from httpsig.requests_auth import HTTPSignatureAuth
def get_auth(KeyID, SecretID):
signature_headers = ['(request-target)', 'accept', 'date']
auth = HTTPSignatureAuth(key_id=KeyID, secret=SecretID, algorithm='hmac-sha2... | 1,026 | Python | .py | 26 | 34.923077 | 111 | 0.691296 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,486 | failed.py | jumpserver_jumpserver/apps/authentication/errors/failed.py | # -*- coding: utf-8 -*-
#
from django.conf import settings
from django.utils.translation import gettext_lazy as _
from users.utils import LoginBlockUtil, MFABlockUtils, LoginIpBlockUtil
from . import const
from ..signals import post_auth_failed
class AuthFailedNeedLogMixin:
username = ''
request = None
e... | 4,791 | Python | .py | 121 | 32.107438 | 93 | 0.649337 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,487 | const.py | jumpserver_jumpserver/apps/authentication/errors/const.py | from django.utils.translation import gettext_lazy as _
reason_password_failed = 'password_failed'
reason_password_decrypt_failed = 'password_decrypt_failed'
reason_mfa_failed = 'mfa_failed'
reason_mfa_unset = 'mfa_unset'
reason_user_not_exist = 'user_not_exist'
reason_password_expired = 'password_expired'
reason_user... | 2,592 | Python | .py | 63 | 38.174603 | 71 | 0.708911 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,488 | redirect.py | jumpserver_jumpserver/apps/authentication/errors/redirect.py | from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from common.exceptions import JMSException
from . import const
class NeedMoreInfoError(Exception):
error = ''
msg = ''
def __init__(self, error='', msg=''):
if error:
self.error = error
if ... | 2,953 | Python | .py | 80 | 29.4125 | 84 | 0.611052 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,489 | mfa.py | jumpserver_jumpserver/apps/authentication/errors/mfa.py | from django.utils.translation import gettext_lazy as _
from common.exceptions import JMSException
class SSOAuthClosed(JMSException):
default_code = 'sso_auth_closed'
default_detail = _('SSO auth closed')
class WeComCodeInvalid(JMSException):
default_code = 'wecom_code_invalid'
default_detail = 'Cod... | 1,489 | Python | .py | 34 | 39.441176 | 80 | 0.729937 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,490 | __init__.py | jumpserver_jumpserver/apps/authentication/errors/__init__.py | from .const import *
from .mfa import *
from .failed import *
from .redirect import *
| 86 | Python | .py | 4 | 20.5 | 23 | 0.756098 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,491 | drf.py | jumpserver_jumpserver/apps/authentication/backends/drf.py | # -*- coding: utf-8 -*-
#
from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.utils import timezone
from django.utils.translation import gettext as _
from rest_framework import authentication, exceptions
from common.auth import signature
from common.decorators import merge_d... | 5,174 | Python | .py | 116 | 36.672414 | 101 | 0.675487 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,492 | ldap.py | jumpserver_jumpserver/apps/authentication/backends/ldap.py | # coding:utf-8
#
import abc
import ldap
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django_auth_ldap.backend import _LDAPUser, LDAPBackend
from django_auth_ldap.config import _LDAPConfig, LDAPSearch, LDAPSearchUnion
from users.utils import construct... | 7,818 | Python | .py | 187 | 31.283422 | 95 | 0.610183 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,493 | token.py | jumpserver_jumpserver/apps/authentication/backends/token.py | from django.utils import timezone
from django.conf import settings
from django.core.exceptions import PermissionDenied
from authentication.models import TempToken
from .base import JMSModelBackend
class TempTokenAuthBackend(JMSModelBackend):
model = TempToken
def authenticate(self, request, username='', pas... | 812 | Python | .py | 20 | 34.1 | 96 | 0.715013 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,494 | sso.py | jumpserver_jumpserver/apps/authentication/backends/sso.py | from django.conf import settings
from .base import JMSModelBackend
class SSOAuthentication(JMSModelBackend):
"""
什么也��呀😺
"""
@staticmethod
def is_enabled():
return settings.AUTH_SSO
def authenticate(self, request, sso_token=None, **kwargs):
pass
class WeComA... | 1,505 | Python | .py | 57 | 20.736842 | 62 | 0.663854 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,495 | base.py | jumpserver_jumpserver/apps/authentication/backends/base.py | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth import get_user_model
from users.models import User
from common.utils import get_logger
UserModel = get_user_model()
logger = get_logger(__file__)
class JMSBaseAuthBackend:
@staticmethod
def is_enabled():
return True
... | 1,883 | Python | .py | 44 | 33.863636 | 87 | 0.668927 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,496 | pubkey.py | jumpserver_jumpserver/apps/authentication/backends/pubkey.py | # -*- coding: utf-8 -*-
#
from django.conf import settings
from django.contrib.auth import get_user_model
from common.permissions import ServiceAccountSignaturePermission
from .base import JMSBaseAuthBackend
UserModel = get_user_model()
__all__ = ['PublicKeyAuthBackend']
class PublicKeyAuthBackend(JMSBaseAuthBacke... | 1,313 | Python | .py | 34 | 30.441176 | 78 | 0.669552 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,497 | custom.py | jumpserver_jumpserver/apps/authentication/backends/custom.py | from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils.module_loading import import_string
from django.utils.translation import gettext_lazy as _
from authentication.signals import user_auth_failed, user_auth_success
from common.utils import get_logger
from .base import JMSMo... | 2,431 | Python | .py | 52 | 36.519231 | 91 | 0.663917 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,498 | models.py | jumpserver_jumpserver/apps/authentication/backends/passkey/models.py | from django.conf import settings
from django.db import models
from django.utils.translation import gettext_lazy as _
from common.db.models import JMSBaseModel
class Passkey(JMSBaseModel):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
name = models.CharField(max_length=255, verb... | 931 | Python | .py | 15 | 57.866667 | 110 | 0.739035 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |
40,499 | serializer.py | jumpserver_jumpserver/apps/authentication/backends/passkey/serializer.py | from rest_framework import serializers
from .models import Passkey
class PasskeySerializer(serializers.ModelSerializer):
class Meta:
model = Passkey
fields = [
'id', 'name', 'is_active', 'platform', 'created_by',
'date_last_used', 'date_created',
]
read_onl... | 365 | Python | .py | 10 | 29.2 | 64 | 0.627841 | jumpserver/jumpserver | 25,048 | 5,291 | 48 | GPL-3.0 | 9/5/2024, 5:15:46 PM (Europe/Amsterdam) |