Exemple #1
0
def initialize():
    '''
    Database Initialization Function

    Creates all the default values for the settings databases if they are in a
    pristine state.  This is run at every startup of the code.
    '''
    Account.metadata.create_all(engine)
    Image.metadata.create_all(engine)
    Stat.metadata.create_all(engine)
    Reset.metadata.create_all(engine)
    User.metadata.create_all(setting_engine)
    Setting.metadata.create_all(setting_engine)
    s = SettingSession()
    if s.query(User).count() < 1:
        s.add(User('admin', 'password'))
        s.add(Setting('log_console', '1'))
        s.add(Setting('log_console_level', 'info'))
        s.add(Setting('log_file', '0'))
        s.add(Setting('log_file_level', 'info'))
        s.add(Setting('log_file_path', '/var/log/dofler.log'))
        s.add(Setting('api_debug', '0'))
        s.add(Setting('api_port', '8080'))
        s.add(Setting('api_host', '127.0.0.1'))
        s.add(Setting('api_app_server', 'paste'))
        s.add(Setting('server_host', '127.0.0.1'))
        s.add(Setting('server_port', '8080'))
        s.add(Setting('server_ssl', '0'))
        s.add(Setting('server_anonymize', '1'))
        s.add(Setting('server_username', 'admin'))
        s.add(Setting('server_password', 'password'))
        s.add(Setting('web_images', '1'))
        s.add(Setting('web_accounts', '1'))
        s.add(Setting('web_stats', '1'))
        s.add(Setting('web_image_delay', '5'))
        s.add(Setting('web_account_delay', '30'))
        s.add(Setting('web_stat_delay', '60'))
        s.add(Setting('web_stat_max', '5'))
        s.add(Setting('web_image_max', '200'))
        s.add(Setting('web_account_max', '25'))
        s.add(Setting('web_display_settings', '1'))
        s.add(Setting('web_pvs_enabled', '0'))
        s.add(Setting('web_pvs_delay', '60'))
        s.add(Setting('web_pvs_max', '5'))
        s.add(Setting('web_theme', 'glass'))
        s.add(Setting('web_header', 'Something Awful!'))
        s.add(Setting('autostart', '0'))
        s.add(Setting('listen_interface', 'eth1'))
        s.add(Setting('ettercap_enabled', '1'))
        s.add(Setting('ettercap_command', 'ettercap -Tzuqi {IF}'))
        s.add(Setting('driftnet_enabled', '1'))
        s.add(Setting('driftnet_command', 'driftnet -ai {IF} -d /tmp'))
        s.add(Setting('tshark_enabled', '1'))
        s.add(Setting('tshark_command', '/bin/bash -c \'dumpcap -i {IF} -P -w - | tshark -T psml -PS -l -r -\''))
        s.add(Setting('pvs_host', '127.0.0.1'))
        s.add(Setting('pvs_user', 'admin'))
        s.add(Setting('pvs_password', 'admin'))
        s.add(Setting('cookie_key', str(md5hash(time.time()))))
    s.commit()
    s.close()
Exemple #2
0
def initialize():
    Account.metadata.create_all(engine)
    Image.metadata.create_all(engine)
    Stat.metadata.create_all(engine)
    User.metadata.create_all(setting_engine)
    Setting.metadata.create_all(setting_engine)
    s = SettingSession()
    if s.query(User).count() < 1:
        s.add(User('admin', 'password'))
        s.add(Setting('log_console', '1'))
        s.add(Setting('log_console_level', 'info'))
        s.add(Setting('log_file', '0'))
        s.add(Setting('log_file_level', 'info'))
        s.add(Setting('log_file_path', '/var/log/dofler.log'))
        s.add(Setting('api_debug', '0'))
        s.add(Setting('api_port', '8080'))
        s.add(Setting('api_host', '127.0.0.1'))
        s.add(Setting('api_app_server', 'paste'))
        s.add(Setting('server_host', '127.0.0.1'))
        s.add(Setting('server_port', '8080'))
        s.add(Setting('server_ssl', '0'))
        s.add(Setting('server_anonymize', '1'))
        s.add(Setting('server_username', 'admin'))
        s.add(Setting('server_password', 'password'))
        s.add(Setting('web_images', '1'))
        s.add(Setting('web_accounts', '1'))
        s.add(Setting('web_stats', '1'))
        s.add(Setting('web_image_delay', '5'))
        s.add(Setting('web_account_delay', '30'))
        s.add(Setting('web_stat_delay', '60'))
        s.add(Setting('web_stat_max', '5'))
        s.add(Setting('web_image_max', '200'))
        s.add(Setting('web_account_max', '25'))
        s.add(Setting('autostart', '0'))
        s.add(Setting('listen_interface', 'eth1'))
        s.add(Setting('ettercap_enabled', '1'))
        s.add(Setting('ettercap_command', 'ettercap -Tzuqi {IF}'))
        s.add(Setting('driftnet_enabled', '1'))
        s.add(Setting('driftnet_command', 'driftnet -ai {IF} -d /tmp'))
        s.add(Setting('tshark_enabled', '1'))
        s.add(Setting('tshark_command', 'tshark -T psml -Sli {IF} -b filesize:100000 -b files:3 -w /tmp/tshark-stats.pcap'))
        s.add(Setting('cookie_key', str(md5hash(time.time()))))
    s.commit()
    s.close()
