Skip to content
Permalink
Browse files
Add files via upload
Complete Keystroke Dynamic Software
  • Loading branch information
falekeo committed Apr 19, 2023
1 parent 2ef95be commit 4ad10aa7040bd6c5dffa8561765464220b7de64d
Show file tree
Hide file tree
Showing 64 changed files with 3,017 additions and 0 deletions.
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,16 @@
"""
ASGI config for base project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'base.settings')

application = get_asgi_application()
@@ -0,0 +1,115 @@
import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-es6v21dua^os=sy$p1sim^bu#xkfacu0e#vaxyzk*%g6_fw2ph'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',

# custom app
'core',
]

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'base.urls'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ os.path.join(BASE_DIR, '/templates')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]

WSGI_APPLICATION = 'base.wsgi.application'


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}


# Password validation
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]


# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
@@ -0,0 +1,10 @@
from django.conf import settings
from django.urls import path, include
from django.conf.urls.static import static

urlpatterns = [
path('', include('core.urls'))
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)



@@ -0,0 +1,16 @@
"""
WSGI config for base project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'base.settings')

application = get_wsgi_application()
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'core'
@@ -0,0 +1,15 @@
from django import forms

class PangramForm(forms.Form):
pangram = forms.CharField(required=True, widget=forms.TextInput(
attrs={
'placeholder': 'Enter above text here for mood test',
'autocomplete': "off"
}
))
mood = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
kd = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
dukl = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
ddkl = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
udkl = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
uukl = forms.CharField(required=False, widget=forms.TextInput(attrs={'type': "hidden"}))
Empty file.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,37 @@
from django.core.management.base import BaseCommand, CommandError
from core.models import Pangram

PANGRAMS = [
"The quick brown fox jumps over a lazy dog",
"Show mangled quartz flip vibe exactly",
"Pack my box with five dozen liquor jugs",
"Jumpy halfling dwarves pick quartz box",
"Vex quest wizard, judge my backflop hand",
"The jay, pig, fox, zebra and my wolves quack",
"Quest judge wizard bonks foxy chimp love",
"Fix problem quickly with galvanized jets",
"Heavy boxes perform quick waltzes and jigs",
"A wizard's job is to vex chumps quickly in fog",
"When zombies arrive, quickly fax judge Pat",
"Pack my red box with five dozen quality jugs",
"Blewjs computer quiz favored proxy hacking",
"Who packed five dozen old quart jugs in my box",
"Both fickle dwarves jinx my pig quiz",
"Fat hag dwarves quickly zap jinx mob",
"Fox dwarves chop my talking quiz job",
"Public junk dwarves quiz mighty fox",
"How quickly daft jumping zebras vex",
"Two driven jocks help fax my big quiz",
"Go, lazy fat vixen, be shrewd, jump quick",
"Big dwarves heckle my top quiz of jinx",
"Public junk dwarves hug my quartz fox",
"Five jumping wizards hex bolty quick",
"Five hexing wizard bots jump quickly",
]

class Command(BaseCommand):
help = "Seed pangram to the database"

def handle(self, *args, **options):
for statement in PANGRAMS:
Pangram.objects.create(statement=statement.lower())
@@ -0,0 +1,93 @@
# Generated by Django 4.2 on 2023-04-12 23:04

from django.conf import settings
import django.contrib.auth.models
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='Pangram',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('statement', models.CharField(max_length=220, unique=True)),
],
),
migrations.CreateModel(
name='Profile',
fields=[
('user_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('temp_password', models.CharField(max_length=25)),
('backup_secret', models.CharField(max_length=25)),
('trottle', models.IntegerField(default=0)),
('pangram', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='core.pangram')),
],
options={
'verbose_name': 'user',
'verbose_name_plural': 'users',
'abstract': False,
},
bases=('auth.user',),
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='UserBaseKeyStroke',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('mood', models.CharField(choices=[('h', 'happy'), ('s', 'sad'), ('n', 'normal'), ('a', 'angry')], max_length=1)),
('kd', models.DurationField()),
('uukl', models.DurationField()),
('udkl', models.DurationField()),
('ddkl', models.DurationField()),
('dukl', models.DurationField()),
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='base_keystroke', to='core.profile')),
],
),
migrations.CreateModel(
name='UnauthorizedAuthStroke',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('mood', models.CharField(choices=[('h', 'happy'), ('s', 'sad'), ('n', 'normal'), ('a', 'angry')], max_length=1)),
('kd', models.DurationField()),
('uukl', models.DurationField()),
('udkl', models.DurationField()),
('ddkl', models.DurationField()),
('dukl', models.DurationField()),
('ed', models.FloatField(blank=True, help_text='euclidean distance', null=True)),
('er', models.IntegerField(blank=True, help_text='error rate', null=True)),
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='unauth_strokes', to='core.profile')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='AuthKeyStroke',
fields=[
('id', models.IntegerField(primary_key=True, serialize=False)),
('mood', models.CharField(choices=[('h', 'happy'), ('s', 'sad'), ('n', 'normal'), ('a', 'angry')], max_length=1)),
('kd', models.DurationField()),
('uukl', models.DurationField()),
('udkl', models.DurationField()),
('ddkl', models.DurationField()),
('dukl', models.DurationField()),
('ed', models.FloatField(blank=True, help_text='euclidean distance', null=True)),
('er', models.IntegerField(blank=True, help_text='error rate', null=True)),
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='auth_strokes', to='core.profile')),
],
options={
'abstract': False,
},
),
]
@@ -0,0 +1,17 @@
# Generated by Django 4.2 on 2023-04-13 06:30

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('core', '0001_initial'),
]

operations = [
migrations.RemoveField(
model_name='profile',
name='temp_password',
),
]

0 comments on commit 4ad10aa

Please sign in to comment.