offlinesec-client 1.1.4__tar.gz → 1.1.5__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.
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/PKG-INFO +1 -1
- offlinesec_client-1.1.5/offlinesec_client/__init__.py +1 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/abap_system.py +23 -10
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/func.py +2 -2
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/get_reports.py +1 -1
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_notes_report.py +29 -28
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/sap_gui.py +2 -2
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/PKG-INFO +1 -1
- offlinesec_client-1.1.4/offlinesec_client/__init__.py +0 -1
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/README.md +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/__main__.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/agr_1251.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/api_sec_notes.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/bo_system.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/config.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/const.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/cwbntcust.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/java_system.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/multi_systems.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_bo_notes.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_java_notes.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_param_report.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_patch_day.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_roles_report.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/req_sec_notes.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/resolve_report.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/rsparam.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client/sap_system.py +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/SOURCES.txt +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/dependency_links.txt +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/entry_points.txt +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/requires.txt +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/top_level.txt +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/setup.cfg +0 -0
- {offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.1.5"
|
|
@@ -4,6 +4,12 @@ import os
|
|
|
4
4
|
import re
|
|
5
5
|
|
|
6
6
|
ABAP = "ABAP"
|
|
7
|
+
KRNL_VERSION = "krnl_version"
|
|
8
|
+
KRNL_PATCH = "krnl_patch"
|
|
9
|
+
ABAP_SOFTS = "softs"
|
|
10
|
+
CWBNTCUST = "cwbntcust"
|
|
11
|
+
EXCLUDE_NOTES = "exclude"
|
|
12
|
+
ABAP_NAME = "name"
|
|
7
13
|
|
|
8
14
|
|
|
9
15
|
class ABAPSystem (SAPSystem):
|
|
@@ -12,17 +18,24 @@ class ABAPSystem (SAPSystem):
|
|
|
12
18
|
self.type = ABAP
|
|
13
19
|
root_dir = args["root_dir"] if "root_dir" in args else None
|
|
14
20
|
|
|
15
|
-
self.kernel_version = ABAPSystem.check_kernel_version(args["krnl_version"])
|
|
16
|
-
else ""
|
|
17
|
-
|
|
18
|
-
self.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
self.kernel_version = ABAPSystem.check_kernel_version(args["krnl_version"]) \
|
|
22
|
+
if ("krnl_version" in args.keys() and args["krnl_version"] is not None and args["krnl_version"] != "") else ""
|
|
23
|
+
|
|
24
|
+
self.kernel_patch = ABAPSystem.check_kernel_patch(args["krnl_patch"]) \
|
|
25
|
+
if "krnl_patch" in args.keys() and args["krnl_patch"] is not None and args["krnl_patch"] != ""else ""
|
|
26
|
+
|
|
27
|
+
self.softs = ABAPSystem.parse_softs_file(args["softs"], root_dir) \
|
|
28
|
+
if "softs" in args.keys() else list()
|
|
29
|
+
|
|
30
|
+
if self.kernel_version == "" and len(self.softs) == 0:
|
|
31
|
+
raise ValueError("[ERROR] System '{}' you must specify 'softs' or 'krnl_version' keys"
|
|
21
32
|
.format(self.system_name))
|
|
33
|
+
|
|
22
34
|
self.cwbntcust = ABAPSystem.parse_cwbntcust_file(args["cwbntcust"], root_dir, self.system_name) \
|
|
23
|
-
if "cwbntcust" in args.keys() else list()
|
|
35
|
+
if "cwbntcust" in args.keys() and args["cwbntcust"] is not None and args["cwbntcust"] != ""else list()
|
|
36
|
+
|
|
24
37
|
self.exclude = ABAPSystem.parse_exclude_file(args["exclude"], root_dir, self.system_name) \
|
|
25
|
-
if "exclude" in args.keys() else list()
|
|
38
|
+
if "exclude" in args.keys() and args["exclude"] is not None and args["exclude"] != ""else list()
|
|
26
39
|
|
|
27
40
|
@staticmethod
|
|
28
41
|
def check_kernel_version(kernel_version):
|
|
@@ -40,7 +53,7 @@ class ABAPSystem (SAPSystem):
|
|
|
40
53
|
try:
|
|
41
54
|
return int(kernel_patch)
|
|
42
55
|
except ValueError:
|
|
43
|
-
raise ValueError("Kernel
|
|
56
|
+
raise ValueError("Kernel Patch Level must be numeric. For example: 1100.")
|
|
44
57
|
|
|
45
58
|
@staticmethod
|
|
46
59
|
def parse_softs_file(softs_file, root_dir):
|
|
@@ -53,7 +66,6 @@ class ABAPSystem (SAPSystem):
|
|
|
53
66
|
|
|
54
67
|
if not softs_file.upper().endswith(".TXT"):
|
|
55
68
|
raise ValueError("File {} has wrong extension. Only TXT files supported".format(softs_file))
|
|
56
|
-
|
|
57
69
|
softs = list()
|
|
58
70
|
with open(path, 'r', encoding="utf-8") as f:
|
|
59
71
|
num = 0
|
|
@@ -76,6 +88,7 @@ class ABAPSystem (SAPSystem):
|
|
|
76
88
|
|
|
77
89
|
if not len(softs):
|
|
78
90
|
raise ValueError("File {} has wrong format".format(softs_file))
|
|
91
|
+
|
|
79
92
|
return softs
|
|
80
93
|
|
|
81
94
|
@staticmethod
|
|
@@ -16,11 +16,11 @@ def check_server():
|
|
|
16
16
|
try:
|
|
17
17
|
result = sock.connect_ex((conn.split(":")[0], int(conn.split(":")[1])))
|
|
18
18
|
except:
|
|
19
|
-
print("The Server %s not available now. Please try later" % (conn,))
|
|
19
|
+
print("The Offline Security Server %s not available now. Please try later" % (conn,))
|
|
20
20
|
return False
|
|
21
21
|
|
|
22
22
|
if result != 0:
|
|
23
|
-
print("The Server %s not available now. Please try later" % (conn,))
|
|
23
|
+
print("The Offline Security Server %s not available now. Please try later" % (conn,))
|
|
24
24
|
return False
|
|
25
25
|
|
|
26
26
|
sock.close()
|
|
@@ -64,7 +64,7 @@ def get_statuses():
|
|
|
64
64
|
for error in response["errors"]:
|
|
65
65
|
print(" * " + error)
|
|
66
66
|
|
|
67
|
-
print("%s report(s) are available to download from server" % (response["files_num"],))
|
|
67
|
+
print("%s report(s) are available to download from the server" % (response["files_num"],))
|
|
68
68
|
|
|
69
69
|
i = 0
|
|
70
70
|
for file in response["files"]:
|
|
@@ -4,10 +4,11 @@ import os
|
|
|
4
4
|
import sys
|
|
5
5
|
import offlinesec_client.func
|
|
6
6
|
from offlinesec_client.const import ERR_MESSAGE, FILE, SYSTEM_NAME, KRNL_PL, KRNL_VER, CWBNTCUST
|
|
7
|
+
import abap_system
|
|
7
8
|
import json
|
|
8
9
|
import time
|
|
9
10
|
|
|
10
|
-
UPLOAD_URL = "/
|
|
11
|
+
UPLOAD_URL = "/sec-notes"
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
def check_version(s):
|
|
@@ -41,40 +42,39 @@ def init_args():
|
|
|
41
42
|
parser.add_argument("-p", "--%s" % (KRNL_PL,), action="store", type=check_patch_level,
|
|
42
43
|
help="Kernel Patch Level (for instance 1200)", required=False)
|
|
43
44
|
parser.add_argument("-c", "--%s" % (CWBNTCUST,), action="store", type=check_cwbntcust,
|
|
44
|
-
help="
|
|
45
|
+
help="CWBNTCUST table (txt or xlsx)", required=False)
|
|
45
46
|
parser.add_argument("-e", "--exclude", action="store",
|
|
46
47
|
help='Exclude SAP security notes ("1111111, 2222222, 3333333")', required=False)
|
|
47
|
-
parser.add_argument('--wait', action='store_true', help="Wait 5 minutes and download the report")
|
|
48
|
+
parser.add_argument('-w', '--wait', action='store_true', help="Wait 5 minutes and download the report")
|
|
48
49
|
parser.add_argument('--guiscript', action='store_true', help="Run GUI script to prepare the input data")
|
|
49
50
|
parser.parse_args()
|
|
50
51
|
return vars(parser.parse_args())
|
|
51
52
|
|
|
52
53
|
|
|
54
|
+
def convert_to_dict(**args):
|
|
55
|
+
system_list = list()
|
|
56
|
+
new_abap_system = abap_system.ABAPSystem(args)
|
|
57
|
+
if new_abap_system is not None:
|
|
58
|
+
system_list.append(system_list)
|
|
59
|
+
|
|
60
|
+
|
|
53
61
|
def send_file(file, system_name="", kernel_version="", kernel_patch="", cwbntcust="", exclude=""):
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
response = json.loads(r.content)
|
|
71
|
-
if ERR_MESSAGE in response:
|
|
72
|
-
print(" * " + response[ERR_MESSAGE])
|
|
73
|
-
return
|
|
74
|
-
except:
|
|
75
|
-
pass
|
|
76
|
-
|
|
77
|
-
print("No response from server. Please try later")
|
|
62
|
+
additional_keys = dict()
|
|
63
|
+
system_list = list()
|
|
64
|
+
|
|
65
|
+
if system_name is None or system_name == "":
|
|
66
|
+
system_name = "ABAP System"
|
|
67
|
+
|
|
68
|
+
new_abap_system = abap_system.ABAPSystem(krnl_version=kernel_version,
|
|
69
|
+
krnl_patch=kernel_patch,
|
|
70
|
+
cwbntcust=cwbntcust,
|
|
71
|
+
exclude=exclude,
|
|
72
|
+
name=system_name,
|
|
73
|
+
softs=file)
|
|
74
|
+
if new_abap_system is not None:
|
|
75
|
+
system_list.append(new_abap_system)
|
|
76
|
+
|
|
77
|
+
offlinesec_client.func.send_to_server(system_list, UPLOAD_URL, additional_keys)
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
def process_it(file, system_name="", kernel_version="", kernel_patch="", cwbntcust="", guiscript=False, wait=False, exclude=""):
|
|
@@ -87,7 +87,7 @@ def process_it(file, system_name="", kernel_version="", kernel_patch="", cwbntcu
|
|
|
87
87
|
from offlinesec_client.sap_gui import SAPConnection
|
|
88
88
|
conn = SAPConnection.sap_notes_report(system_name=system_name, wait=wait)
|
|
89
89
|
else:
|
|
90
|
-
print("SAP GUI Scripting not supported on this platform")
|
|
90
|
+
print("SAP GUI Scripting not supported on this platform. Run SAP Gui Scripting only on Windows platform")
|
|
91
91
|
return
|
|
92
92
|
|
|
93
93
|
send_file(file, system_name, kernel_version, kernel_patch, cwbntcust, exclude)
|
|
@@ -98,6 +98,7 @@ def process_it(file, system_name="", kernel_version="", kernel_patch="", cwbntcu
|
|
|
98
98
|
sys.stdout.write("{:2d} seconds remaining.".format(remaining))
|
|
99
99
|
sys.stdout.flush()
|
|
100
100
|
time.sleep(1)
|
|
101
|
+
print("")
|
|
101
102
|
os.system("offlinesec_get_reports")
|
|
102
103
|
|
|
103
104
|
|
|
@@ -10,7 +10,7 @@ from pathlib import Path
|
|
|
10
10
|
|
|
11
11
|
class SAPConnection:
|
|
12
12
|
@staticmethod
|
|
13
|
-
def sap_notes_report(system_name=None, wait=False):
|
|
13
|
+
def sap_notes_report(system_name=None, wait=False, exclude=None):
|
|
14
14
|
try:
|
|
15
15
|
sap_sessions = SAPExistedSession.get_multi_sap_session_with_info()
|
|
16
16
|
except RuntimeError as error:
|
|
@@ -61,7 +61,7 @@ class SAPConnection:
|
|
|
61
61
|
print(" * The CWBNTCUST table +")
|
|
62
62
|
|
|
63
63
|
if len(out_dict):
|
|
64
|
-
SAPConnection.send_it_to_server(out_dict,system_name,wait)
|
|
64
|
+
SAPConnection.send_it_to_server(out_dict, system_name, wait)
|
|
65
65
|
|
|
66
66
|
@staticmethod
|
|
67
67
|
def load_software_components(sap_session):
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.1.4"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
{offlinesec_client-1.1.4 → offlinesec_client-1.1.5}/offlinesec_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|