From 15c426f7fa04c83d28a81b6be830ac62e644e693 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Tue, 3 Dec 2019 12:57:07 +0700 Subject: [PATCH] Log: escape space and new line --- lib/apiserver/routers/smstools.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/apiserver/routers/smstools.js b/lib/apiserver/routers/smstools.js index 08735e2..1884bf6 100644 --- a/lib/apiserver/routers/smstools.js +++ b/lib/apiserver/routers/smstools.js @@ -30,7 +30,7 @@ async function pageRestart(req, res) { function pageLog(req, res) { const maxLines = (Number(req.query.max) || 200); - const keyword = req.query.keyword && escapeQuotes(req.query.keyword, '\'"&|*<>[];$'); + const keyword = req.query.keyword && escapeQuotes(req.query.keyword, '\'\n"&|*<>[];$ '); const cmd = req.query.keyword ? `tail -n ${maxLines * 50} /var/log/smsd/smsd.log | grep --ignore-case ${keyword} | tail -n ${maxLines} | tac` : `tail -n ${maxLines} /var/log/smsd/smsd.log | tac`; -- 1.9.0