boman-cli 2.2.0__tar.gz → 2.4.0__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.
- {boman-cli-2.2.0 → boman-cli-2.4.0}/PKG-INFO +14 -5
- {boman-cli-2.2.0 → boman-cli-2.4.0}/README.md +13 -4
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/PKG-INFO +14 -5
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/requires.txt +1 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/Config.py +16 -4
- boman-cli-2.4.0/bomancli/auth.py +184 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/base_logger.py +10 -3
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/main.py +242 -295
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/utils.py +16 -1
- boman-cli-2.4.0/bomancli/validation.py +516 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/setup.cfg +1 -1
- {boman-cli-2.2.0 → boman-cli-2.4.0}/setup.py +1 -1
- boman-cli-2.2.0/bomancli/auth.py +0 -102
- boman-cli-2.2.0/bomancli/validation.py +0 -331
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/SOURCES.txt +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/dependency_links.txt +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/entry_points.txt +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/boman_cli.egg-info/top_level.txt +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/_init_.py +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/loc_finder.py +0 -0
- {boman-cli-2.2.0 → boman-cli-2.4.0}/bomancli/templates/template_plan.yaml +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boman-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: CLI tool of boman.ai
|
|
5
5
|
Home-page: https://boman.ai
|
|
6
6
|
Author: Sumeru Software Solutions Pvt. Ltd.
|
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
|
|
16
16
|
# Introduction
|
|
17
|
-
Boman CLI is a Orchestration script written in python to run security scans on the
|
|
17
|
+
Boman CLI is a Orchestration script written in python to run security scans on the local or CI/CD environment and upload the results to Boman.ai SaaS server.
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
# Installation
|
|
@@ -27,6 +27,13 @@ Boman CLI is a Orchestration script written in python to run security scans on t
|
|
|
27
27
|
|
|
28
28
|
` boman-cli -h`
|
|
29
29
|
|
|
30
|
+
### Authentication of project has been moved from boman.yaml to boman-cli
|
|
31
|
+
|
|
32
|
+
`boman-cli -a run -at <project token> -ct <customer token>`
|
|
33
|
+
|
|
34
|
+
To obtain `project token` and `customer token`. Go to SaaS platform. Click on Apps -> app menu of the particular app -> Get Scan Token
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
### To test the boman cli server
|
|
31
38
|
|
|
32
39
|
` boman-cli -a test-saas`
|
|
@@ -68,9 +75,7 @@ Example: boman-cli -a run -config ./customboman.yaml
|
|
|
68
75
|
Example: boman-cli -a run -zap_session_script ./session.js
|
|
69
76
|
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# Error codes & meannings
|
|
78
|
+
# Error codes
|
|
74
79
|
|
|
75
80
|
0 : Successfull scan
|
|
76
81
|
1 : Server/SaaS error
|
|
@@ -83,6 +88,10 @@ Example: boman-cli -a run -zap_session_script ./session.js
|
|
|
83
88
|
|
|
84
89
|
### Release Note:
|
|
85
90
|
|
|
91
|
+
### V2.3.0
|
|
92
|
+
- **New:** The pipeline configuration has been relocated from `boman.yaml` to the SaaS platform. Navigate to **Apps -> App menu -> Configure pipeline** to set it up. The current `boman.yaml` configuration will remain functional until it is officially deprecated.
|
|
93
|
+
|
|
94
|
+
|
|
86
95
|
### V2.2.0
|
|
87
96
|
- New scan added: IaC.
|
|
88
97
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Introduction
|
|
2
|
-
Boman CLI is a Orchestration script written in python to run security scans on the
|
|
2
|
+
Boman CLI is a Orchestration script written in python to run security scans on the local or CI/CD environment and upload the results to Boman.ai SaaS server.
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
# Installation
|
|
@@ -12,6 +12,13 @@ Boman CLI is a Orchestration script written in python to run security scans on t
|
|
|
12
12
|
|
|
13
13
|
` boman-cli -h`
|
|
14
14
|
|
|
15
|
+
### Authentication of project has been moved from boman.yaml to boman-cli
|
|
16
|
+
|
|
17
|
+
`boman-cli -a run -at <project token> -ct <customer token>`
|
|
18
|
+
|
|
19
|
+
To obtain `project token` and `customer token`. Go to SaaS platform. Click on Apps -> app menu of the particular app -> Get Scan Token
|
|
20
|
+
|
|
21
|
+
|
|
15
22
|
### To test the boman cli server
|
|
16
23
|
|
|
17
24
|
` boman-cli -a test-saas`
|
|
@@ -53,9 +60,7 @@ Example: boman-cli -a run -config ./customboman.yaml
|
|
|
53
60
|
Example: boman-cli -a run -zap_session_script ./session.js
|
|
54
61
|
|
|
55
62
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
# Error codes & meannings
|
|
63
|
+
# Error codes
|
|
59
64
|
|
|
60
65
|
0 : Successfull scan
|
|
61
66
|
1 : Server/SaaS error
|
|
@@ -68,6 +73,10 @@ Example: boman-cli -a run -zap_session_script ./session.js
|
|
|
68
73
|
|
|
69
74
|
### Release Note:
|
|
70
75
|
|
|
76
|
+
### V2.3.0
|
|
77
|
+
- **New:** The pipeline configuration has been relocated from `boman.yaml` to the SaaS platform. Navigate to **Apps -> App menu -> Configure pipeline** to set it up. The current `boman.yaml` configuration will remain functional until it is officially deprecated.
|
|
78
|
+
|
|
79
|
+
|
|
71
80
|
### V2.2.0
|
|
72
81
|
- New scan added: IaC.
|
|
73
82
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: boman-cli
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: CLI tool of boman.ai
|
|
5
5
|
Home-page: https://boman.ai
|
|
6
6
|
Author: Sumeru Software Solutions Pvt. Ltd.
|
|
@@ -14,7 +14,7 @@ Classifier: Operating System :: OS Independent
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
|
|
16
16
|
# Introduction
|
|
17
|
-
Boman CLI is a Orchestration script written in python to run security scans on the
|
|
17
|
+
Boman CLI is a Orchestration script written in python to run security scans on the local or CI/CD environment and upload the results to Boman.ai SaaS server.
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
# Installation
|
|
@@ -27,6 +27,13 @@ Boman CLI is a Orchestration script written in python to run security scans on t
|
|
|
27
27
|
|
|
28
28
|
` boman-cli -h`
|
|
29
29
|
|
|
30
|
+
### Authentication of project has been moved from boman.yaml to boman-cli
|
|
31
|
+
|
|
32
|
+
`boman-cli -a run -at <project token> -ct <customer token>`
|
|
33
|
+
|
|
34
|
+
To obtain `project token` and `customer token`. Go to SaaS platform. Click on Apps -> app menu of the particular app -> Get Scan Token
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
### To test the boman cli server
|
|
31
38
|
|
|
32
39
|
` boman-cli -a test-saas`
|
|
@@ -68,9 +75,7 @@ Example: boman-cli -a run -config ./customboman.yaml
|
|
|
68
75
|
Example: boman-cli -a run -zap_session_script ./session.js
|
|
69
76
|
|
|
70
77
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# Error codes & meannings
|
|
78
|
+
# Error codes
|
|
74
79
|
|
|
75
80
|
0 : Successfull scan
|
|
76
81
|
1 : Server/SaaS error
|
|
@@ -83,6 +88,10 @@ Example: boman-cli -a run -zap_session_script ./session.js
|
|
|
83
88
|
|
|
84
89
|
### Release Note:
|
|
85
90
|
|
|
91
|
+
### V2.3.0
|
|
92
|
+
- **New:** The pipeline configuration has been relocated from `boman.yaml` to the SaaS platform. Navigate to **Apps -> App menu -> Configure pipeline** to set it up. The current `boman.yaml` configuration will remain functional until it is officially deprecated.
|
|
93
|
+
|
|
94
|
+
|
|
86
95
|
### V2.2.0
|
|
87
96
|
- New scan added: IaC.
|
|
88
97
|
|
|
@@ -26,6 +26,7 @@ class Config:
|
|
|
26
26
|
sast_message = None
|
|
27
27
|
sast_errors = None
|
|
28
28
|
sast_ignore = False
|
|
29
|
+
sast_ignore_folders_and_files = None
|
|
29
30
|
|
|
30
31
|
dast_present = None
|
|
31
32
|
dast_target = None
|
|
@@ -50,7 +51,7 @@ class Config:
|
|
|
50
51
|
|
|
51
52
|
sca_present = None
|
|
52
53
|
sca_lang = None
|
|
53
|
-
sca_type=
|
|
54
|
+
sca_type= "directory"
|
|
54
55
|
sca_target= None
|
|
55
56
|
|
|
56
57
|
sca_scan_status = None
|
|
@@ -58,6 +59,7 @@ class Config:
|
|
|
58
59
|
sca_message = None
|
|
59
60
|
sca_errors = None
|
|
60
61
|
sca_ignore = False
|
|
62
|
+
sca_ignore_folders_and_files = None
|
|
61
63
|
sca_exclude_paths=None
|
|
62
64
|
|
|
63
65
|
app_token = None
|
|
@@ -78,7 +80,7 @@ class Config:
|
|
|
78
80
|
secret_scan_response = None
|
|
79
81
|
# custom_zap_auth_method = False
|
|
80
82
|
# zap_custom_auth_method = 'form'
|
|
81
|
-
|
|
83
|
+
zap_plan_config = None
|
|
82
84
|
# custom_zap_plan_present = False
|
|
83
85
|
zap_script_config = None
|
|
84
86
|
custom_zap_script_present = False
|
|
@@ -118,7 +120,7 @@ class Config:
|
|
|
118
120
|
|
|
119
121
|
log_level = "INFO"
|
|
120
122
|
|
|
121
|
-
version = 'v2.
|
|
123
|
+
version = 'v2.4.0'
|
|
122
124
|
|
|
123
125
|
boman_config_file = 'boman.yaml'
|
|
124
126
|
|
|
@@ -174,4 +176,14 @@ class Config:
|
|
|
174
176
|
iac_scan_status=None
|
|
175
177
|
iac_scan_type=None
|
|
176
178
|
iac_scan_target=None
|
|
177
|
-
iac_valid_exit_status = [0,60,50,40,30,20]
|
|
179
|
+
iac_valid_exit_status = [0,60,50,40,30,20]
|
|
180
|
+
|
|
181
|
+
#SaaS configured
|
|
182
|
+
saas_configured = None
|
|
183
|
+
dast_configuration = None
|
|
184
|
+
sast_configuration = None
|
|
185
|
+
sca_configuration = None
|
|
186
|
+
secret_scan_configuration = None
|
|
187
|
+
con_scan_configuration = None
|
|
188
|
+
sbom_configuration = None
|
|
189
|
+
iac_scan_configuration = None
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
# from base_logger import logging
|
|
3
|
+
# from Config import Config
|
|
4
|
+
from bomancli.base_logger import logging
|
|
5
|
+
from bomancli.Config import Config
|
|
6
|
+
from bomancli import utils as Utils
|
|
7
|
+
import os
|
|
8
|
+
import json
|
|
9
|
+
|
|
10
|
+
logging.basicConfig(format='%(asctime)s — %(name)s — %(levelname)s — %(funcName)s:%(lineno)d — %(message)s')
|
|
11
|
+
|
|
12
|
+
# new authorization which just authorize the cli run using app token and customer token.
|
|
13
|
+
# This api gets SCA configuration as well to decide which tool to be used (OSV or owasp dependency check)
|
|
14
|
+
def new_authorize():
|
|
15
|
+
|
|
16
|
+
url_new =Config.boman_url+"/api/app/new_authorize"
|
|
17
|
+
data_new = {'app_token': Config.app_token, 'customer_token': Config.customer_token}
|
|
18
|
+
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
19
|
+
try:
|
|
20
|
+
# logging.info(data_new)
|
|
21
|
+
logging.info("New Authorization: Communicating with SaaS for Authorization")
|
|
22
|
+
res = requests.post(url_new, json=data_new, headers=headers)
|
|
23
|
+
# logging.info(res.content)
|
|
24
|
+
#print('req:', json.dumps(data))
|
|
25
|
+
#print('res:',json.loads(res.content))
|
|
26
|
+
except requests.ConnectionError:
|
|
27
|
+
logging.error("New Authorization: Failed!!! Message: Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
28
|
+
exit(1) #server/saas error
|
|
29
|
+
else:
|
|
30
|
+
if res.status_code == 200:
|
|
31
|
+
try:
|
|
32
|
+
json_response = json.loads(res.content)
|
|
33
|
+
logging.info("New Authorization: Success!!! Message: Successfully Authorized")
|
|
34
|
+
# logging.info(json_response)
|
|
35
|
+
except:
|
|
36
|
+
logging.info('New Authorization: Failed!!! exit code: 2 (AUTH ERROR) Message: Authorization Failed unable to load json response')
|
|
37
|
+
exit(2) ##auth error
|
|
38
|
+
try:
|
|
39
|
+
sca_configuration = json_response['sca']
|
|
40
|
+
|
|
41
|
+
except:
|
|
42
|
+
logging.error('New Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team')
|
|
43
|
+
#uploadLogs() this wont work because the scan is not initated.
|
|
44
|
+
exit(1) ## server error
|
|
45
|
+
elif res.status_code == 401:
|
|
46
|
+
logging.error('New Authorization: Failed!!! exit code: 2 (Server ERROR) Message: Problem occured while authorizing the scan , Please check authorization tokens correct. If you are still facing the same problem.')
|
|
47
|
+
exit(2) ##auth error
|
|
48
|
+
else:
|
|
49
|
+
logging.error(f'New Authorization: Failed!!! exit code: 2 (Server ERROR) Message: Boman returned status code: {res.status_code}({res.reason})')
|
|
50
|
+
exit(2) ##auth error
|
|
51
|
+
Config.sca_present = (sca_configuration['configured'])
|
|
52
|
+
Config.sca_build_dir = os.getcwd()+'/'
|
|
53
|
+
if Config.sca_present:
|
|
54
|
+
Config.sca_type = sca_configuration['type'].lower()
|
|
55
|
+
Config.sca_target = sca_configuration['target']
|
|
56
|
+
Config.sca_ignore = True if sca_configuration['ignore_files'].lower() == "true" else False
|
|
57
|
+
Config.sca_ignore_folders_and_files = sca_configuration['sca_ignore_file_data']
|
|
58
|
+
if Config.sca_type == "directory":
|
|
59
|
+
file_present = False
|
|
60
|
+
for filename in Config.osv_supported_files:
|
|
61
|
+
if Config.sca_target is None:
|
|
62
|
+
if recursive_file_present_check(Config.sca_build_dir,filename):
|
|
63
|
+
file_present =True
|
|
64
|
+
Config.sca_target= ""
|
|
65
|
+
logging.info(f"New Authorization: Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
66
|
+
break
|
|
67
|
+
else:
|
|
68
|
+
if recursive_file_present_check(os.path.join(Config.sca_build_dir,Config.sca_target),filename):
|
|
69
|
+
file_present =True
|
|
70
|
+
Config.sca_target= os.path.join(Config.sca_target,filename)
|
|
71
|
+
logging.info(f"New Authorization: Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
72
|
+
break
|
|
73
|
+
if file_present:
|
|
74
|
+
Config.sca_lang ="osv"
|
|
75
|
+
else:
|
|
76
|
+
logging.warning(f"New Authorization: Boman has not found the dependency file which OSV supports.")
|
|
77
|
+
if Config.sca_target is not None:
|
|
78
|
+
Config.sca_build_dir = os.path.join(Config.sca_build_dir,Config.sca_target)
|
|
79
|
+
logging.info(f"New Authorization: build dir: {Config.sca_build_dir} ")
|
|
80
|
+
Config.sca_lang = "owasp dependency check"
|
|
81
|
+
elif file_present_check(os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))):
|
|
82
|
+
Config.sca_lang ="osv"
|
|
83
|
+
else:
|
|
84
|
+
logging.error(f"New Authorization: No such file found: {os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))}")
|
|
85
|
+
exit(4)
|
|
86
|
+
|
|
87
|
+
logging.info(f"Boman opted for: {Config.sca_lang} scan.")
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
## function to authorize and get the images form SAAS --------------------------------------------------------
|
|
93
|
+
def authorize():
|
|
94
|
+
|
|
95
|
+
url = Config.boman_url+"/api/app/authorize"
|
|
96
|
+
|
|
97
|
+
if Config.sca_present:
|
|
98
|
+
if Config.sca_type == "directory":
|
|
99
|
+
file_present = False
|
|
100
|
+
for filename in Config.osv_supported_files:
|
|
101
|
+
if Config.sca_target is None:
|
|
102
|
+
if recursive_file_present_check(Config.sca_build_dir,filename):
|
|
103
|
+
file_present =True
|
|
104
|
+
Config.sca_target= ""
|
|
105
|
+
logging.info(f"Authorization: Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
106
|
+
break
|
|
107
|
+
else:
|
|
108
|
+
if recursive_file_present_check(os.path.join(Config.sca_build_dir,Config.sca_target),filename):
|
|
109
|
+
file_present =True
|
|
110
|
+
Config.sca_target= os.path.join(Config.sca_target,filename)
|
|
111
|
+
logging.info(f"Authorization: Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
112
|
+
break
|
|
113
|
+
if file_present:
|
|
114
|
+
Config.sca_lang ="osv"
|
|
115
|
+
else:
|
|
116
|
+
logging.warning(f"Authorization: Boman has not found the dependency file")
|
|
117
|
+
if Config.sca_target is not None:
|
|
118
|
+
Config.sca_build_dir = os.path.join(Config.sca_build_dir,Config.sca_target)
|
|
119
|
+
logging.info(f"Authorization: build dir: {Config.sca_build_dir} ")
|
|
120
|
+
Config.sca_lang = "owasp dependency check"
|
|
121
|
+
elif file_present_check(os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))):
|
|
122
|
+
Config.sca_lang ="osv"
|
|
123
|
+
else:
|
|
124
|
+
logging.error(f"Authorization: Failed!!! Message: No such file found: {os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))}")
|
|
125
|
+
exit(4)
|
|
126
|
+
|
|
127
|
+
logging.info(f"Authorization: Boman opted for: {Config.sca_lang} scan")
|
|
128
|
+
logging.info('Authorization: Authenticating with boman server')
|
|
129
|
+
data = {'app_token': Config.app_token, 'customer_token': Config.customer_token, 'sast':Config.sast_present,"dast":Config.dast_present,"dast_type":Config.dast_type,"dast_auth_enabled":Config.dast_auth_present,"sast_langs":Config.sast_lang,"sca":Config.sca_present,"sca_langs":Config.sca_lang,"sca_scan_type":Config.sca_type,"secret_scan":Config.secret_scan_present,'container_scan': Config.con_scan_present,'container_scan_type': Config.con_scan_type,"sbom":Config.sbom_present,'iac':Config.iac_scan_present}
|
|
130
|
+
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
131
|
+
# logging.info(data)
|
|
132
|
+
try:
|
|
133
|
+
logging.info("Authorization: Communicating with SaaS for Authorization")
|
|
134
|
+
res = requests.post(url, json=data, headers=headers)
|
|
135
|
+
#print('req:', json.dumps(data))
|
|
136
|
+
#print('res:',json.loads(res.content))
|
|
137
|
+
except requests.ConnectionError:
|
|
138
|
+
logging.error("Authorization: Failed!!! Message: Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
139
|
+
exit(1) #server/saas error
|
|
140
|
+
else:
|
|
141
|
+
if res.status_code == 200:
|
|
142
|
+
try:
|
|
143
|
+
json_response = json.loads(res.content)
|
|
144
|
+
logging.info("Authorization: Success!!! Message: Successfully Authorized")
|
|
145
|
+
# logging.info(json_response)
|
|
146
|
+
except:
|
|
147
|
+
logging.info("Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
|
|
148
|
+
exit(1) #Server error
|
|
149
|
+
try:
|
|
150
|
+
Config.dast_response = json_response['data']['dast']
|
|
151
|
+
Config.sast_response = json_response['data']['sast']
|
|
152
|
+
Config.sca_response = json_response['data']['sca']
|
|
153
|
+
Config.secret_scan_response = json_response['data']['secret_scan']
|
|
154
|
+
Config.scan_token = json_response['data']['scan_token']
|
|
155
|
+
Config.scan_name = json_response['data']['scan_name']
|
|
156
|
+
Config.con_scan_response = json_response['data']['cs']
|
|
157
|
+
Config.sbom_response = json_response['data']['sbom']
|
|
158
|
+
Config.iac_scan_response = json_response['data']['iac']
|
|
159
|
+
|
|
160
|
+
return 1
|
|
161
|
+
except:
|
|
162
|
+
logging.info("Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
|
|
163
|
+
exit(1) ## server error
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
elif res.status_code == 401:
|
|
167
|
+
logging.error('Authorization: Failed!!! Message: Unauthorized Access. Check the tokens')
|
|
168
|
+
exit(2) ##auth error
|
|
169
|
+
else:
|
|
170
|
+
logging.error(f'Authorization: Failed!!! Message: Boman returned status code: {res.status_code}({res.reason})')
|
|
171
|
+
exit(2) ##auth error
|
|
172
|
+
|
|
173
|
+
# whether file present in the directory or not
|
|
174
|
+
def recursive_file_present_check(root_dir, file_name):
|
|
175
|
+
for root, dirs, files in os.walk(root_dir):
|
|
176
|
+
if file_name in files:
|
|
177
|
+
return os.path.join(root, file_name)
|
|
178
|
+
return None
|
|
179
|
+
|
|
180
|
+
# whether file present in the directory or not
|
|
181
|
+
def file_present_check(filename):
|
|
182
|
+
if os.path.isfile(filename):
|
|
183
|
+
return True
|
|
184
|
+
return False
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import coloredlogs, logging
|
|
2
2
|
# from Config import Config
|
|
3
|
+
import sys
|
|
3
4
|
|
|
4
5
|
from bomancli.Config import Config
|
|
5
6
|
|
|
@@ -38,9 +39,15 @@ class LogStream:
|
|
|
38
39
|
# Set up logging to use our custom stream
|
|
39
40
|
Config.log_stream = LogStream()
|
|
40
41
|
|
|
41
|
-
logging.basicConfig(stream=Config.log_stream,
|
|
42
|
-
level=logging.DEBUG,format='%(asctime)s
|
|
42
|
+
logging.basicConfig(stream=Config.log_stream,
|
|
43
|
+
level=logging.DEBUG,format='%(asctime)s — %(name)s — %(levelname)s — %(funcName)s:%(lineno)d — %(message)s',
|
|
43
44
|
datefmt='%Y-%m-%d %H:%M:%S')
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
coloredlogs.install(level='DEBUG')
|
|
47
|
+
coloredlogs.install(level='DEBUG',fmt='%(asctime)s %(name)s %(levelname)s %(funcName)s:%(lineno)d %(message)s', level_styles = {
|
|
48
|
+
'debug': {'color': 'blue'},
|
|
49
|
+
'info': {'color': 'green'},
|
|
50
|
+
'warning': {'color': 'yellow'},
|
|
51
|
+
'error': {'color': 'red', 'bold': True},
|
|
52
|
+
'critical': {'color': 'red', 'bold': True, 'background': 'white'}
|
|
53
|
+
})
|