Exemple #3
0
 def check(self, password):
     return self.password == md5hash(password)
Exemple #4
0
 def update(self, password):
     self.password = md5hash(password)
Exemple #5
0
 def __init__(self, username, password):
     self.name = username
     self.password = md5hash(password)
Exemple #6
0
 def __init__(self, timestamp, filetype, data):
     self.md5sum = md5hash(data)
     self.timestamp = timestamp
     self.filetype = filetype
     self.data = data
     self.count = 1
Exemple #7
0
def initialize():
    '''
    Database Initialization Function

    Creates all the default values for the settings databases if they are in a
    pristine state.  This is run at every startup of the code.
    '''
    Account.metadata.create_all(engine)
    Image.metadata.create_all(engine)
    Stat.metadata.create_all(engine)
    Reset.metadata.create_all(engine)
    User.metadata.create_all(setting_engine)
    Setting.metadata.create_all(setting_engine)
    s = SettingSession()
    if s.query(User).count() < 1:
        s.add(User('admin', 'password'))
        s.add(Setting('log_console', '1'))
        s.add(Setting('log_console_level', 'info'))
        s.add(Setting('log_file', '0'))
        s.add(Setting('log_file_level', 'info'))
        s.add(Setting('log_file_path', '/var/log/dofler.log'))
        s.add(Setting('api_debug', '0'))
        s.add(Setting('api_port', '8080'))
        s.add(Setting('api_host', '127.0.0.1'))
        s.add(Setting('api_app_server', 'paste'))
        s.add(Setting('server_host', '127.0.0.1'))
        s.add(Setting('server_port', '8080'))
        s.add(Setting('server_ssl', '0'))
        s.add(Setting('server_anonymize', '1'))
        s.add(Setting('server_username', 'admin'))
        s.add(Setting('server_password', 'password'))
        s.add(Setting('web_images', '1'))
        s.add(Setting('web_accounts', '1'))
        s.add(Setting('web_stats', '1'))
        s.add(Setting('web_image_delay', '5'))
        s.add(Setting('web_account_delay', '30'))
        s.add(Setting('web_stat_delay', '60'))
        s.add(Setting('web_stat_max', '5'))
        s.add(Setting('web_image_max', '200'))
        s.add(Setting('web_account_max', '25'))
        s.add(Setting('web_display_settings', '1'))
        s.add(Setting('web_pvs_enabled', '0'))
        s.add(Setting('web_pvs_delay', '60'))
        s.add(Setting('web_pvs_max', '5'))
        s.add(Setting('web_theme', 'glass'))
        s.add(Setting('web_header', 'Something Awful!'))
        s.add(Setting('autostart', '0'))
        s.add(Setting('listen_interface', 'eth1'))
        s.add(Setting('ettercap_enabled', '1'))
        s.add(Setting('ettercap_command', 'ettercap -Tzuqi {IF}'))
        s.add(Setting('driftnet_enabled', '1'))
        s.add(Setting('driftnet_command', 'driftnet -ai {IF} -d /tmp'))
        s.add(Setting('tshark_enabled', '1'))
        s.add(
            Setting(
                'tshark_command',
                '/bin/bash -c \'dumpcap -i {IF} -P -w - | tshark -T psml -PS -l -r -\''
            ))
        s.add(Setting('pvs_host', '127.0.0.1'))
        s.add(Setting('pvs_user', 'admin'))
        s.add(Setting('pvs_password', 'admin'))
        s.add(Setting('cookie_key', str(md5hash(time.time()))))
    s.commit()
    s.close()