MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / enrich_target_endpoint

Function enrich_target_endpoint

webapp_modern.py:13563–13667  ·  view source on GitHub ↗

Enrich a target (IP, domain, or hash) with threat intelligence

()

Source from the content-addressed store, hash-verified

13561 'latest_commit': status['latest_commit'],
13562 'branch': status['branch'],
13563 'detached': status['detached'],
13564 'repo_path': status['repo_path'],
13565 'update_in_progress': status['update_in_progress'],
13566 'warnings': status['warnings'],
13567 'git_status': status['git_status'],
13568 }
13569 if not status['ok']:
13570 # Still a 200: the counts above are real and the dashboard should render
13571 # them. 'code' and 'hint' tell the UI what to say about the problem.
13572 payload['error'] = status['error']
13573 payload['code'] = status['code']
13574 payload['hint'] = status['hint']
13575 return jsonify(payload)
13576
13577
13578@app.route('/api/system/update-status')
13579def update_status():
13580 """Lightweight progress endpoint for the update the browser is watching.
13581
13582 Deliberately does no network work: it is polled every few seconds while the
13583 service is restarting, and its whole job is to answer "is the box running
13584 the commit I asked for yet?".
13585 """
13586 head = git_updater.run_git(['rev-parse', 'HEAD'], RAGNAR_REPO_PATH,
13587 timeout=git_updater.GIT_QUICK_TIMEOUT)
13588 state = git_updater.update_state()
13589 return jsonify({
13590 'commit': head.out if head.ok else '',
13591 'branch': git_updater.current_branch(RAGNAR_REPO_PATH) or '',
13592 'update_in_progress': state.get('running', False),
13593 'step': state.get('step', ''),
13594 'post_update': _post_update_status(),
13595 'service_started': _PROCESS_START_TIME,
13596 })
13597
13598
13599@app.route('/api/system/update', methods=['POST'])
13600def perform_update():
13601 """Update the box to the latest upstream commit."""
13602 logger.info(f"Update requested for repository: {RAGNAR_REPO_PATH}")
13603 try:
13604 update_result = git_updater.update(RAGNAR_REPO_PATH)
13605 except Exception as e:
13606 logger.error(f"Error performing update: {e}")
13607 return jsonify({'success': False, 'error': str(e), 'code': 'git_error'}), 500
13608
13609 if not update_result['ok']:
13610 return _update_response(update_result)
13611
13612 _finalize_update(update_result)
13613 return _update_response(update_result)
13614
13615
13616@app.route('/api/system/stash-update', methods=['POST'])
13617def stash_and_update():
13618 """Update a checkout that has local edits.
13619
13620 Kept as its own route for the dashboard's benefit, but it is the same call:

Callers

nothing calls this directly

Calls 11

appendMethod · 0.80
warningMethod · 0.80
hexdigestMethod · 0.80
errorMethod · 0.80
getMethod · 0.45
itemsMethod · 0.45
encodeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected