Files
2026-03-21 16:41:14 +11:00

64 lines
3.5 KiB
Python

from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='ScanProfile',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('enabled', models.BooleanField(default=True)),
('schedule_interval', models.IntegerField(choices=[(1, 'Every 1 day'), (3, 'Every 3 days'), (7, 'Every 7 days'), (30, 'Every 30 days')], default=7)),
('gateway_ip', models.GenericIPAddressField(help_text='e.g. 192.168.1.1')),
('public_ip', models.GenericIPAddressField(help_text='Your public/WAN IP address')),
('network_cidr', models.CharField(blank=True, help_text='e.g. 192.168.1.0/24', max_length=50)),
('auth_provider_host', models.CharField(blank=True, help_text='e.g. pass.junv.cc', max_length=255)),
('domains', models.JSONField(blank=True, default=list, help_text='List of public hostnames to check')),
('cameras', models.JSONField(blank=True, default=list, help_text='List of camera IPs to probe')),
('telegram_bot_token', models.CharField(blank=True, max_length=255)),
('telegram_chat_id', models.CharField(blank=True, max_length=100)),
('notify_on_severity', models.CharField(choices=[('warning', 'Warning and above'), ('critical', 'Critical only')], default='critical', max_length=20)),
('last_run_at', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='ScanRun',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('started_at', models.DateTimeField(auto_now_add=True)),
('finished_at', models.DateTimeField(blank=True, null=True)),
('status', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('success', 'Success'), ('failed', 'Failed')], default='pending', max_length=20)),
('summary', models.JSONField(default=dict)),
('triggered_by', models.CharField(default='manual', max_length=20)),
('profile', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='runs', to='netscan.scanprofile')),
],
options={
'ordering': ['-started_at'],
},
),
migrations.CreateModel(
name='ScanFinding',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('check_name', models.CharField(max_length=100)),
('severity', models.CharField(choices=[('ok', 'OK'), ('info', 'Info'), ('warning', 'Warning'), ('critical', 'Critical')], max_length=20)),
('title', models.CharField(max_length=255)),
('detail', models.TextField()),
('raw', models.JSONField(default=dict)),
('run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='findings', to='netscan.scanrun')),
],
options={
'ordering': ['severity', 'check_name'],
},
),
]