offlinesec-client 1.1.7__tar.gz → 1.1.9__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 (36) hide show
  1. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/PKG-INFO +15 -5
  2. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/README.md +14 -4
  3. offlinesec_client-1.1.9/offlinesec_client/__init__.py +1 -0
  4. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/api_sec_notes.py +1 -0
  5. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/cwbntcust.py +12 -5
  6. offlinesec_client-1.1.9/offlinesec_client/req_abap_review.py +133 -0
  7. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_patch_day.py +1 -0
  8. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/PKG-INFO +15 -5
  9. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/SOURCES.txt +1 -0
  10. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/entry_points.txt +1 -0
  11. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/setup.py +1 -0
  12. offlinesec_client-1.1.7/offlinesec_client/__init__.py +0 -1
  13. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/__main__.py +0 -0
  14. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/abap_system.py +0 -0
  15. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/agr_1251.py +0 -0
  16. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/bo_system.py +0 -0
  17. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/config.py +0 -0
  18. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/const.py +0 -0
  19. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/func.py +0 -0
  20. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/get_reports.py +0 -0
  21. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/java_system.py +0 -0
  22. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/multi_systems.py +0 -0
  23. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_bo_notes.py +0 -0
  24. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_java_notes.py +0 -0
  25. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_notes_report.py +0 -0
  26. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_param_report.py +0 -0
  27. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_roles_report.py +0 -0
  28. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/req_sec_notes.py +0 -0
  29. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/resolve_report.py +0 -0
  30. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/rsparam.py +0 -0
  31. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/sap_gui.py +0 -0
  32. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client/sap_system.py +0 -0
  33. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/dependency_links.txt +0 -0
  34. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/requires.txt +0 -0
  35. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/offlinesec_client.egg-info/top_level.txt +0 -0
  36. {offlinesec_client-1.1.7 → offlinesec_client-1.1.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: offlinesec_client
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Offline Security Client
5
5
  Home-page: https://offlinesec.com
6
6
  Author: Offline Security
@@ -46,6 +46,14 @@ or
46
46
  python3 -m pip install offlinesec_client
47
47
  ```
48
48
 
49
+ Check the installation script output. if you see the following warning:
50
+ WARNING: The scripts offlinesec_get_reports, offlinesec_inverse_transform, offlinesec_sap_notes, offlinesec_sap_params and offlinesec_sap_roles are installed in '/Users/<username>/Library/Python/3.8/bin' which is not on PATH.
51
+
52
+ Then add Python folder to the PATH variable:
53
+ ```sh
54
+ export PATH="$PATH:/Users/<username>/Library/Python/3.8/bin"
55
+ ```
56
+
49
57
  ### Installation last version from repository on [github.com](https://github.com/offlinesec/offlinesec-client)
50
58
  ```sh
51
59
  git clone https://github.com/offlinesec/offlinesec-client.git
@@ -70,9 +78,11 @@ pip3 show offlinesec_client
70
78
 
71
79
  How to discovery missed SAP Security Notes:
72
80
  1. Prepare text file with installed SAP software component versions ([details](./docs/how_to_prepare_sap_softs.md))
73
- 2. Send prepared file to server (optional you can set SAP system name):
81
+ 2. Download CWBNTCUST table ([details](./docs/how_to_prepare_sap_softs.md))
82
+ 3. Check kernel version and kernel patch
83
+ 4. Send files to the server (optional you can set SAP system name):
74
84
  ```sh
75
- offlinesec_sap_notes -f "software_components.txt" -s "Demo System"
85
+ offlinesec_sap_notes -f "software_components.txt" -s "Demo System" -k 721 -p 402 -c "cwbntcust.xlsx"
76
86
  ```
77
87
  3. Wait aprox 5 minutes (Depends on server load)
78
88
  4. Download your report:
@@ -105,8 +115,8 @@ offlinesec_get_reports
105
115
  * All sensitive information is excluded from the upload file (Role names)
106
116
  * Please remember you can create your own check variants. The details are available [here](https://github.com/offlinesec/offlinesec-knowledgebase)
107
117
 
108
- 4. Transport Request Analysis
109
- * Will be available in next releases
118
+ 4. Transport Request Analysis (Available since version 1.1.8)
119
+ * [How to generate report](./docs/how_to_prepare_abap_report.md)
110
120
 
111
121
  5. SAP Security Audit Log Analysis
112
122
  * Will be available in next releases
@@ -35,6 +35,14 @@ or
35
35
  python3 -m pip install offlinesec_client
36
36
  ```
37
37
 
38
+ Check the installation script output. if you see the following warning:
39
+ WARNING: The scripts offlinesec_get_reports, offlinesec_inverse_transform, offlinesec_sap_notes, offlinesec_sap_params and offlinesec_sap_roles are installed in '/Users/<username>/Library/Python/3.8/bin' which is not on PATH.
40
+
41
+ Then add Python folder to the PATH variable:
42
+ ```sh
43
+ export PATH="$PATH:/Users/<username>/Library/Python/3.8/bin"
44
+ ```
45
+
38
46
  ### Installation last version from repository on [github.com](https://github.com/offlinesec/offlinesec-client)
39
47
  ```sh
40
48
  git clone https://github.com/offlinesec/offlinesec-client.git
@@ -59,9 +67,11 @@ pip3 show offlinesec_client
59
67
 
60
68
  How to discovery missed SAP Security Notes:
61
69
  1. Prepare text file with installed SAP software component versions ([details](./docs/how_to_prepare_sap_softs.md))
62
- 2. Send prepared file to server (optional you can set SAP system name):
70
+ 2. Download CWBNTCUST table ([details](./docs/how_to_prepare_sap_softs.md))
71
+ 3. Check kernel version and kernel patch
72
+ 4. Send files to the server (optional you can set SAP system name):
63
73
  ```sh
64
- offlinesec_sap_notes -f "software_components.txt" -s "Demo System"
74
+ offlinesec_sap_notes -f "software_components.txt" -s "Demo System" -k 721 -p 402 -c "cwbntcust.xlsx"
65
75
  ```
66
76
  3. Wait aprox 5 minutes (Depends on server load)
67
77
  4. Download your report:
@@ -94,8 +104,8 @@ offlinesec_get_reports
94
104
  * All sensitive information is excluded from the upload file (Role names)
95
105
  * Please remember you can create your own check variants. The details are available [here](https://github.com/offlinesec/offlinesec-knowledgebase)
96
106
 
97
- 4. Transport Request Analysis
98
- * Will be available in next releases
107
+ 4. Transport Request Analysis (Available since version 1.1.8)
108
+ * [How to generate report](./docs/how_to_prepare_abap_report.md)
99
109
 
100
110
  5. SAP Security Audit Log Analysis
101
111
  * Will be available in next releases
@@ -0,0 +1 @@
1
+ __version__ = "1.1.9"
@@ -44,6 +44,7 @@ def process_it(args):
44
44
  additional_keys["api_call"] = True
45
45
  if args["id"]:
46
46
  additional_keys["id"] = args["id"]
47
+ additional_keys["version"] = offlinesec_client.__version__
47
48
  offlinesec_client.func.send_to_server(systems, UPLOAD_URL, additional_keys)
48
49
 
49
50
 
@@ -22,12 +22,18 @@ class Cwbntcust:
22
22
  max_row = sheet_obj.max_row
23
23
  for i in range(2, max_row + 1):
24
24
  note = str(sheet_obj.cell(row=i, column=1).value)
25
- #ntstatus = sheet_obj.cell(row=i, column=2).value
25
+ ntstatus = str(sheet_obj.cell(row=i, column=2).value)
26
26
  prstatus = str(sheet_obj.cell(row=i, column=3).value)
27
- if prstatus == "E": # Completely implemented
27
+ if Cwbntcust.check_note_status(ntstatus=ntstatus, prstatus=prstatus):
28
28
  outlist.append(note)
29
29
  return outlist
30
30
 
31
+ @staticmethod
32
+ def check_note_status(ntstatus, prstatus):
33
+ if prstatus == "E" or prstatus == "O": # Completely implemented or obsolete
34
+ return True
35
+ return False
36
+
31
37
  def read_txt_file(self):
32
38
  outlist = list()
33
39
  f = open(self.filename, "r")
@@ -39,9 +45,10 @@ class Cwbntcust:
39
45
  header_flag = False
40
46
  else:
41
47
  splited_line = line.split("|")
42
- note = splited_line[2].strip()
43
- prstatus = splited_line[4].strip()
44
- if prstatus == "E": # Completely implemented
48
+ note = str(splited_line[2].strip())
49
+ ntstatus = str(splited_line[3].strip())
50
+ prstatus = str(splited_line[4].strip())
51
+ if Cwbntcust.check_note_status(ntstatus=ntstatus, prstatus=prstatus):
45
52
  outlist.append(note)
46
53
 
47
54
  f.close()
@@ -0,0 +1,133 @@
1
+ import argparse
2
+ import os
3
+ import zipfile
4
+ import binascii
5
+ import json
6
+ import requests
7
+ import offlinesec_client.func as func
8
+ from offlinesec_client.const import SYSTEM_NAME, ERR_MESSAGE
9
+
10
+ UPLOAD_URL = "/tran-upload"
11
+
12
+
13
+ def check_system_name(s):
14
+ return func.check_system_name(s)
15
+
16
+
17
+ def check_variant(s):
18
+ return func.check_variant(s)
19
+
20
+
21
+ def check_path_arg(s):
22
+ if os.path.isdir(s):
23
+ return s
24
+ raise argparse.ArgumentTypeError("You must choose the transport directory (-p)")
25
+
26
+
27
+ def check_file_format(filename):
28
+ magic = "0000003320543030"
29
+ with open(filename, 'rb') as f:
30
+ first_8 = f.read(8)
31
+ if binascii.hexlify(bytearray(first_8)).decode('ascii') == magic:
32
+ return True
33
+ return False
34
+
35
+
36
+ def enum_files(fpath):
37
+ outlist = list()
38
+ for file in os.listdir(fpath):
39
+ full_path = os.path.join(fpath, file)
40
+ if os.path.isfile(full_path):
41
+ if check_file_format(full_path):
42
+ outlist.append(full_path)
43
+ return outlist
44
+
45
+
46
+ def init_args():
47
+ parser = argparse.ArgumentParser()
48
+ parser.add_argument("-p", "--path", action="store", help="Transport Directory", type=check_path_arg, required=True)
49
+ parser.add_argument("-s", "--%s" % (SYSTEM_NAME,), action="store", type=check_system_name,
50
+ help="SAP System Name (max 20 characters)", required=False)
51
+ parser.add_argument("-v", "--variant", action="store", type=check_variant,
52
+ help="Check Variant (numeric)", required=False)
53
+ parser.parse_args()
54
+ args = parser.parse_args()
55
+ return vars(args)
56
+
57
+
58
+ def print_errors(errors):
59
+ for error in errors:
60
+ print(error)
61
+
62
+
63
+ def upload_it(zip_file, args):
64
+ url = func.get_connection_str(UPLOAD_URL)
65
+
66
+ system_name = args[SYSTEM_NAME] if SYSTEM_NAME in args else ""
67
+ variant = args["variant"] if "variant" in args else ""
68
+
69
+ data = func.get_base_json(system_name=system_name, variant=variant)
70
+
71
+ with open(zip_file, 'rb') as file_body:
72
+ files = {
73
+ 'json': ('description', json.dumps(data), 'application/json'),
74
+ 'file': (os.path.basename(zip_file), file_body, 'application/zip')
75
+ }
76
+ print(" * Uploading file %s to the server. Please wait (Maximum file size: 100MB)" % (
77
+ os.path.basename(zip_file)))
78
+ try:
79
+ r = requests.post(url, files=files)
80
+ except TimeoutError:
81
+ print("Connection timed out")
82
+ else:
83
+ if r.content:
84
+ try:
85
+ response = json.loads(r.content)
86
+ if ERR_MESSAGE in response:
87
+ print(" * " + response[ERR_MESSAGE])
88
+ if file_body:
89
+ file_body.close()
90
+ if os.path.isfile(zip_file):
91
+ os.remove(zip_file)
92
+ return
93
+ except Exception as err:
94
+ print(r.content)
95
+
96
+
97
+ def zip_files(files):
98
+ print(" * %s transport files found in the directory. Compressing" % (len(files),))
99
+ zipfilename = func.get_file_name("tran.zip")
100
+ zip = zipfile.ZipFile(zipfilename, mode='w', compression=zipfile.ZIP_DEFLATED, compresslevel=9)
101
+
102
+ for filename in files:
103
+ zip.write(filename, os.path.basename(filename), compress_type=zipfile.ZIP_DEFLATED)
104
+
105
+ zip.close()
106
+ if os.path.isfile(zip.filename):
107
+ stat = os.stat(zip.filename)
108
+ size_mb = stat.st_size / (1024 * 1024)
109
+ if size_mb <= 100:
110
+ print(" * ZIP file created. File size is %s MB" % (round(size_mb),))
111
+ return zip.filename
112
+ else:
113
+ print("[ERROR] ZIP file is too big (Maximum file size: 100MB)")
114
+
115
+
116
+ def main():
117
+ args = init_args()
118
+ if "path" in args and args["path"]:
119
+ file_list = enum_files(args["path"])
120
+ if not len(file_list):
121
+ print("[ERROR] Transport files not found in the directory")
122
+ return
123
+ temp_file = zip_files(file_list)
124
+ if temp_file is None or temp_file == "":
125
+ print("[ERROR] ZIP archive not created due to error")
126
+ return
127
+ upload_it(temp_file, args)
128
+ if os.path.isfile(temp_file):
129
+ os.remove(temp_file)
130
+
131
+
132
+ if __name__ == '__main__':
133
+ main()
@@ -42,6 +42,7 @@ def process_it(args):
42
42
  additional_keys["patch_day"] = True
43
43
  if args["id"]:
44
44
  additional_keys["id"] = args["id"]
45
+ additional_keys["version"] = offlinesec_client.__version__
45
46
  offlinesec_client.func.send_to_server(systems, UPLOAD_URL, additional_keys)
46
47
 
47
48
  wait = args["wait"]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: offlinesec-client
3
- Version: 1.1.7
3
+ Version: 1.1.9
4
4
  Summary: Offline Security Client
5
5
  Home-page: https://offlinesec.com
6
6
  Author: Offline Security
@@ -46,6 +46,14 @@ or
46
46
  python3 -m pip install offlinesec_client
47
47
  ```
48
48
 
49
+ Check the installation script output. if you see the following warning:
50
+ WARNING: The scripts offlinesec_get_reports, offlinesec_inverse_transform, offlinesec_sap_notes, offlinesec_sap_params and offlinesec_sap_roles are installed in '/Users/<username>/Library/Python/3.8/bin' which is not on PATH.
51
+
52
+ Then add Python folder to the PATH variable:
53
+ ```sh
54
+ export PATH="$PATH:/Users/<username>/Library/Python/3.8/bin"
55
+ ```
56
+
49
57
  ### Installation last version from repository on [github.com](https://github.com/offlinesec/offlinesec-client)
50
58
  ```sh
51
59
  git clone https://github.com/offlinesec/offlinesec-client.git
@@ -70,9 +78,11 @@ pip3 show offlinesec_client
70
78
 
71
79
  How to discovery missed SAP Security Notes:
72
80
  1. Prepare text file with installed SAP software component versions ([details](./docs/how_to_prepare_sap_softs.md))
73
- 2. Send prepared file to server (optional you can set SAP system name):
81
+ 2. Download CWBNTCUST table ([details](./docs/how_to_prepare_sap_softs.md))
82
+ 3. Check kernel version and kernel patch
83
+ 4. Send files to the server (optional you can set SAP system name):
74
84
  ```sh
75
- offlinesec_sap_notes -f "software_components.txt" -s "Demo System"
85
+ offlinesec_sap_notes -f "software_components.txt" -s "Demo System" -k 721 -p 402 -c "cwbntcust.xlsx"
76
86
  ```
77
87
  3. Wait aprox 5 minutes (Depends on server load)
78
88
  4. Download your report:
@@ -105,8 +115,8 @@ offlinesec_get_reports
105
115
  * All sensitive information is excluded from the upload file (Role names)
106
116
  * Please remember you can create your own check variants. The details are available [here](https://github.com/offlinesec/offlinesec-knowledgebase)
107
117
 
108
- 4. Transport Request Analysis
109
- * Will be available in next releases
118
+ 4. Transport Request Analysis (Available since version 1.1.8)
119
+ * [How to generate report](./docs/how_to_prepare_abap_report.md)
110
120
 
111
121
  5. SAP Security Audit Log Analysis
112
122
  * Will be available in next releases
@@ -13,6 +13,7 @@ offlinesec_client/func.py
13
13
  offlinesec_client/get_reports.py
14
14
  offlinesec_client/java_system.py
15
15
  offlinesec_client/multi_systems.py
16
+ offlinesec_client/req_abap_review.py
16
17
  offlinesec_client/req_bo_notes.py
17
18
  offlinesec_client/req_java_notes.py
18
19
  offlinesec_client/req_notes_report.py
@@ -1,4 +1,5 @@
1
1
  [console_scripts]
2
+ offlinesec_abap_rep = offlinesec_client.req_abap_review:main
2
3
  offlinesec_api_secnotes = offlinesec_client.api_sec_notes:main
3
4
  offlinesec_bo_notes = offlinesec_client.req_bo_notes:main
4
5
  offlinesec_get_reports = offlinesec_client.get_reports:main
@@ -26,6 +26,7 @@ setup(
26
26
  'offlinesec_sap_roles = offlinesec_client.req_roles_report:main',
27
27
  'offlinesec_bo_notes = offlinesec_client.req_bo_notes:main',
28
28
  'offlinesec_java_notes = offlinesec_client.req_java_notes:main',
29
+ 'offlinesec_abap_rep = offlinesec_client.req_abap_review:main',
29
30
  'offlinesec_inverse_transform = offlinesec_client.resolve_report:main'], },
30
31
  install_requires=required,
31
32
  include_package_data=True
@@ -1 +0,0 @@
1
- __version__ = "1.1.7"