Mercurial > hg > orthanc
annotate OrthancServer/Resources/PreventProtobufDirectoryLeaks.py @ 5658:4b7bc21db336
DicomTlsTrustedCertificates not required anymore for SCU when DicomTlsRemoteCertificateRequired is false
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Tue, 18 Jun 2024 10:27:28 +0200 |
parents | f7adfb22e20e |
children |
rev | line source |
---|---|
5357
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/python |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
2 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
3 # Orthanc - A Lightweight, RESTful DICOM Store |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
4 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
5 # Department, University Hospital of Liege, Belgium |
5640
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
6 # Copyright (C) 2017-2023 Osimis S.A., Belgium |
f7adfb22e20e
updated copyright, as Orthanc Team now replaces Osimis
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5485
diff
changeset
|
7 # Copyright (C) 2024-2024 Orthanc Team SRL, Belgium |
5485
48b8dae6dc77
upgrade to year 2024
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
5360
diff
changeset
|
8 # Copyright (C) 2021-2024 Sebastien Jodogne, ICTEAM UCLouvain, Belgium |
5357
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
9 # |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
10 # This program is free software: you can redistribute it and/or |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
11 # modify it under the terms of the GNU General Public License as |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
12 # published by the Free Software Foundation, either version 3 of the |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
13 # License, or (at your option) any later version. |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
14 # |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
15 # This program is distributed in the hope that it will be useful, but |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
16 # WITHOUT ANY WARRANTY; without even the implied warranty of |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
18 # General Public License for more details. |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
19 # |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
20 # You should have received a copy of the GNU General Public License |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
21 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
22 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
23 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
24 import sys |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
25 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
26 if len(sys.argv) != 2: |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
27 raise Exception('Bad number of arguments in %s' % sys.argv[0]) |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
28 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
29 with open(sys.argv[1], 'r') as f: |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
30 s = f.read() |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
31 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
32 s = s.replace('__FILE__', '__ORTHANC_FILE__') |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
33 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
34 s = """ |
5360 | 35 #if !defined(__ORTHANC_FILE__) |
36 # define __ORTHANC_FILE__ __FILE__ | |
37 #endif | |
5357
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
38 """ + s |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
39 |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
40 with open(sys.argv[1], 'w') as f: |
fddb5d8d0021
Prevent the leak of the full path of the source files in the binaries
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
diff
changeset
|
41 f.write(s) |