Ejemplo n.º 1
0
def init():
    logger.logStep("Initialization")
    curDir = os.getcwd()
    logger.logInfo("Creating SQLite database")
    if not os.path.exists(os.path.join(curDir, 'database')):
        os.makedirs(os.path.join(curDir, 'database'))
    database.init(os.path.join(curDir, 'database', "fuzzingresults.db"))
    logger.logInfo("Creating crash folder")
    if not os.path.exists(os.path.join(curDir, 'crashes')):
        os.makedirs(os.path.join(curDir, 'crashes'))
    logger.logInfo("Creating tmp folder")
    if not os.path.exists(os.path.join(curDir, 'tmp')):
        os.makedirs(os.path.join(curDir, 'tmp'))
    s = platform.platform()
    if s.startswith("Windows"):
        if not os.path.exists("radamsa.exe"):
            logger.logInfo(
                "Downloading radamsa.exe from http://ouspg.googlecode.com")
            utils.download("http://ouspg.googlecode.com/files/radamsa-0.3.exe",
                           "radamsa.exe")
    elif s.startswith("Linux") or s.startswith("Mac"):
        if not os.path.exists("radamsa"):
            logger.logInfo(
                "Downloading radamsa from http://ouspg.googlecode.com")
            utils.download("http://ouspg.googlecode.com/files/radamsa-0.3",
                           "radamsa")
            os.chmod("radamsa", os.stat.S_IXOTH)
    else:
        logger.logErr("Unable to download radamsa four your platform")
Ejemplo n.º 2
0
Archivo: run.py Proyecto: KTH/Jan-Ove
def start_bot():
    log = logging.getLogger(__name__)
    try:
        slack_client = slack.init()
        if slack_client and database.init():
            log.info("Jan-Ove connected and running!")
            while True:
                read_and_handle_rtm(slack_client)
        else:
            log.error("Connection to Slack failed!")
    except Exception as err:
        #slack.send_message('#team-pipeline', ('Oh :poop:, I died and had to restart myself. '
        #                                      '\n```{}```'.format(err)))
        raise
Ejemplo n.º 3
0
from flask import Flask

from modules import routes, database

APP = Flask(__name__)
APP.config['SECRET_KEY'] = 'JtiPWt7jC3K3'
routes.init(APP)
database.init(APP)

if __name__ == '__main__':
    APP.run(debug=True)
Ejemplo n.º 4
0
#!/usr/bin/python

import cherrypy
import os.path
from controller.root import Root
from modules import database, temporaryUser, CQRamSession

database.init()
temporaryUser.expireAll()

app = cherrypy.tree.mount(Root(), '', 'config/app.conf')

if __name__ == '__main__':
    cherrypy.config.update('config/global_dev.conf')
    app.merge('config/app_dev.conf')
    cherrypy.engine.start()
    cherrypy.engine.block()
else:
    cherrypy.config.update('config/global_prod.conf')
Ejemplo n.º 5
0
import operator
import statistics
import numpy as np
import modules.tools as tools
from match.classes import Match
from classes import Player

import modules.config as cfg
import modules.database as db

if os.path.isfile("test"):
    LAUNCHSTR = "_test"
else:
    LAUNCHSTR = ""
cfg.get_config(LAUNCHSTR)
db.init(cfg.database)

db.get_all_elements(Player.new_from_data, "users")


def get_all_stats():
    all_stats = list()
    for p in Player.get_all_players_list():
        loop = asyncio.get_event_loop()
        stat_player = loop.run_until_complete(
            PlayerStat.get_from_database(p.id, p.name))
        all_stats.append(stat_player)

    print("Highest Kills per match:")
    key = operator.attrgetter("kpm")
    sorted_stats = sorted(all_stats, key=key, reverse=True)
Ejemplo n.º 6
0
import cherrypy
from modules import database
from controller_tests.achievements_test import AchievementsTest
from controller_tests.activities_test import ActivitiesTest
from controller_tests.statistics_engine_test import StatisticsEngineTest
from controller_tests.goals_test import GoalsTest
from controller_tests.profiles_test import ProfilesTest
from controller_tests.stats_test import StatsTest
from controller_tests.login_test import LoginTest
from controller_tests.events_test import EventsTest
from controller_tests.health_test import HealthTest
from model_tests.achievement_test import AchievementTests
from model_tests.athlete_test import AthleteTests
from model_tests.activity_test import ActivityTests
from model_tests.event_test import EventTests
from model_tests.goal_test import GoalTests
from model_tests.health_test import HealthTests
from modules_tests.jsonable_test import JsonableTests
from modules_tests.transaction_test import TransactionTests
from modules_tests.datatables_test import DatatablesTests

# hack to be able to use sessions in the tests
cherrypy.session = cherrypy.lib.sessions.RamSession()

user = os.environ.get("psql_user", "")
database.init("tracker_test", user)
database.recreate_tables()

if __name__ == '__main__':
    unittest.main()
 def setUpClass(cls):
     database.init("tracker_test")