Mercurial > hg > orthanc
comparison OrthancServer/Resources/PreventProtobufDirectoryLeaks.py @ 5357:fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 06 Jul 2023 17:04:31 +0200 |
parents | |
children | 165b67c02927 |
comparison
equal
deleted
inserted
replaced
5354:65b4e6ae2703 | 5357:fddb5d8d0021 |
---|---|
1 #!/usr/bin/python | |
2 | |
3 # Orthanc - A Lightweight, RESTful DICOM Store | |
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | |
5 # Department, University Hospital of Liege, Belgium | |
6 # Copyright (C) 2017-2023 Osimis S.A., Belgium | |
7 # Copyright (C) 2021-2023 Sebastien Jodogne, ICTEAM UCLouvain, Belgium | |
8 # | |
9 # This program is free software: you can redistribute it and/or | |
10 # modify it under the terms of the GNU General Public License as | |
11 # published by the Free Software Foundation, either version 3 of the | |
12 # License, or (at your option) any later version. | |
13 # | |
14 # This program is distributed in the hope that it will be useful, but | |
15 # WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 # General Public License for more details. | |
18 # | |
19 # You should have received a copy of the GNU General Public License | |
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
21 | |
22 | |
23 import sys | |
24 | |
25 if len(sys.argv) != 2: | |
26 raise Exception('Bad number of arguments in %s' % sys.argv[0]) | |
27 | |
28 with open(sys.argv[1], 'r') as f: | |
29 s = f.read() | |
30 | |
31 s = s.replace('__FILE__', '__ORTHANC_FILE__') | |
32 | |
33 s = """ | |
34 #undef __FILE__ | |
35 #define __FILE__ __ORTHANC_FILE__ | |
36 """ + s | |
37 | |
38 with open(sys.argv[1], 'w') as f: | |
39 f.write(s) |