Sha256: da89d373f54ad55bb5fc1d1d79980d962670a755ceb3949376155cd0f2fc38f5
Contents?: true
Size: 560 Bytes
Versions: 20
Compression:
Stored size: 560 Bytes
Contents
# frozen_string_literal: true require "safe_shell" module Mihari module Controllers class CommandController < BaseController post "/api/command" do param :command, String, required: true command = params["command"] if command.nil? status 400 return json({ message: "command is required" }) end command = command.split output = SafeShell.execute("mihari", *command) success = $?.success? json({ output: output, success: success }) end end end end
Version data entries
20 entries across 20 versions & 1 rubygems