<gh_stars>100-1000
import datetime
import re
import socket
from urllib.parse import urlparse

from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, DateTime

from lib.model.database.Database import Database

Base = Database.get_declarative_base()


class Cipher(Base):
    __tablename__ = 'cipher'
    id = Column(Integer, primary_key=True)
    date = Column(DateTime, default=datetime.datetime.utcnow)
    algorithm = Column(String)
    key = Column(String)
    iv = Column(String)
    opmode = Column(String)
    input_value = Column(String)
    output_value = Column(String)
    stack = Column(String)
    application_id = Column(Integer, ForeignKey('application.id'))

    def __init__(self, algorithm, key, iv, opmode, input_value, output_value, stack):
        self.algorithm = algorithm
        self.key = key
        self.iv = iv
        self.opmode = opmode
        self.input_value = input_value
        self.output_value = output_value
        self.stack = stack
    
    def __repr__(self):
        return f'<Cipher(id={self.id},algorithm="{self.algorithm}",key="{self.key}",opmode="{self.opmode}",input_value="{self.input_value}",output_value="{self.output_value}")>'

        

import datetime
import re
import socket
from urllib.parse import urlparse

from sqlalchemy import Column, Integer, String, Boolean, ForeignKey, DateTime

from lib.model.database.Database import Database

Base = Database.get_declarative_base()


class Cipher(Base):
    __tablename__ = 'cipher'
    id = Column(Integer, primary_key=True)
    date = Column(DateTime, default=datetime.datetime.utcnow)
    algorithm = Column(String)
    key = Column(String)
    iv = Column(String)
    opmode = Column(String)
    input_value = Column(String)
    output_value = Column(String)
    stack = Column(String)
    application_id = Column(Integer, ForeignKey('application.id'))

    def __init__(self, algorithm, key, iv, opmode, input_value, output_value, stack):
        self.algorithm = algorithm
        self.key = key
        self.iv = iv
        self.opmode = opmode
        self.input_value = input_value
        self.output_value = output_value
        self.stack = stack
    
    def __repr__(self):
        return f'<Cipher(id={self.id},algorithm="{self.algorithm}",key="{self.key}",opmode="{self.opmode}",input_value="{self.input_value}",output_value="{self.output_value}")>'