diff options
| author | shihaoyue <[email protected]> | 2024-10-26 22:17:22 +0800 |
|---|---|---|
| committer | shihaoyue <[email protected]> | 2024-10-26 22:17:22 +0800 |
| commit | 4e18b08a000f2f1997eec9a19a107e28a46e5d82 (patch) | |
| tree | 245e01debb732d381e7c974aa3e0b6f4617c35b3 /server | |
| parent | e355d02d84bf5aae0c17e7d4a9aa4ece1da052cd (diff) | |
update
Diffstat (limited to 'server')
| -rw-r--r-- | server/apps/target.py | 2 | ||||
| -rw-r--r-- | server/migrations/versions/bec3aff0be22_.py | 34 | ||||
| -rw-r--r-- | server/migrations/versions/d5ff8b053e39_.py | 40 | ||||
| -rw-r--r-- | server/model.py | 5 |
4 files changed, 79 insertions, 2 deletions
diff --git a/server/apps/target.py b/server/apps/target.py index c09bbb8..46c503b 100644 --- a/server/apps/target.py +++ b/server/apps/target.py @@ -675,6 +675,8 @@ def target_GZ_API(query_data): "DoH": target.DoH, "DoT": target.DoT }, + "lat": target.latwgs, + "lng": target.lngwgs, "parameter":{ "tls_jarm_fingerprint": target.tls_jarm_fingerprint, # TLS指纹 "certificate_serial": target.certificate_serial, # 证书序列号 diff --git a/server/migrations/versions/bec3aff0be22_.py b/server/migrations/versions/bec3aff0be22_.py new file mode 100644 index 0000000..eacf24c --- /dev/null +++ b/server/migrations/versions/bec3aff0be22_.py @@ -0,0 +1,34 @@ +"""empty message + +Revision ID: bec3aff0be22 +Revises: d5ff8b053e39 +Create Date: 2024-10-26 22:16:37.473349 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'bec3aff0be22' +down_revision = 'd5ff8b053e39' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('PROFILE', schema=None) as batch_op: + batch_op.create_index(batch_op.f('ix_PROFILE_IP'), ['IP'], unique=False) + batch_op.create_index(batch_op.f('ix_PROFILE_IPv6'), ['IPv6'], unique=False) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('PROFILE', schema=None) as batch_op: + batch_op.drop_index(batch_op.f('ix_PROFILE_IPv6')) + batch_op.drop_index(batch_op.f('ix_PROFILE_IP')) + + # ### end Alembic commands ### diff --git a/server/migrations/versions/d5ff8b053e39_.py b/server/migrations/versions/d5ff8b053e39_.py new file mode 100644 index 0000000..a2089a8 --- /dev/null +++ b/server/migrations/versions/d5ff8b053e39_.py @@ -0,0 +1,40 @@ +"""empty message + +Revision ID: d5ff8b053e39 +Revises: 7a8661f81196 +Create Date: 2024-10-26 22:14:07.070865 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'd5ff8b053e39' +down_revision = '7a8661f81196' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('AGENT', schema=None) as batch_op: + batch_op.add_column(sa.Column('con', sa.String(length=255), nullable=True)) + + with op.batch_alter_table('PROFILE', schema=None) as batch_op: + batch_op.drop_index('idx_ip') + batch_op.drop_index('idx_ipv6') + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('PROFILE', schema=None) as batch_op: + batch_op.create_index('idx_ipv6', ['IPv6'], unique=False) + batch_op.create_index('idx_ip', ['IP'], unique=False) + + with op.batch_alter_table('AGENT', schema=None) as batch_op: + batch_op.drop_column('con') + + # ### end Alembic commands ### diff --git a/server/model.py b/server/model.py index 2a50d66..10f4aab 100644 --- a/server/model.py +++ b/server/model.py @@ -94,6 +94,7 @@ class Agent(db.Model): status = db.Column(db.Boolean) mem = db.Column(db.String(255)) idle = db.Column(db.Boolean) + con = db.Column(db.String(255)) tasks = db.relationship('Task', backref='agent') # task_logs = db.relationship('TaskLog', backref='agent') @@ -162,8 +163,8 @@ class Target(db.Model): class Target2(db.Model): __tablename__ = 'PROFILE' id = db.Column(db.Integer, primary_key=True, autoincrement=True) - IP = db.Column(db.String(255), nullable=True) - IPv6 = db.Column(db.String(255), nullable=True) + IP = db.Column(db.String(255), nullable=True, index=True) + IPv6 = db.Column(db.String(255), nullable=True, index=True) last_probe_time = db.Column(db.Integer, nullable=True) previous_probe_time = db.Column(db.Integer, nullable=True) port = db.Column(db.String(255), nullable=True) |
