mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
20 lines
421 B
Ruby
20 lines
421 B
Ruby
# Ruby Sinatra route, benign.
|
|
# Validates the real path-capture parameter before running a fixed echo.
|
|
|
|
require 'sinatra/base'
|
|
|
|
class NyxSinatraApp < Sinatra::Base
|
|
set :environment, :test
|
|
disable :run
|
|
|
|
get '/run/:payload' do |payload|
|
|
unless payload =~ /\A[A-Za-z0-9]{1,32}\z/
|
|
STDOUT.print("invalid\n")
|
|
"invalid"
|
|
else
|
|
out = `echo hello`
|
|
STDOUT.print(out)
|
|
out
|
|
end
|
|
end
|
|
end
|