Files
2026-08-19 08:04:59 +02:00

334 lines
15 KiB
Python

# Generated by Django 4.2.20 on 2026-07-17 12:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='AnalyzedDataset',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_analyzed_dataset',
},
),
migrations.CreateModel(
name='CipherSuite',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cipher_suite', models.CharField(max_length=100, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_cipher_suites',
},
),
migrations.CreateModel(
name='Device',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('serial', models.CharField(max_length=100)),
('comment', models.CharField(blank=True, default='', max_length=255)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_device',
},
),
migrations.CreateModel(
name='DeviceType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('device_type', models.CharField(max_length=50, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_device_type',
'ordering': ['device_type'],
},
),
migrations.CreateModel(
name='File',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('filename', models.CharField(max_length=255)),
('ip_address', models.GenericIPAddressField()),
('status', models.CharField(default='pending', max_length=50)),
('upload_time', models.DateTimeField(auto_now_add=True)),
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.device')),
],
options={
'db_table': 'iot_files',
'ordering': ['-upload_time'],
},
),
migrations.CreateModel(
name='Firmware',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('version', models.CharField(max_length=100)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_firmware',
},
),
migrations.CreateModel(
name='HashType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hash_type', models.CharField(max_length=100, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_hash_types',
},
),
migrations.CreateModel(
name='Manufacturer',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_manufacturer',
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Port',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('port', models.PositiveIntegerField(unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_ports',
},
),
migrations.CreateModel(
name='RawDataset',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('file', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.file')),
],
options={
'db_table': 'iot_raw_dataset',
},
),
migrations.CreateModel(
name='TlsVersion',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tls_version', models.CharField(max_length=50, unique=True)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_tls_versions',
},
),
migrations.CreateModel(
name='Tool',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tool_name', models.CharField(max_length=100, unique=True)),
('version', models.CharField(max_length=50)),
('created', models.DateTimeField(auto_now_add=True)),
],
options={
'db_table': 'iot_tool',
},
),
migrations.CreateModel(
name='UrlRaw',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.CharField(max_length=500)),
('created', models.DateTimeField(auto_now_add=True)),
('raw_dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.rawdataset')),
],
options={
'db_table': 'iot_raw_url',
},
),
migrations.CreateModel(
name='UrlAnalyzed',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('url', models.CharField(max_length=500)),
('created', models.DateTimeField(auto_now_add=True)),
('analyzed_dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.analyzeddataset')),
('cipher_suites', models.ManyToManyField(to='IoTAnalyzer.ciphersuite')),
('ports', models.ManyToManyField(to='IoTAnalyzer.port')),
('tls_versions', models.ManyToManyField(to='IoTAnalyzer.tlsversion')),
('tool', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.tool')),
],
options={
'db_table': 'iot_analyzed_url',
},
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('product_name', models.CharField(max_length=100)),
('created', models.DateTimeField(auto_now_add=True)),
('device_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.devicetype')),
('manufacturer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.manufacturer')),
],
options={
'db_table': 'iot_product',
'ordering': ['product_name'],
},
),
migrations.CreateModel(
name='HashRaw',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hash_value', models.TextField()),
('created', models.DateTimeField(auto_now_add=True)),
('raw_dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.rawdataset')),
],
options={
'db_table': 'iot_raw_hash',
},
),
migrations.CreateModel(
name='HashAnalyzed',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('hash_value', models.TextField()),
('cracked', models.BooleanField(default=False)),
('cracked_value', models.CharField(blank=True, max_length=255, null=True)),
('crack_time', models.CharField(blank=True, max_length=50, null=True)),
('created', models.DateTimeField(auto_now_add=True)),
('analyzed_dataset', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.analyzeddataset')),
('hash_type', models.ManyToManyField(to='IoTAnalyzer.hashtype')),
('tool', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.tool')),
],
options={
'db_table': 'iot_analyzed_hash',
},
),
migrations.CreateModel(
name='FirmwareDevices',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True)),
('device', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.device')),
('firmware', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.firmware')),
],
options={
'db_table': 'iot_firmware_devices',
},
),
migrations.AddField(
model_name='firmware',
name='devices',
field=models.ManyToManyField(through='IoTAnalyzer.FirmwareDevices', to='IoTAnalyzer.device'),
),
migrations.AddField(
model_name='firmware',
name='product',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.product'),
),
migrations.CreateModel(
name='FindingReport',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('result_json', models.TextField()),
('finding_count', models.IntegerField(default=0)),
('max_severity', models.CharField(default='info', max_length=20)),
('created', models.DateTimeField(auto_now_add=True)),
('file', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.file')),
],
options={
'db_table': 'iot_finding_report',
'ordering': ['-created'],
},
),
migrations.AddField(
model_name='file',
name='firmware',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.firmware'),
),
migrations.AddField(
model_name='device',
name='product',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='IoTAnalyzer.product'),
),
migrations.CreateModel(
name='DeepAnalysisJob',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('state', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('done', 'Done'), ('error', 'Error')], default='pending', max_length=20)),
('url_total', models.IntegerField(default=0)),
('url_done', models.IntegerField(default=0)),
('hash_total', models.IntegerField(default=0)),
('hash_done', models.IntegerField(default=0)),
('cracked', models.IntegerField(default=0)),
('message', models.TextField(blank=True, default='')),
('created', models.DateTimeField(auto_now_add=True)),
('updated', models.DateTimeField(auto_now=True)),
('file', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.file')),
],
options={
'db_table': 'iot_deep_analysis_job',
'ordering': ['-created'],
},
),
migrations.AddField(
model_name='analyzeddataset',
name='file',
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='IoTAnalyzer.file'),
),
migrations.AddConstraint(
model_name='urlraw',
constraint=models.UniqueConstraint(fields=('raw_dataset', 'url'), name='unique_raw_url'),
),
migrations.AddConstraint(
model_name='urlanalyzed',
constraint=models.UniqueConstraint(fields=('analyzed_dataset', 'url'), name='unique_analyzed_url'),
),
migrations.AddConstraint(
model_name='product',
constraint=models.UniqueConstraint(fields=('manufacturer', 'device_type', 'product_name'), name='unique_demo_product'),
),
migrations.AddConstraint(
model_name='hashraw',
constraint=models.UniqueConstraint(fields=('raw_dataset', 'hash_value'), name='unique_raw_hash'),
),
migrations.AddConstraint(
model_name='hashanalyzed',
constraint=models.UniqueConstraint(fields=('analyzed_dataset', 'hash_value'), name='unique_analyzed_hash'),
),
migrations.AddConstraint(
model_name='firmwaredevices',
constraint=models.UniqueConstraint(fields=('firmware', 'device'), name='unique_device_firmware'),
),
migrations.AddConstraint(
model_name='firmware',
constraint=models.UniqueConstraint(fields=('product', 'version'), name='unique_product_firmware'),
),
migrations.AddConstraint(
model_name='file',
constraint=models.UniqueConstraint(fields=('device', 'firmware', 'filename', 'ip_address'), name='unique_device_capture'),
),
migrations.AddConstraint(
model_name='device',
constraint=models.UniqueConstraint(fields=('product', 'serial'), name='unique_demo_device'),
),
]