Module: check_mk
Branch: master
Commit: 0f2a444b8aca490f0cbac42b720d370ceaa1f347
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0f2a444b8aca49…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Sep 6 17:43:24 2016 +0200
Fixed possible unsafe os.system() call used during network scan
---
web/htdocs/wato.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index bca8685..50ed194 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -15950,7 +15950,10 @@ def string_from_ip_int(ip_int):
def ping(address):
- return os.system('ping -c2 -w2 %s >/dev/null 2>&1' % address) == 0
+ return subprocess.Popen(['ping', '-c2', '-w2', address],
+ stdout=open(os.devnull, "a"),
+ stderr=subprocess.STDOUT,
+ close_fds=True).wait() == 0
def ping_worker(addresses, hosts):