offlinesec-client 1.1.43__tar.gz → 1.1.45__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/PKG-INFO +1 -1
  2. offlinesec_client-1.1.45/offlinesec_client/__init__.py +1 -0
  3. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/abap_system.py +36 -0
  4. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/resolve_report.py +64 -28
  5. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/sap_table.py +5 -0
  6. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/PKG-INFO +1 -1
  7. offlinesec_client-1.1.43/offlinesec_client/__init__.py +0 -1
  8. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/README.md +0 -0
  9. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/__main__.py +0 -0
  10. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/agr_1251.py +0 -0
  11. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/agr_cfg_read.py +0 -0
  12. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/api_sec_notes.py +0 -0
  13. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/bo_system.py +0 -0
  14. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/config.py +0 -0
  15. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/const.py +0 -0
  16. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/cwbntcust.py +0 -0
  17. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/exclude_params.py +0 -0
  18. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/func.py +0 -0
  19. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/get_reports.py +0 -0
  20. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/java_system.py +0 -0
  21. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/masking.py +0 -0
  22. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/multi_systems.py +0 -0
  23. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_abap_review.py +0 -0
  24. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_bo_notes.py +0 -0
  25. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_java_notes.py +0 -0
  26. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_notes_report.py +0 -0
  27. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_param_report.py +0 -0
  28. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_patch_day.py +0 -0
  29. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_rfc_report.py +0 -0
  30. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_roles_report.py +0 -0
  31. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/req_sec_notes.py +0 -0
  32. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/rfcdes.py +0 -0
  33. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/rsparam.py +0 -0
  34. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/sap_gui.py +0 -0
  35. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/sap_system.py +0 -0
  36. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/yaml_cfg_read.py +0 -0
  37. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client/yaml_cfg_rfc.py +0 -0
  38. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/SOURCES.txt +0 -0
  39. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/dependency_links.txt +0 -0
  40. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/entry_points.txt +0 -0
  41. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/requires.txt +0 -0
  42. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/offlinesec_client.egg-info/top_level.txt +0 -0
  43. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/setup.cfg +0 -0
  44. {offlinesec_client-1.1.43 → offlinesec_client-1.1.45}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: offlinesec_client
3
- Version: 1.1.43
3
+ Version: 1.1.45
4
4
  Summary: Offline Security Client
5
5
  Home-page: https://offlinesec.com
6
6
  Author: Offline Security
@@ -0,0 +1 @@
1
+ __version__ = "1.1.45"
@@ -44,6 +44,12 @@ class ABAPSystem (SAPSystem):
44
44
  if "sla" in args:
45
45
  self.parse_sla(args["sla"], root_dir)
46
46
 
47
+ # versions
48
+ if "cwbnthead" in args.keys() and args["cwbnthead"] is not None:
49
+ self.parse_cwbnthead(args["cwbnthead"], root_dir)
50
+ else:
51
+ self.cwbnthead = dict()
52
+
47
53
  self.exclude = ABAPSystem.parse_exclude_file(args["exclude"], root_dir, self.system_name) \
48
54
  if "exclude" in args.keys() and args["exclude"] is not None and args["exclude"] != ""else list()
49
55
 
@@ -134,6 +140,36 @@ class ABAPSystem (SAPSystem):
134
140
  tbl = SAPTable(table_name="CWBNTCUST", file_name=path)
135
141
  self.dev_cwbntcust = ABAPSystem.parse_cwbntcust_data_new(tbl)
136
142
 
143
+
144
+ def parse_cwbnthead(self, cwbnthead_file, root_dir):
145
+ if root_dir:
146
+ path = os.path.join(root_dir, cwbnthead_file)
147
+ else:
148
+ path = cwbnthead_file
149
+ if not os.path.exists(path):
150
+ raise FileNotFoundError("File %s not found" % (cwbnthead_file,))
151
+
152
+ if not (cwbnthead_file.upper().endswith(".TXT") or cwbnthead_file.upper().endswith(".XLSX")):
153
+ raise ValueError("File {} has wrong extension. Only TXT or XLSX files supported".format(cwbnthead_file))
154
+
155
+ tbl = SAPTable(table_name="CWBNTHEAD", file_name=path)
156
+
157
+ outdict = dict()
158
+ for line in tbl:
159
+ if "NUMM" in line and "VERSNO" in line:
160
+ if ("INCOMPLETE" in line and line["INCOMPLETE"] != "X") or "INCOMPLETE" not in line:
161
+ try:
162
+ note_id = line["NUMM"].lstrip("0")
163
+ vers = int(line["VERSNO"])
164
+ except:
165
+ continue
166
+ else:
167
+ if note_id not in outdict:
168
+ outdict[note_id] = vers
169
+ elif note_id in outdict and outdict[note_id] < vers:
170
+ outdict[note_id] = vers
171
+ self.cwbnthead = outdict
172
+
137
173
  @staticmethod
138
174
  def parse_cwbntcust_data(cwbntcust_table):
139
175
  notes = list()
@@ -4,6 +4,7 @@ import os
4
4
  import argparse
5
5
  from pathlib import Path
6
6
 
7
+ from build.lib.offlinesec_client.masking import ROLE_MASK
7
8
  from offlinesec_client.const import SUBDIR, FILE
