''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api dictionary_model = api.model('Dictionary', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'keyspace': fields.Integer(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False), }) dictionaries_model = api.inherit('Dictionaries collection', { 'items': fields.List(fields.Nested(dictionary_model)) }) dictData_model = api.inherit('Dictionary with data', { 'data': fields.String(), 'status': fields.Boolean() })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api status_model = api.model( 'status', { 'time': fields.DateTime(readOnly=True, required=False), 'status': fields.String(required=False), 'status_text': fields.String(required=False), 'status_tooltip': fields.String(required=False), 'status_type': fields.String(), }) JobStatusCollection_model = api.inherit( 'Job status collection', {'items': fields.List(fields.Nested(status_model))})
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api log_model = api.model('log', { 'type': fields.String(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False), 'host': fields.Integer(readOnly=True, required=False), 'package': fields.Integer(readOnly=True, required=False), 'log': fields.String(readOnly=True, required=False), 'raw': fields.String(readOnly=True, required=False) }) logsCollection_model = api.inherit('logs collection', { 'items': fields.List(fields.Nested(log_model)) })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api rule_model = api.model('rule', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'count': fields.Integer(readOnly=True), 'time': fields.DateTime(readOnly=True, required=False) }) rules_model = api.model('rules collection', { 'items': fields.List(fields.Nested(rule_model)) }) ruleData_model = api.inherit('Rules with data', { 'data': fields.String(), 'status': fields.Boolean() })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.responseModels import simpleResponse protectedFile_model = api.model( 'Protected file', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'hash': fields.String(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False), }) protectedFilesCollection_model = api.inherit( 'Protected files collection', {'items': fields.List(fields.Nested(protectedFile_model))}) excryptedFileUploaded_model = api.inherit( 'Encryped file uploaded response', simpleResponse, { 'hash': fields.String(), 'hash_type': fields.String(), 'hash_type_name': fields.String(), 'file_id': fields.Integer() })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api settings_model = api.model('Settings', { 'default_seconds_per_workunit': fields.Integer(), 'workunit_timeout_factor': fields.Integer(), 'hwmon_temp_abort': fields.Integer(), 'bench_all': fields.Boolean(), 'distribution_coefficient_alpha': fields.Float(), 't_pmin': fields.Integer(), 'ramp_up_workunits': fields.Boolean(), 'ramp_down_coefficient': fields.Float(), 'verify_hash_format': fields.Boolean(), })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api pcfg_model = api.model('PCFG', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'keyspace': fields.Integer(readOnly=True, required=False), 'time_added': fields.DateTime(readOnly=True, required=False) }) pcfgs_model = api.inherit('PCFGs collection', { 'items': fields.List(fields.Nested(pcfg_model)) }) pcfgData_model = api.inherit('PCFG with data', { 'data': fields.String(), 'status': fields.Boolean() }) pcfgTree_model = api.model('PCFG Directory Tree', { 'name': fields.String(example='grammar name'), 'children': fields.Raw(example=[ { 'name': 'folder1', 'children': [ {'name': 'file1-in-folder.txt'},
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api hashType = api.model( 'HashType', { 'code': fields.String(description='Kód hashu'), 'name': fields.String(description='Názov hashu'), 'category': fields.String(description='Kategória hashu'), 'subcategories': fields.Raw() }) hashType_list = api.model('HashTypeList', { 'hashtypes': fields.List(fields.Nested(hashType)), }) attackMode = api.model( 'AttackMode', { 'code': fields.String(description='Kód hashu', attribute='#'), 'mode': fields.String(description='Názov hashu', attribute='Mode') }) attackMode_list = api.model( 'AttackModeList', { 'attackmodes': fields.List(fields.Nested(attackMode)), })
* Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.endpoints.batches.responseModels import batch_model from src.api.fitcrack.endpoints.dictionary.responseModels import dictionary_model from src.api.fitcrack.endpoints.pcfg.responseModels import pcfg_model from src.api.fitcrack.endpoints.markov.responseModels import hcStat_model from src.api.fitcrack.responseModels import pagination, simpleResponse, job_short_model, \ boincHost_model, job_permissions boincResult_model = api.model('boinc result', { 'id': fields.String(), 'stderr_out_text': fields.String(), }) rule_model = api.model( 'Rule', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'path': fields.String(readOnly=True, required=False), 'count': fields.Integer(readOnly=True), 'time': fields.DateTime(readOnly=True, required=False), }) workunit_model = api.model( 'Workunit', { 'id': fields.String(), 'job_id': fields.Integer(),
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api charset_model = api.model( 'charset', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False), 'data': fields.String(), 'canDecode': fields.Boolean() })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api subsystem = api.model('Subsystem', { "name": fields.String(), "status": fields.String() }) serverinfo = api.model('ServerInfo', { 'subsystems': fields.List(fields.Nested(subsystem)), }) usageinfo = api.model("UsageInfo", { "time": fields.DateTime(), "cpu": fields.Float(), "ram": fields.Float(), "hdd_read": fields.Integer(), "hdd_write": fields.Integer(), "net_sent": fields.Integer(), "net_recv": fields.Integer(), }) usageinfoList = api.model('UsageInfoList', {
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api folderOrFile_model = api.model( 'folder or file', { 'path': fields.String(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False) }) directory_model = api.model( 'directory', { 'path': fields.String(readOnly=True, required=False), 'parent': fields.String(readOnly=True, required=False), 'folders': fields.List(fields.Nested(folderOrFile_model)), 'files': fields.List(fields.Nested(folderOrFile_model)) })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api subsystem = api.model('Subsystem', { "name": fields.String(), "status": fields.String() }) serverinfo = api.model('ServerInfo', { 'subsystems': fields.List(fields.Nested(subsystem)), })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api rule_model = api.model( 'rule', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False) }) ruleData_model = api.inherit('Rules with data', { 'data': fields.String(), 'status': fields.Boolean() })
* Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.endpoints.job.responseModels import workunit_model from src.api.fitcrack.responseModels import pagination, host_short_model, job_short_model, boincHost_model, \ user_model page_of_hosts_model = api.inherit( 'Page of hosts', pagination, {'items': fields.List(fields.Nested(boincHost_model))}) workunitWithJob_model = api.inherit( 'Workunit with job', workunit_model, {'job': fields.Nested(job_short_model, attribute='job')}) boincHostDetail_model = api.model( 'Host detail boinc', { 'id': fields.Integer(readOnly=True, required=False), 'domain_name': fields.String(), 'p_model': fields.String(), 'user': fields.Nested(user_model), 'os_name': fields.String(), 'fc_host': fields.Nested(host_short_model), 'active': fields.Boolean(), 'workunits': fields.List(fields.Nested(workunitWithJob_model)), 'jobs': fields.List(fields.Nested(job_short_model)) })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api template_model = api.model( 'Job template', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'created': fields.DateTime(readOnly=True, required=False), }) templates_model = api.inherit( 'Job template collection', {'items': fields.List(fields.Nested(template_model))}) template_data = api.inherit( 'Template with job settings', {'template': fields.String(readOnly=True, required=False)})
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' """response models which are used in multiple endpoints""" from flask_restplus import fields from src.api.apiConfig import api pagination = api.model( 'A page of results', { 'page': fields.Integer(description='Number of this page of results'), 'pages': fields.Integer(description='Total number of pages of results'), 'per_page': fields.Integer(description='Number of items per page of results'), 'total': fields.Integer(description='Total number of results'), }) simpleResponse = api.model( 'simpleResponse', { 'status': fields.Boolean(description="True if success, False if failed."), 'message': fields.String(description="Some details...") }) host_short_model = api.model( 'Host short', {
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' """response models which are used in multiple endpoints""" from flask_restplus import fields from src.api.apiConfig import api pagination = api.model( 'A page of results', { 'page': fields.Integer(description='Number of this page of results'), 'pages': fields.Integer(description='Total number of pages of results'), 'per_page': fields.Integer(description='Number of items per page of results'), 'total': fields.Integer(description='Total number of results'), }) simpleResponse = api.model( 'simpleResponse', { 'status': fields.Boolean(description="True if success, False if failed."), 'message': fields.String(description="Some details...") }) file_content = api.model('File info and content data', { 'name': fields.String(),
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api maskSet_model = api.model('maskSet', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(readOnly=True, required=False), 'time': fields.DateTime(readOnly=True, required=False), 'data': fields.String() })
* Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.responseModels import pagination notification_model = api.model( 'Notification', { 'job_id': fields.Integer(readOnly=True, required=False, description='id package'), 'text': fields.String(), 'type': fields.String(), 'seen': fields.Boolean(), 'time': fields.DateTime() }) page_of_notifications_model = api.inherit( 'Page of notifications', pagination, {'items': fields.List(fields.Nested(notification_model))}) notification_count_model = api.model('Notification count', {'count': fields.Integer()})
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.responseModels import pagination, job_short_model bin_model = api.model('Job bin', { 'id': fields.Integer(readOnly=True), 'position': fields.Integer(readOnly=True), 'name': fields.String(), 'job_count': fields.Integer() }) bin_with_jobs_model = api.inherit('Job bin with jobs list', bin_model, { 'jobs': fields.List(fields.Nested(job_short_model)) }) bins_model = api.inherit('Job bin collection', { 'items': fields.List(fields.Nested(bin_model)) })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.endpoints.job.responseModels import workunit_model from src.api.fitcrack.responseModels import pagination, host_short_model, job_short_model, boincHost_model, \ user_model hashes_model = api.model( 'Hashes model', { 'id': fields.Integer(readOnly=True, required=False), 'password': fields.String(), 'hash_type_name': fields.String(), 'hash': fields.String(attribute='hashText'), 'added': fields.DateTime(), 'job': fields.Nested(job_short_model) }) page_of_hashes_model = api.inherit( 'Page of hashes', pagination, {'items': fields.List(fields.Nested(hashes_model))})
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.responseModels import pagination, job_micro_model batch_status = api.model( 'Batch status object', { 'code': fields.Integer(), 'text': fields.String(), 'description': fields.String(), 'icon': fields.String(), 'color': fields.String() }) batch_model = api.model( 'Job batch', { 'id': fields.Integer(readOnly=True), 'name': fields.String(), 'total_jobs': fields.Integer(readOnly=True), 'waiting_jobs': fields.Integer(readOnly=True), 'status': fields.Nested(batch_status), 'current_user_can_edit': fields.Boolean(), 'current_user_can_operate': fields.Boolean() }) batch_with_jobs_model = api.inherit(
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api role_model = api.model('User role', { 'id': fields.Integer(readOnly=True, required=False), 'name': fields.String(), 'MANAGE_USERS': fields.Boolean(default=False), 'ADD_NEW_JOB': fields.Boolean(default=False), 'UPLOAD_DICTIONARIES': fields.Boolean(default=False), 'VIEW_ALL_JOBS': fields.Boolean(default=False), 'EDIT_ALL_JOBS': fields.Boolean(default=False), 'OPERATE_ALL_JOBS': fields.Boolean(default=False), 'ADD_USER_PERMISSIONS_TO_JOB': fields.Boolean(default=False) }) role_list_model = api.model('User role list', { 'items': fields.List(fields.Nested(role_model)) }) fc_user_model = api.model('User', { 'id': fields.Integer(readOnly=True, required=False), 'username': fields.String(readOnly=True, required=False), 'mail': fields.String(), 'role': fields.Nested(role_model) })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api axies_model = api.model('GraphAxies', { 'x': fields.String(), 'y': fields.List(fields.String()) }) package_graph_model = api.model( 'Package graph', { 'type': fields.String(), 'axies': fields.Nested(axies_model), 'data': fields.List(fields.Raw), 'labels': fields.List(fields.String()), 'dateFrom': fields.String(), 'dateTo': fields.String() }) # pie_value_model = api.model('pie graph value', { # 'label': fields.String(attribute='0'), # 'value': fields.Integer(attribute='1') # }) pie_graph_model = api.model( 'pie graph', {
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api hashType = api.model('HashType', { 'code': fields.String(description='Code of the hash'), 'name': fields.String(description='Name of the hash'), 'category': fields.String(description='Category of the hash'), 'subcategories': fields.Raw() }) hashType_list = api.model('HashTypeList', { 'hashtypes': fields.List(fields.Nested(hashType)), }) attackMode = api.model('AttackMode', { 'code': fields.String(description='Code of the hash', attribute='#'), 'mode': fields.String(description='Name of the hash', attribute='Mode') }) attackMode_list = api.model('AttackModeList', { 'attackmodes': fields.List(fields.Nested(attackMode)), })
''' * Author : see AUTHORS * Licence: MIT, see LICENSE ''' from flask_restplus import fields from src.api.apiConfig import api from src.api.fitcrack.endpoints.dictionary.responseModels import dictionary_model from src.api.fitcrack.endpoints.markov.responseModels import hcStat_model from src.api.fitcrack.responseModels import pagination, simpleResponse, package_short_model, \ boincHost_model boincResult_model = api.model('boinc result', { 'id': fields.String(), 'stderr_out_text': fields.String(), }) job_model = api.model( 'Job', { 'id': fields.String(), 'job_id': fields.Integer(), 'workunit_id': fields.Integer(), 'host_id': fields.Integer(), 'boinc_host_id': fields.Integer(), 'start_index': fields.Integer(), 'start_index_2': fields.Integer(), 'hc_keyspace': fields.Integer(), 'mask_id': fields.Integer(), 'duplicated': fields.Boolean(), 'duplicate': fields.Integer(),