text stringlengths 0 9.3M |
|---|
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import argparse
import os
import sys
CUCKOO_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
sys.path.append(CUCKOO_ROOT)
from li... |
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import shutil
import sys
import zipfile
from contextlib import suppress
if sys.version_info[:2] < (3, 8):
sys.exit... |
# Just add path inside of the list. Ex: "signatures/my_amazing_signature.py"
blocklist = {
"feeds": [],
"signatures": [],
"processing": [],
"reporting": [],
"machinery": [],
"analyzer": [],
"data": [],
}
|
# encoding: utf-8
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# https://github.com/cuckoosandbox/cuckoo/pull/1694/files
import argparse
import distutils.util
import hashlib
... |
#!/usr/bin/python
import os
import subprocess
if __name__ == "__main__":
config_name = os.environ.get("config")
local_ip = os.environ.get("ifconfig_local")
vpn_gateway = os.environ.get("route_vpn_gateway")
dev = os.environ.get("dev")
ip_table = dev[3:]
print("ip rule del from {} table {}".form... |
#!/usr/bin/env python
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# This is auxiliar module for dist.py to add entries to /etc/fstab for new instances
import argparse
import errno
import grp
imp... |
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import argparse
import gc
import json
import logging
import os
import platform
import resource
import signal
import sys
import tim... |
import time
from dataclasses import dataclass, field
@dataclass
class Counter:
"""Profiler that counts real and CPU time."""
real: float = field(default_factory=time.perf_counter)
cpu: float = field(default_factory=time.process_time)
def __sub__(self, other):
real = self.real - other.real
... |
import os
import sys
from contextlib import suppress
# ToDo crudini to write conf directly
try:
import requests
from socks5man.exceptions import Socks5CreationError
from socks5man.manager import Manager
# first run socks5man to generate /home/cape/.socks5man on each server
# You will need to dist... |
#!/usr/bin/env python
# Copyright (C) 2014-2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import argparse
import errno
import grp
import ipaddress
import json
import logging.handlers
import os
import signal
import socke... |
#!/usr/bin/python
"""
Aux script for VPN setup
Get a look on utils/vpn2cape.py
Example:
/etc/iproute2/rt_tables
5 host1
6 host2
7 host3
conf/routing.conf
[vpn5]
name = X.ovpn
description = X
interface = tunX
rt_table = host1
"""
import os
impor... |
import argparse
import logging
import os
import sys
CAPE_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
sys.path.append(CAPE_ROOT)
from lib.cuckoo.common.config import Config
from lib.cuckoo.common.exceptions import CuckooCriticalError, CuckooNetworkError
from lib.cuckoo.core.rooter import _loa... |
import argparse
import os
import sys
CUCKOO_ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")
sys.path.append(CUCKOO_ROOT)
from lib.cuckoo.common.config import Config
from lib.cuckoo.common.path_utils import path_exists
from lib.cuckoo.core.database import Database, init_database
repconf = Config... |
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import argparse
import fnmatch
import logging
import os
import random
import sys
try:
import requests
HAVE_REQUESTS = T... |
#!/usr/bin/python
# Copyright 2015 Optiv, Inc. (brad.spengler@optiv.com)
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
import time
iface = ""
for idx, arg in enumerate(sys.argv):
if arg == "-i" and idx < len(sys.arg... |
import os
import re
from dataclasses import dataclass
from typing import ClassVar
@dataclass()
class TLS12KeyLog:
"""TLS 1.2 key log."""
# The type of secret that is being conveyed. TLS 1.2 and earlier
# uses the label "CLIENT_RANDOM" to identify the "master" secret
# for the connection.
LOG_LABE... |
import argparse
import os
import re
#
# VPN integrator for CAPE
# Quick and Dirty script by doomedraven to prepare configs for vpn integration
def main(folder, port):
idx_start = 1000
rt_table = {}
templates = []
paths = []
vpns = []
template = """
[vpn_{id}]
name = {vpn_path}
description... |
#!/usr/bin/env python
# Copyright (C) 2016 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import argparse
import fcntl
import os
import socket
import struct
import sys
sys.path.append(os.path.join(os.path.abspath(os.path.di... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os.path
import sys
from logging.config import fileConfig
from alembic import context
from sqlalchemy import create_engine, pool
# This is the ... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Add ON DELETE CASCADE to tasks_tags foreign keys
Revision ID: 4e000e02a409
Revises:
Create Date: 2025-04-11 09:58:42.957359
"""
# revision identi... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '2b3c4d5e6f7g'
down_revision = '4e000e02a409'
branc... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""add_platform_column_for_guests
Revision ID: 3a1c6c03844b
Revises: None
Create Date: 2024-03-07 16:11:55.712298
"""
# revision identifiers, used b... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Set guest.platform to non-nullable
Revision ID: c2bd0eb5e69d
Revises: 3a1c6c03844b
Create Date: 2024-04-09 16:03:58.751378
"""
# revision identif... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2.2-cape
Revision ID: c554ed5f32a0
Revises: 2996ec5ea15c
Create Date: 2020-11-19 15:14:27.973963
"""
# revision identifiers, used by Alembic.
rev... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2.3.1_square_hammer
Revision ID: 703266a6bbc5
Revises: 6ab863a3b510
Create Date: 2021-05-02 18:24:43.075702
"""
from contextlib import suppress
... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2_3_2_custom_auth_usernames
Revision ID: 6dc79a3ee6e4
Revises: 703266a6bbc5
Create Date: 2021-06-17 08:01:32.057197
"""
# revision identifiers, u... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""add arch to machine config
Revision ID: 8537286ff4d5
Revises: 6dc79a3ee6e4
Create Date: 2021-11-04 13:41:08.438214
"""
# revision identifiers, us... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2.3.3 expand error message
Revision ID: 02af0b0ec686
Revises: 8537286ff4d5
Create Date: 2022-07-28 18:46:00.169029
"""
# revision identifiers, us... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2.3_task2user_id
Revision ID: 6ab863a3b510
Revises: c554ed5f32a0
Create Date: 2021-02-02 07:28:09.576652
"""
# revision identifiers, used by Alem... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""2_4_0_change_options_to_text
Revision ID: a8441ab0fd0f
Revises: d6aa5d949b70
Create Date: 2023-02-24 16:59:10.667367
"""
# revision identifiers, ... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# https://stackoverflow.com/questions/14845203/altering-an-enum-field-using-alembic
# https://www.pythoncentral.io/migrate-sqlalchemy-databases-alembic... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Add 'reserved' column for machines
Revision ID: d6aa5d949b70
Revises: 02af0b0ec686
Create Date: 2023-02-15 17:10:41.338499
"""
# revision identif... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
# https://www.pythoncentral.io/migrate-sqlalchemy-databases-alembic/
"""add_sample_parent
Revision ID: 36926b59dfbb
Revises: 3c8bf4133b44
Create Date... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Add shrike and Parent ID Columns
Revision ID: f111620bb8
Revises: 4b09c454108c
Create Date: 2015-03-29 08:43:11.468664
"""
# revision identifiers... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""add_source_url
Revision ID: 2996ec5ea15c
Revises: 7331c4d994fd
Create Date: 2020-06-24 08:41:33.661473
"""
# revision identifiers, used by Alembi... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""add_task_tlp
Revision ID: 7331c4d994fd
Revises: 30d0230de7cd
Create Date: 2020-04-10 12:17:18.530901
"""
# revision identifiers, used by Alembic.... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Database migration from Cuckoo 0.6 to Cuckoo 1.1.
Revision ID: 263a45963c72
Revises: None
Create Date: 2014-03-23 23:30:36.756792
"""
# Revision ... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Database migration from Cuckoo 1.1 to Cuckoo 1.2.
Added failed statuses to tasks.
Revision ID: 495d5a6edef3
Revises: 18eee46c6f81
Create Date: 2015-... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Database migration from Cuckoo 0.6 to Cuckoo 1.1.
Extend sample's file-type field.
Revision ID: 18eee46c6f81
Revises: 263a45963c72
Create Date: 201... |
# Copyright (C) 2015 Optiv, Inc. (brad.spengler@optiv.com), KillerInstinct, Cuckoo Foundation
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""add statistics
Revision ID: 4b09c454108c
Revises: 495d5a6edef3
Create Date: 2015-03-05 07:39:21.03... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""options_255_to_1014
Revision ID: 30d0230de7cd
Revises: e4954d358c80
Create Date: 2019-10-11 11:00:31.364356
"""
# revision identifiers, used by A... |
# Copyright (C) 2016 Brad Spengler
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""Proper indexing
Revision ID: 3c8bf4133b44
Revises: f111620bb8
Create Date: 2016-05-13 11:04:41.685468
"""
# revision identifiers, used by Alembic.
import s... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
from logging.config import fileConfig
from alembic import context
from sqlalchemy import create_engine, pool
# This is the Alemb... |
#!/usr/bin/env python
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "web.settings")
from dj... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from django import forms
from submission.models import Comment, Tag
class CommentForm(forms.ModelForm):
class Meta:
model = Comment
... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
from django.urls import re_path
from analysis import views
urlpatterns = [
re_path(r"^$", views.index, name="analysis"),
re_path(r"^page/(?P<... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import base64
import collections
import datetime
import json
import os
import subprocess
import sys
import tempfile
import zipfile
from contextlib impo... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
|
import os
from io import StringIO
try:
import re2 as re
except ImportError:
import re
from collections import OrderedDict
from uuid import NAMESPACE_DNS, uuid3
from django.template.defaultfilters import register
from django.utils.html import escape
from django.utils.safestring import mark_safe
@register.fi... |
from collections import deque
from django.template.defaultfilters import register
from lib.cuckoo.common.utils import convert_to_printable
@register.filter("endswith")
def endswith(value, thestr):
return value.endswith(thestr)
@register.filter("proctreetolist")
def proctreetolist(tree):
outlist = []
i... |
from django import template
register = template.Library()
@register.filter(name="getkey")
def getkey(mapping, value):
if isinstance(mapping, dict):
return mapping.get(value, "")
@register.filter(name="gettype")
def gettype(value):
return str(type(value))
@register.filter(name="str2list")
def str2... |
from django import template
register = template.Library()
@register.filter(name="datefmt")
def datefmt(value):
formatted = (
value[2:6]
+ "/"
+ value[6:8]
+ "/"
+ value[8:10]
+ " "
+ value[10:12]
+ ":"
+ value[12:14]
+ ":"
+ ... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
|
from rest_framework.throttling import UserRateThrottle
# https://www.django-rest-framework.org/api-guide/throttling/
# https://dev.to/mattschwartz/how-to-add-subscription-based-throttling-to-a-django-api-28j0
# For function-based views you can use the decorator: @throttle_classes([UserRateThrottle])
# ToDo set cache
... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
# from django.conf.urls import include
from django.urls import path, re_path
from rest_framework.authtoken.views import obtain_auth_token
from apiv2 i... |
# encoding: utf-8
import hashlib
import json
import logging
import os
import socket
import subprocess
import sys
import zipfile
from datetime import datetime, timedelta
from io import BytesIO
from urllib.parse import quote
from wsgiref.util import FileWrapper
import pyzipper
import requests
from bson.objectid import O... |
from django.contrib import admin
from .forms import AdminAuthenticationForm
from .mixins import AdminSiteRegistryFix
class AdminSite(admin.AdminSite, AdminSiteRegistryFix):
login_form = AdminAuthenticationForm
login_template = "admin/captcha_login.html"
site = AdminSite()
admin.site = site
|
from django.contrib.admin.apps import AdminConfig as _AdminConfig
class AdminConfig(_AdminConfig):
"""
Inherit Django AdminConfig. We want the autodiscover feature. Do not define your default_site according to the
Django docs. Otherwise, we will end up with a recursive import error when loading this modul... |
from captcha.fields import ReCaptchaField
from captcha.widgets import ReCaptchaV3
from django.contrib.admin.forms import AdminAuthenticationForm as _AdminAuthenticationForm
class AdminAuthenticationForm(_AdminAuthenticationForm):
captcha = ReCaptchaField(widget=ReCaptchaV3)
|
from django.contrib.admin.sites import site as default_site
class AdminSiteRegistryFix:
"""
This fix links the '_registry' property to the original AdminSites
'_registry' property. This is necessary, because of the character of
the admins 'autodiscover' function. Otherwise the admin site will say,
... |
VERSION = (1, 0, 0, "final", 0)
__author__ = "Daniel Barreto"
__license__ = "MIT"
__maintainer__ = "Micah Mangione"
__email__ = "micah@connectio.us"
__status__ = "RC"
def get_version(version=VERSION):
"Returns a PEP 386-compliant version number from VERSION."
if version is None:
return "0.0"
else:... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
from django.urls import re_path
from compare import views
urlpatterns = [
re_path(r"^(?P<left_id>\d+)/$", views.left, name="compare_left"),
r... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import sys
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
|
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file "docs/LICENSE" for copying permission.
from django.urls import re_path
from dashboard import views
urlpatterns = [
re_path(r"^$", views.index),
]
|
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import sys
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
from django.... |
import asyncio
import logging
import urllib.parse
from asgiref.sync import sync_to_async
from channels.generic.websocket import AsyncWebsocketConsumer
from guacamole.client import GuacamoleClient
from lib.cuckoo.common.config import Config
logger = logging.getLogger("guac-session")
web_cfg = Config("web")
class Gu... |
from django.urls import re_path
from .consumers import GuacamoleWebSocketConsumer
websocket_urlpatterns = [
re_path(
r"guac/websocket-tunnel/(?P<session_id>\w+)",
GuacamoleWebSocketConsumer.as_asgi(),
),
]
|
from django.urls import re_path
from guac import views
urlpatterns = [
re_path(r"^(?P<task_id>\d+)/(?P<session_data>[\w=]+)/$", views.index, name="index"),
]
|
from base64 import urlsafe_b64decode
from xml.etree import ElementTree as ET
from django.shortcuts import render
from lib.cuckoo.common.config import Config
try:
import libvirt
LIBVIRT_AVAILABLE = True
except ImportError:
print("Missed python-libvirt. Use extra/libvirt_installer.sh")
LIBVIRT_AVAILABLE... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from django.urls import re_path
from submission import views
urlpatterns = [
re_path(r"^$", views.index, name="submission"),
re_path(r"^resub... |
# encoding: utf-8
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import ast
import logging
import os
import random
import sys
import tempfile
import textwrap
from base64 import urlsafe_b64encode
fro... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
|
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from .models import UserProfile
# Django 3.2
# @admin.action(description='Mark selected stories as published')
def make_active(modeladmin, news, queryset):
queryset.update(is_active=True)
... |
from django.apps import AppConfig
class UsersConfig(AppConfig):
name = "users"
|
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
subscription = models.CharField(max_length=50, default="5/m"... |
# Create your tests here.
|
# Create your views here.
|
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
... |
# Generated by Django 4.1 on 2022-11-24 08:39
# https://realpython.com/django-migrations-a-primer/
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="use... |
from django.db import connection, migrations
def migrate(apps, schema_editor):
with schema_editor.connection.cursor() as cursor:
if connection.vendor == "postgresql":
cursor.execute("SELECT column_name FROM information_schema.columns WHERE table_name = 'users_userprofile';")
elif conne... |
from allauth.account.adapter import DefaultAccountAdapter
from allauth.socialaccount.adapter import DefaultSocialAccountAdapter
from allauth.account.signals import email_confirmed, user_signed_up
from django import forms
from django.conf import settings
from django.contrib.auth.models import User
from django.dispatch i... |
from django import forms
from django_recaptcha.fields import ReCaptchaField
from django_recaptcha.widgets import ReCaptchaV2Checkbox
class CaptchedSignUpForm(forms.Form):
captcha = ReCaptchaField(widget=ReCaptchaV2Checkbox)
def signup(self, request, user):
pass
|
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""
ASGI config for web project.
Please read https://channels.readthedocs.io/en/latest/deploying.html#nginx-supervisor-ubuntu
"""
import sys
# These ... |
import logging.config
import os
import sys
from pathlib import Path
from django.utils.log import DEFAULT_LOGGING
CUCKOO_PATH = os.path.join(Path.cwd(), "..")
sys.path.append(CUCKOO_PATH)
# Build paths inside the project like this: BASE_DIR / "subdir".
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start ... |
from django.conf import settings
from django.conf.urls.static import static
from django.urls import include, re_path
urlpatterns = [
re_path(r"^guac/", include("guac.urls")),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
|
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import sys
from contextlib import suppress
from django.conf import settings
with suppress(Exception):
from django.utils.deprecation import Middle... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
LOCAL_SETTINGS = True
from .settings import * # noqa: F403
# If you want to customize your cuckoo path set it here.
# CUCKOO_PATH = "/where/cuckoo/is... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
import os
import sys
from contextlib import suppress
from pathlib import Path
if os.geteuid() == 0 and os.getenv("CAPE_AS_ROOT", "0") != "1":
sys.e... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
from analysis import views as analysis_views
from dashboard import views as dashboard_views
from django.conf import settings
from django.conf.urls impo... |
from django.conf import settings
from django.shortcuts import redirect, render
try:
from django_ratelimit.exceptions import Ratelimited
except ImportError:
try:
from ratelimit.exceptions import Ratelimited
except ImportError:
print("missed dependency: poetry run pip install django-ratelimit... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
"""
WSGI config for web project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It... |
# Copyright (C) 2010-2015 Cuckoo Foundation.
# This file is part of Cuckoo Sandbox - http://www.cuckoosandbox.org
# See the file 'docs/LICENSE' for copying permission.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.