#!/usr/bin/env python3
from bottle import get, post, request, run
import subprocess

@get('/')
def status():
	return '''
		<form action="/" method="post">
			Process: <input name="process" type="text">
			<input value="Search" type="submit">
		</form>
		'''

@post('/')
def do_status():
	process = request.forms.get('process')
	out = subprocess.check_output('ps -ef | grep ' + process, shell=True)
	return '''
		<form action="/" method="post">
			Process: <input name="process" type="text">
			<input value="Search" type="submit">
		</form>
		''' + str(out).replace('\\n', '<br>')

run(host='0.0.0.0', port=8080)
