def delete_webhook(request): # POST以外はエラー if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) # community_id取得 community_id = get_configuration_community_delete_webhook_community_id(request) # webhook_id取得 webhook_id = get_configuration_community_delete_webhook_webhook_id(request) if ((community_id is None) or (webhook_id is None)): return error_page_free_format(request, 'invalid arguments.') try: # Webhookドキュメント取得 w = Webhooks.objects.get(id=webhook_id) # communityドキュメント取得 c = Communities.objects.get(id=community_id) # webhooksリストからwebhookを削除 c.webhooks.remove(w) c.save() replace_dict = get_common_replace_dict(request) replace_dict['community'] = c # レンダリング return render(request, 'community_detail.html', replace_dict) except Exception: # エラーページ return error_page(request)
def modify(request): # POST以外はエラー if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) # community_id取得 community_id = get_configuration_community_modify_community_id(request) # community_name取得 community_name = get_configuration_community_modify_community_name(request) if ((community_id is None) or (community_name is None)): return error_page_free_format(request, 'invalid arguments.') try: c = Communities.objects.get(id=community_id) c.name = community_name c.save() # communityトップページ返却 return redirect('/configuration/community/') except Exception: # エラーページ return error_page(request)
def create(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: time = get_adapter_otx_detail_create_time(request) if time is None: return error_page_free_format(request, 'Invalid Time format.') times = time.split(':') # 数値変換チェック try: int(times[0]) int(times[1]) int(times[2]) except ValueError: return error_page_free_format(request, 'Invalid Time format.') # Cron設定 # job追加 job = OtxAdapter.add_job(type_=ScheduleJobs.JOB_CRON, hour=times[0], minute=times[1], second=times[2]) otx.add_job(job) except Exception: # エラーページ return error_page(request) return otx_common_render(request)
def create(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: name = get_configuration_community_create_community_name(request) if(name is None or len(name) == 0): return error_page_free_format(request, 'No Community Name.') # community初期化処理 try: Communities.init_community(name) except Exception as e: return error_page_free_format(request, e.message) # 結果返却 replace_dict = get_common_replace_dict(request) replace_dict['communities'] = Communities.objects.all() replace_dict['info_msg'] = 'Create Success!!' # レンダリング return render(request, 'community.html', replace_dict) except Exception: # エラーページ return error_page(request)
def add_webhook(request): # POST以外はエラー if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) # community_id取得 community_id = get_configuration_community_add_webhook_community_id(request) # url取得 url = get_configuration_community_add_webhook_url(request) if ((community_id is None) or (url is None)): return error_page_free_format(request, 'invalid arguments.') try: # webhook作成 webhook = Webhooks() webhook.url = url webhook.save() # communityに追加 c = Communities.objects.get(id=community_id) c.webhooks.append(webhook) c.save() replace_dict = get_common_replace_dict(request) replace_dict['community'] = c # レンダリング return render(request, 'community_detail.html', replace_dict) except Exception: # エラーページ return error_page(request)
def download(request): if request.method != 'GET': return error_page_free_format(request, 'Invalid HTTP Method.') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) id_ = get_list_download_id(request) version = get_list_download_version(request) # 該当レコード検索 doc = StixFiles.objects.get(id=id_) # 格納バージョンと指定バーションが一致 if version == doc.version: # そのままダウンロード # response作成 response = HttpResponse(doc.content.read()) else: try: # 変換する if doc.version == '2.0': if version == '2.1': # 2.0 -> 2.1 dest = doc.get_elevate_21() else: # 2.0 -> 1.2 dest = doc.get_slide_12() elif doc.version == '2.1': # 2.1 -> 1.2 dest = doc.get_slide_12() else: # 1.2 -> 2.1 dest = doc.get_elevate_21() except Exception: traceback.print_exc() return error_page_free_format(request, 'Can\'t Convert because of stix2library. ') response = HttpResponse(dest) if version.startswith('1.'): # download version が 1.x response['Content-Type'] = 'application/xml' response['Content-Disposition'] = 'attachment; filename=%s.xml' % (doc.package_id) else: # download version が 2.x response['Content-Type'] = 'application/json' response['Content-Disposition'] = 'attachment; filename=%s.json' % (doc.package_id) return response
def get(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) try: start_str = get_adapter_isight_get_start_time(request) end_str = get_adapter_isight_get_end_time(request) try: start_time = _get_epoch_time(start_str) except BaseException: # parse不能時は指定なしと同義 start_time = None try: end_time = _get_epoch_time(end_str) except BaseException: # parse不能時は指定なしと同義 end_time = None count = isight.get_isight_stix(start_time=start_time, end_time=end_time) # レンダリング replace_dict = get_replace_dict() replace_dict['info_msg_get'] = 'Get by iSight Partners Adapter successfully!! (Get %d stix files.)' % (count) return render(request, 'isight.html', replace_dict) except Exception: # エラーページ return error_page(request)
def modify(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: community_root_dir = get_configuration_system_communirty_root_dir( request) suffix_list_file_path = get_configuration_system_suffix_list_file_path( request) http_proxy = get_configuration_system_http_proxy(request) https_proxy = get_configuration_system_https_proxy(request) # Config更新 System.objects.modify(community_root_dir, suffix_list_file_path, http_proxy, https_proxy) # レンダリング replace_dict = get_success_replace_dict(request) replace_dict['info_msg'] = 'Modify Success!!' return render(request, 'system.html', replace_dict) except Exception: # エラーページ return error_page(request)
def modify(request): if request.method != 'POST': return error_page_free_format(request,'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) try: url = get_adapter_misp_modify_url(request) apikey = get_adapter_misp_modify_apikey(request) stix_id_prefix = get_adapter_misp_modify_stix_id_prefix(request) print 'stix_id_prefix' identity = get_adapter_misp_modify_identity(request) community_id = get_adapter_misp_modify_community_id(request) uploader_id = int(get_adapter_misp_modify_uploader_id(request)) published_only = get_adapter_misp_get_published_only(request) #設定更新 #url は sheme と fqdn 名までなので END_POINT を追加する MispAdapter.modify_settings(url,apikey,stix_id_prefix,identity,community_id,uploader_id,published_only) #レンダリング replace_dict = get_replace_dict() replace_dict['info_msg_modify'] = 'Modify Success!!' return render(request,'misp.html',replace_dict) except Exception: #エラーページ return error_page(request)
def get(request): if request.method != 'GET': return error_page_free_format(request,'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) try: start_str = get_adapter_misp_get_start_date(request) end_str = get_adapter_misp_get_end_date(request) try: start_date = _get_datetime_from_str(start_str) except: #parse不能時は指定なしと同義 start_date = None try: end_date = _get_datetime_from_str(end_str) except: #parse不能時は指定なしと同義 end_date = None count = misp.get_misp_stix(from_dt=start_date,to_dt=end_date,identity=MispAdapter.get().identity) #レンダリング replace_dict = get_replace_dict() replace_dict['info_msg_get'] = 'Get by Misp Adapter successfully!! (Get %d stix files.)' % (count) return render(request,'misp.html',replace_dict) except Exception: #エラーページ return error_page(request)
def delete(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') if not request.user.is_active: return error_page_inactive(request) try: display_name = get_taxii2_client_delete_display_name(request) if(display_name is None or len(display_name) == 0): return error_page_free_format(request, 'No Display Name.') taxii = Taxii2Clients.objects.get(name=display_name) taxii.delete() replace_dict = _get_taxii2_client_common_replace_dict(request) replace_dict['info_msg'] = 'Delete Success!!' return render(request, 'taxii2_client.html', replace_dict) except Exception: return error_page(request)
def get(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) try: start_str = get_adapter_otx_get_start(request) try: start = datetime.datetime.strptime( start_str, '%Y/%m/%d %H:%M:%S').replace(tzinfo=pytz.utc).isoformat() except: #parse不能時は指定なしと同義 start = None count = otx.get_otx_stix(start) #レンダリング replace_dict = get_replace_dict() replace_dict[ 'info_msg_get'] = 'Get by OTX Adapter successfully!! (Get %d stix files.)' % ( count) return render(request, 'otx.html', replace_dict) except Exception: #エラーページ return error_page(request)
def interval(request, taxii_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') if not request.user.is_active: return error_page_inactive(request) if not request.user.is_admin: return error_page_no_view_permission(request) try: interval = get_configuartion_taxii_client_detail_interval_interval(request) taxii_client = TaxiiClients.objects.get(id=taxii_id) client = Client(taxii_client=taxii_client) client.remove_interval_job() taxii_client.interval_schedule_job = None taxii_client.save() if interval != 0: schedule_job = taxii_client.add_job(type_=ScheduleJobs.JOB_INTERVAL, seconds=interval) client.add_job(schedule_job) replace_dict = get_common_replace_dict(request) replace_dict['client'] = taxii_client if interval != 0: replace_dict['interval_info_msg'] = 'Set Interval %d sec' % (interval) else: replace_dict['interval_info_msg'] = 'Stop a job by interval' return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: return error_page(request)
def interval(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: interval = get_adapter_otx_detail_interval_interval(request) print(interval) # schedular からジョブを削除 otx.remove_interval_job() # mongo 格納の設定からジョブを削除 OtxAdapter.remove_internal_job() if interval != 0: # Mongo の isightAdapter に jobを追加する (設定の保存のみ) job = OtxAdapter.add_job(type_=ScheduleJobs.JOB_INTERVAL, seconds=interval) # job 動作追加 otx.add_job(job) info_msg = 'Set Interval %d sec' % (interval) else: # ジョブの追加をしない info_msg = 'Stop a job by interval' return otx_common_render(request, info_msg=info_msg) except Exception: # エラーページ return error_page(request)
def remove(request, taxii_id, job_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #is_admin権限なしの場合はエラー if request.user.is_admin == False: return error_page_no_view_permission(request) try: #mongoのtaxii_client情報から該当job_idを削除 taxii_client = TaxiiClients.objects.get(id=taxii_id) taxii_client.remove_job(job_id) #job停止 client = Client(taxii_id=taxii_id) client.remove_job(job_id) replace_dict = get_common_replace_dict(request) #mongoからtaxii_client情報を取得 replace_dict['client'] = TaxiiClients.objects.get(id=taxii_id) #レンダリング return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: #エラーページ return error_page(request)
def create(request, taxii_id): if request.method != 'POST': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #is_admin権限なしの場合はエラー if request.user.is_admin == False: return error_page_no_view_permission(request) try: time = get_configuartion_taxii_client_detail_create_time(request) #mongoからtaxii_client情報を取得 taxii_client = TaxiiClients.objects.get(id=taxii_id) #Cron設定 times = time.split(':') schedule_job = taxii_client.add_job(type_=ScheduleJobs.JOB_CRON, hour=times[0], minute=times[1], second=times[2]) #job追加 client = Client(taxii_id=taxii_id) client.add_job(schedule_job) replace_dict = get_common_replace_dict(request) replace_dict['client'] = taxii_client #レンダリング return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: #エラーページ return error_page(request)
def create(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') if not request.user.is_active: return error_page_inactive(request) try: setting_name = get_taxii2_client_create_display_name(request) if not setting_name: return error_page_free_format(request, 'No Display Name.') api_root = get_taxii2_client_create_api_root(request) if not api_root: return error_page_free_format(request, 'No API Root.') collection = get_taxii2_client_create_collection(request) if not collection: return error_page_free_format(request, 'No Collection.') login_id = get_taxii2_client_create_login_id(request) login_password = get_taxii2_client_create_login_password(request) community_id = get_taxii2_client_create_community_id(request) ca = get_taxii2_client_create_ca(request) certificate = get_taxii2_client_create_certificate(request) private_key = get_taxii2_client_create_private_key(request) protocol_version = get_taxii2_client_create_protocol_version(request) push = get_taxii2_client_create_push(request) uploader_id = int(get_taxii2_client_create_uploader_id(request)) can_read = get_taxii2_client_create_can_read(request) can_write = get_taxii2_client_create_can_write(request) Taxii2Clients.create( setting_name, api_root=api_root, collection=collection, login_id=login_id, login_password=login_password, community_id=community_id, ca=ca, cert_file=certificate, key_file=private_key, protocol_version=protocol_version, push=push, uploader_id=uploader_id, can_read=can_read, can_write=can_write) replace_dict = _get_taxii2_client_common_replace_dict(request) replace_dict['info_msg'] = 'Create or Modify Success!!' return render(request, 'taxii2_client.html', replace_dict) except Exception: return error_page(request)
def delete(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: community_id = get_configuration_community_delete_community_id(request) if(community_id is None or len(community_id) == 0): return error_page_free_format(request, 'No Community ID.') u = Communities.objects.get(id=community_id) u.delete() replace_dict = get_common_replace_dict(request) replace_dict['communities'] = Communities.objects.all() replace_dict['info_msg'] = 'Delete Success!!' # レンダリング return render(request, 'community.html', replace_dict) except Exception: # エラーページ return error_page(request)
def remove(request, job_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: otx.remove_job(job_id) except Exception: # エラーページ return error_page(request) return otx_common_render(request)
def create(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: username = get_configuration_user_create_user_username(request) if (username is None or len(username) == 0): return error_page_free_format(request, 'No Username.') password = get_configuration_user_create_user_password(request) if (password is None or len(password) == 0): return error_page_free_format(request, 'No Password.') screen_name = get_configuration_user_create_user_screen_name(request) # screen_nameが存在しない場合はusernameを利用する if (screen_name is None or len(screen_name) == 0): screen_name = username is_admin = get_configuration_user_create_user_is_admin(request) # user作成 stip_user = STIPUser.objects.create_user(username, screen_name, password, is_admin=is_admin) # api_key設定 stip_user.change_api_key() replace_dict = get_common_replace_dict(request) replace_dict['users'] = STIPUser.objects.all() replace_dict['info_msg'] = 'Create Success!!' # レンダリング return render(request, 'user.html', replace_dict) except Exception: # エラーページ return error_page(request)
def resume(request, job_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #is_admin権限なしの場合はエラー if request.user.is_admin == False: return error_page_no_view_permission(request) try: #job開始 isight.resume_job(job_id) except Exception: #エラーページ return error_page(request) return isight_common_render(request)
def pause(request, taxii_id, job_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') if not request.user.is_active: return error_page_inactive(request) if not request.user.is_admin: return error_page_no_view_permission(request) try: taxii_client = TaxiiClients.objects.get(id=taxii_id) client = Client(taxii_client=taxii_client) client.pause_job(job_id) replace_dict = get_common_replace_dict(request) replace_dict['client'] = taxii_client return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: return error_page(request)
def rebuild_cache(request): if request.method != 'GET': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: # レンダリング StixFiles.rebuild_cache() replace_dict = get_success_replace_dict(request) replace_dict['info_msg'] = 'Rebuild Success!!' return render(request, 'system.html', replace_dict) except Exception: # エラーページ return error_page(request)
def delete(request): if request.method != 'GET': return error_page_free_format(request, 'Invalid HTTP Method.') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #削除対象 ID が ,区切り文字列で渡る ids = get_list_delete_id(request).split(',') try: for id_ in ids: #mongoから該当レコード削除 origin_path = StixFiles.delete_by_id(id_) #ファイル削除 if os.path.exists(origin_path) == True: os.remove(origin_path) return top(request) except Exception: return error_page(request) return top(request)
def modify(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) try: apikey = get_adapter_otx_modify_apikey(request) community_id = get_adapter_otx_modify_community_id(request) uploader_id = int(get_adapter_otx_modify_uploader_id(request)) # 設定更新 OtxAdapter.modify_settings(apikey, community_id, uploader_id) # レンダリング replace_dict = get_replace_dict() replace_dict['info_msg_modify'] = 'Modify Success!!' return render(request, 'otx.html', replace_dict) except Exception: # エラーページ return error_page(request)
def create(request, taxii_id): if request.method != 'POST': return error_page_free_format(request, 'invalid method') if not request.user.is_active: return error_page_inactive(request) if not request.user.is_admin: return error_page_no_view_permission(request) try: time = get_configuartion_taxii_client_detail_create_time(request) taxii_client = TaxiiClients.objects.get(id=taxii_id) times = time.split(':') schedule_job = taxii_client.add_job(type_=ScheduleJobs.JOB_CRON, hour=times[0], minute=times[1], second=times[2]) client = Client(taxii_client=taxii_client) client.add_job(schedule_job) replace_dict = get_common_replace_dict(request) replace_dict['client'] = taxii_client return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: return error_page(request)
def modify(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #is_admin権限なしの場合はエラー if request.user.is_admin == False: return error_page_no_view_permission(request) try: host = get_configuration_mongo_host(request) port = get_configuration_mongo_port(request) db = get_configuration_mongo_db(request) #Config更新 MongoConfig.objects.modify(host, port, db) #レンダリング replace_dict = get_success_replace_dict(request) replace_dict['info_msg'] = 'Modify Success!!' return render(request, 'mongo.html', replace_dict) except Exception: #エラーページ return error_page(request)
def interval(request, taxii_id): if request.method != 'GET': return error_page_free_format(request, 'invalid method') #activeユーザー以外はエラー if request.user.is_active == False: return error_page_inactive(request) #is_admin権限なしの場合はエラー if request.user.is_admin == False: return error_page_no_view_permission(request) try: interval = get_configuartion_taxii_client_detail_interval_interval( request) #mongoからtaxii_client情報を取得 taxii_client = TaxiiClients.objects.get(id=taxii_id) client = Client(taxii_id=taxii_id) #稼働しているスケジューラの job があったら削除する client.remove_interval_job() #taxii_client の internal_schedule_jobs を Noneにする taxii_client.interval_schedule_job = None taxii_client.save() if interval != 0: #Cron設定 schedule_job = taxii_client.add_job( type_=ScheduleJobs.JOB_INTERVAL, seconds=interval) #job追加 client.add_job(schedule_job) replace_dict = get_common_replace_dict(request) replace_dict['client'] = taxii_client if interval != 0: replace_dict['interval_info_msg'] = 'Set Interval %d sec' % ( interval) else: replace_dict['interval_info_msg'] = 'Stop a job by interval' #レンダリング return render(request, 'configuration_taxii_client_detail.html', replace_dict) except Exception: #エラーページ return error_page(request)
def delete(request): if request.method != 'GET': return error_page_free_format(request, 'Invalid HTTP Method.') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) # 削除対象 ID が ,区切り文字列で渡る ids = get_list_delete_id(request).split(',') # is_admin権限なしの場合はエラー if not request.user.is_admin: return error_page_no_view_permission(request) try: for id_ in ids: # mongoから該当レコード削除 origin_path = StixFiles.delete_by_id(id_) # ファイル削除 if os.path.exists(origin_path): os.remove(origin_path) return redirect('list') except Exception: return error_page(request) return redirect('list')
def create(request): if request.method != 'POST': return error_page_free_format(request, 'invalid method') # activeユーザー以外はエラー if not request.user.is_active: return error_page_inactive(request) try: setting_name = get_taxii_client_create_display_name(request) if (setting_name is None or len(setting_name) == 0): return error_page_free_format(request, 'No Display Name.') address = get_taxii_client_create_address(request) if (address is None or len(address) == 0): return error_page_free_format(request, 'No Address.') try: port = get_taxii_client_create_port(request) if (port < 0 or port > 65535): return error_page_free_format(request, 'Invalid port.') except ValueError: return error_page_free_format(request, 'Invalid port.') path = get_taxii_client_create_path(request) if (path is None or len(path) == 0): return error_page_free_format(request, 'No Path.') collection = get_taxii_client_create_collection(request) if (collection is None or len(collection) == 0): return error_page_free_format(request, 'No Collection.') login_id = get_taxii_client_create_login_id(request) login_password = get_taxii_client_create_login_password(request) ssl = get_taxii_client_create_ssl(request) community_id = get_taxii_client_create_community_id(request) ca = get_taxii_client_create_ca(request) certificate = get_taxii_client_create_certificate(request) private_key = get_taxii_client_create_private_key(request) protocol_version = get_taxii_client_create_protocol_version(request) push = get_taxii_client_create_push(request) uploader_id = int(get_taxii_client_create_uploader_id(request)) if (ca): if certificate is None: return error_page_free_format(request, 'No Certificate.') if private_key is None: return error_page_free_format(request, 'No Private Key.') if ssl is not True: return error_page_free_format(request, 'Use SSL.') else: if (login_id is None or len(login_id) == 0): return error_page_free_format(request, 'No Login ID.') # taxii作成 TaxiiClients.create(setting_name, address=address, port=port, ssl=ssl, path=path, collection=collection, login_id=login_id, login_password=login_password, community_id=community_id, ca=ca, cert_file=certificate, key_file=private_key, protocol_version=protocol_version, push=push, uploader_id=uploader_id) replace_dict = get_taxii_client_common_replace_dict(request) replace_dict['info_msg'] = 'Create or Modify Success!!' # レンダリング return render(request, 'taxii_client.html', replace_dict) except Exception: # エラーページ return error_page(request)