8
9
  from offlinesec_client.masking import Masking, SAPSID_MASK, USER_MASK,HOST_MASK, PATH_MASK, RFCDEST_MASK
9
10
  import offlinesec_client.func
@@ -99,7 +100,61 @@ def do_rfc_transform(file_name, sheet_name="Parameters"):
99
100
  wb.save(fullFilename=file_name)
100
101
  wb.close()
101
102
 
103
+ def do_roles_transform(file_name, sheet_name="Parameters"):
104
+ wb = editpyxl.Workbook()
105
+ source_filename = file_name
106
+
107
+ wb.open(source_filename)
102
108
 
109
+ if not sheet_name in wb.sheetnames:
110
+ wb.close()
111
+ return
112
+
113
+ ws = wb[sheet_name]
114
+
115
+ masking = {
116
+ SAPSID_MASK: Masking(SAPSID_MASK),
117
+ ROLE_MASK: Masking(ROLE_MASK)
118
+ }
119
+
120
+ column_map = {
121
+ "System Name": SAPSID_MASK,
122
+ "Role Name": ROLE_MASK
123
+ }
124
+
125
+ max_masking = 20
126
+ columns = list()
127
+ for i in range(1, max_masking + 1):
128
+ try:
129
+ column_name = ws.cell(row=1, column=i).value
130
+ if column_name is None or column_name.strip() == "":
131
+ break
132
+ if column_name in column_map:
133
+ columns.append(column_map[column_name])
134
+ else:
135
+ columns.append(None)
136
+ continue
137
+ except IndexError as err:
138
+ break
139
+
140
+ max_lines = 10000
141
+ for i, column in enumerate(columns):
142
+ for k in range(2, max_lines + 1):
143
+ if column is not None:
144
+ try:
145
+ cell = ws.cell(row=k, column=i + 1).value
146
+
147
+ except IndexError as err:
148
+ break
149
+ else:
150
+ if cell is not None and cell.strip() != "":
151
+ new_value = masking[column].do_unmask(cell)
152
+ ws.cell(row=k, column=i + 1).value = new_value
153
+ else:
154
+ break
155
+
156
+ wb.save(fullFilename=file_name)
157
+ wb.close()
103
158
 
104
159
  def do_secnotes_transform(file_name):
105
160
  wb = editpyxl.Workbook()
@@ -129,35 +184,16 @@ def do_secnotes_transform(file_name):
129
184
  wb.save(fullFilename=file_name)
130
185
  wb.close()
131
186
 
132
-
133
187
  def read_file(file):
134
- flag = False
135
- if os.path.basename(file).startswith("roles_"):
136
- flag = True
137
- elif os.path.basename(file).startswith("rfc_") and os.path.basename(file).endswith(".xlsx"):
138
- do_rfc_transform(file)
139
- elif os.path.basename(file).startswith("secnotes_") and os.path.basename(file).endswith(".xlsx"):
140
- do_secnotes_transform(file)
141
- elif os.path.basename(file).startswith("params_") and os.path.basename(file).endswith(".xlsx"):
142
- do_secnotes_transform(file)
143
-
144
- if not flag:
145
- return
146
- wb = openpyxl.load_workbook(file)
147
- ws = wb.worksheets[0]
148
- title = ws['B1'].value
149
-
150
- if title.startswith("Critical Authorizations"):
151
- roles = read_dict_file()
152
- resolve_roles_page1(ws, roles)
153
- ws = wb.worksheets[1]
154
- resolve_roles_page2(ws, roles)
155
-
156
-
157
- wb.save(file)
158
- print(" * Roles in file %s have been converted" % (os.path.basename(file),))
159
-
160
-
188
+ if os.path.basename(file).endswith(".xlsx"):
189
+ if os.path.basename(file).startswith("roles_"):
190
+ do_roles_transform(file)
191
+ elif os.path.basename(file).startswith("rfc_"):
192
+ do_rfc_transform(file)
193
+ elif os.path.basename(file).startswith("secnotes_"):
194
+ do_secnotes_transform(file)
195
+ elif os.path.basename(file).startswith("params_"):
196
+ do_secnotes_transform(file)
161
197
 
162
198
  def resolve_roles_page1(ws, roles):
163
199
  max_row = ws.max_row
@@ -34,6 +34,11 @@ COLUMN_REPLACEMENT = {
34
34
  "REQID" : ["Request ID", "Request-Id"],
35
35
  "IMPL_PROGRESS": ["Implementation Progress", "Impl."]
36
36
  },
37
+ "CWBNTHEAD" : {
38
+ "NUMM" : ["Note number", "Hinweisnummer"],
39
+ "VERSNO": ["Version"],
40
+ "INCOMPLETE": ["TRUE"]
41
+ },
37
42
 
38
43
  "JAVA_SOFTS" : {
39
44
  "Version": [],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: offlinesec-client
3
- Version: 1.1.43
3
+ Version: 1.1.45
4
4
  Summary: Offline Security Client
5
5
  Home-page: https://offlinesec.com
6
6
  Author: Offline Security
@@ -1 +0,0 @@
1
- __version__ = "1.1.43"