From 12e539c5f8f0fe1fe5997e05a1979d363963f5ba Mon Sep 17 00:00:00 2001 From: Kento HASEGAWA Date: Fri, 10 Aug 2018 17:28:48 +0900 Subject: [PATCH] Don't run as a general user (#5 fixed) --- comm/client/main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/comm/client/main.py b/comm/client/main.py index 022c5a3..92249f3 100644 --- a/comm/client/main.py +++ b/comm/client/main.py @@ -106,6 +106,11 @@ def before_request(): if __name__ == "__main__": + # Check if this script runs as "root" user + if os.getuid() != 0: + raise Exception("Must run as root") + sys.exit(1) + parser = argparse.ArgumentParser(description="PYNQ client.") parser.add_argument("-p", "--port", action="store", type=int, default=5000, help="Port") parser.add_argument("-H", "--host", action="store", type=str, default="192.168.4.1:5000", help="Host address") -- 2.22.0