boman-cli 2.3.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.3.0 → boman-cli-2.4.0}/PKG-INFO +10 -5
- {boman-cli-2.3.0 → boman-cli-2.4.0}/README.md +9 -4
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/PKG-INFO +10 -5
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/requires.txt +1 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/Config.py +2 -2
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/auth.py +33 -27
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/base_logger.py +10 -3
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/main.py +208 -286
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/utils.py +3 -1
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/validation.py +98 -94
- {boman-cli-2.3.0 → boman-cli-2.4.0}/setup.cfg +1 -1
- {boman-cli-2.3.0 → boman-cli-2.4.0}/setup.py +1 -1
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/SOURCES.txt +0 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/dependency_links.txt +0 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/entry_points.txt +0 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/boman_cli.egg-info/top_level.txt +0 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/_init_.py +0 -0
- {boman-cli-2.3.0 → boman-cli-2.4.0}/bomancli/loc_finder.py +0 -0
- {boman-cli-2.3.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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -80,7 +80,7 @@ class Config:
|
|
|
80
80
|
secret_scan_response = None
|
|
81
81
|
# custom_zap_auth_method = False
|
|
82
82
|
# zap_custom_auth_method = 'form'
|
|
83
|
-
|
|
83
|
+
zap_plan_config = None
|
|
84
84
|
# custom_zap_plan_present = False
|
|
85
85
|
zap_script_config = None
|
|
86
86
|
custom_zap_script_present = False
|
|
@@ -120,7 +120,7 @@ class Config:
|
|
|
120
120
|
|
|
121
121
|
log_level = "INFO"
|
|
122
122
|
|
|
123
|
-
version = 'v2.
|
|
123
|
+
version = 'v2.4.0'
|
|
124
124
|
|
|
125
125
|
boman_config_file = 'boman.yaml'
|
|
126
126
|
|
|
@@ -7,6 +7,8 @@ from bomancli import utils as Utils
|
|
|
7
7
|
import os
|
|
8
8
|
import json
|
|
9
9
|
|
|
10
|
+
logging.basicConfig(format='%(asctime)s — %(name)s — %(levelname)s — %(funcName)s:%(lineno)d — %(message)s')
|
|
11
|
+
|
|
10
12
|
# new authorization which just authorize the cli run using app token and customer token.
|
|
11
13
|
# This api gets SCA configuration as well to decide which tool to be used (OSV or owasp dependency check)
|
|
12
14
|
def new_authorize():
|
|
@@ -16,33 +18,35 @@ def new_authorize():
|
|
|
16
18
|
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
17
19
|
try:
|
|
18
20
|
# logging.info(data_new)
|
|
21
|
+
logging.info("New Authorization: Communicating with SaaS for Authorization")
|
|
19
22
|
res = requests.post(url_new, json=data_new, headers=headers)
|
|
20
23
|
# logging.info(res.content)
|
|
21
24
|
#print('req:', json.dumps(data))
|
|
22
25
|
#print('res:',json.loads(res.content))
|
|
23
26
|
except requests.ConnectionError:
|
|
24
|
-
logging.error("Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
27
|
+
logging.error("New Authorization: Failed!!! Message: Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
25
28
|
exit(1) #server/saas error
|
|
26
29
|
else:
|
|
27
30
|
if res.status_code == 200:
|
|
28
31
|
try:
|
|
29
32
|
json_response = json.loads(res.content)
|
|
30
|
-
logging.info(
|
|
33
|
+
logging.info("New Authorization: Success!!! Message: Successfully Authorized")
|
|
31
34
|
# logging.info(json_response)
|
|
32
35
|
except:
|
|
33
|
-
logging.info('
|
|
36
|
+
logging.info('New Authorization: Failed!!! exit code: 2 (AUTH ERROR) Message: Authorization Failed unable to load json response')
|
|
37
|
+
exit(2) ##auth error
|
|
34
38
|
try:
|
|
35
39
|
sca_configuration = json_response['sca']
|
|
36
40
|
|
|
37
41
|
except:
|
|
38
|
-
logging.error('Problem
|
|
42
|
+
logging.error('New Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team')
|
|
39
43
|
#uploadLogs() this wont work because the scan is not initated.
|
|
40
44
|
exit(1) ## server error
|
|
41
45
|
elif res.status_code == 401:
|
|
42
|
-
logging.error('
|
|
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.')
|
|
43
47
|
exit(2) ##auth error
|
|
44
48
|
else:
|
|
45
|
-
logging.error(f'Boman returned status code: {res.status_code}({res.reason})')
|
|
49
|
+
logging.error(f'New Authorization: Failed!!! exit code: 2 (Server ERROR) Message: Boman returned status code: {res.status_code}({res.reason})')
|
|
46
50
|
exit(2) ##auth error
|
|
47
51
|
Config.sca_present = (sca_configuration['configured'])
|
|
48
52
|
Config.sca_build_dir = os.getcwd()+'/'
|
|
@@ -58,29 +62,29 @@ def new_authorize():
|
|
|
58
62
|
if recursive_file_present_check(Config.sca_build_dir,filename):
|
|
59
63
|
file_present =True
|
|
60
64
|
Config.sca_target= ""
|
|
61
|
-
logging.info(f"Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,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)}")
|
|
62
66
|
break
|
|
63
67
|
else:
|
|
64
68
|
if recursive_file_present_check(os.path.join(Config.sca_build_dir,Config.sca_target),filename):
|
|
65
69
|
file_present =True
|
|
66
70
|
Config.sca_target= os.path.join(Config.sca_target,filename)
|
|
67
|
-
logging.info(f"Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
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)}")
|
|
68
72
|
break
|
|
69
73
|
if file_present:
|
|
70
74
|
Config.sca_lang ="osv"
|
|
71
75
|
else:
|
|
72
|
-
logging.warning(f"Boman has not found the dependency file")
|
|
76
|
+
logging.warning(f"New Authorization: Boman has not found the dependency file which OSV supports.")
|
|
73
77
|
if Config.sca_target is not None:
|
|
74
78
|
Config.sca_build_dir = os.path.join(Config.sca_build_dir,Config.sca_target)
|
|
75
|
-
logging.info(f"build dir: {Config.sca_build_dir} ")
|
|
79
|
+
logging.info(f"New Authorization: build dir: {Config.sca_build_dir} ")
|
|
76
80
|
Config.sca_lang = "owasp dependency check"
|
|
77
81
|
elif file_present_check(os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))):
|
|
78
82
|
Config.sca_lang ="osv"
|
|
79
83
|
else:
|
|
80
|
-
logging.error(f"No such file found: {os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))}")
|
|
84
|
+
logging.error(f"New Authorization: No such file found: {os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))}")
|
|
81
85
|
exit(4)
|
|
82
86
|
|
|
83
|
-
logging.info(f"Boman opted for: {Config.sca_lang} scan")
|
|
87
|
+
logging.info(f"Boman opted for: {Config.sca_lang} scan.")
|
|
84
88
|
|
|
85
89
|
|
|
86
90
|
|
|
@@ -98,48 +102,50 @@ def authorize():
|
|
|
98
102
|
if recursive_file_present_check(Config.sca_build_dir,filename):
|
|
99
103
|
file_present =True
|
|
100
104
|
Config.sca_target= ""
|
|
101
|
-
logging.info(f"Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,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)}")
|
|
102
106
|
break
|
|
103
107
|
else:
|
|
104
108
|
if recursive_file_present_check(os.path.join(Config.sca_build_dir,Config.sca_target),filename):
|
|
105
109
|
file_present =True
|
|
106
110
|
Config.sca_target= os.path.join(Config.sca_target,filename)
|
|
107
|
-
logging.info(f"Boman has found the dependency file: {filename} in the path: {os.path.join(Config.sca_build_dir,Config.sca_target)}")
|
|
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)}")
|
|
108
112
|
break
|
|
109
113
|
if file_present:
|
|
110
114
|
Config.sca_lang ="osv"
|
|
111
115
|
else:
|
|
112
|
-
logging.warning(f"Boman has not found the dependency file")
|
|
116
|
+
logging.warning(f"Authorization: Boman has not found the dependency file")
|
|
113
117
|
if Config.sca_target is not None:
|
|
114
118
|
Config.sca_build_dir = os.path.join(Config.sca_build_dir,Config.sca_target)
|
|
115
|
-
logging.info(f"build dir: {Config.sca_build_dir} ")
|
|
119
|
+
logging.info(f"Authorization: build dir: {Config.sca_build_dir} ")
|
|
116
120
|
Config.sca_lang = "owasp dependency check"
|
|
117
121
|
elif file_present_check(os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))):
|
|
118
122
|
Config.sca_lang ="osv"
|
|
119
123
|
else:
|
|
120
|
-
logging.error(f"No such file found: {os.path.join(Config.sca_build_dir,Utils.remove_leading_slash(Config.sca_target))}")
|
|
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))}")
|
|
121
125
|
exit(4)
|
|
122
126
|
|
|
123
|
-
logging.info(f"Boman opted for: {Config.sca_lang} scan")
|
|
124
|
-
logging.info('Authenticating with boman server')
|
|
127
|
+
logging.info(f"Authorization: Boman opted for: {Config.sca_lang} scan")
|
|
128
|
+
logging.info('Authorization: Authenticating with boman server')
|
|
125
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}
|
|
126
130
|
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
|
|
127
131
|
# logging.info(data)
|
|
128
132
|
try:
|
|
133
|
+
logging.info("Authorization: Communicating with SaaS for Authorization")
|
|
129
134
|
res = requests.post(url, json=data, headers=headers)
|
|
130
135
|
#print('req:', json.dumps(data))
|
|
131
136
|
#print('res:',json.loads(res.content))
|
|
132
137
|
except requests.ConnectionError:
|
|
133
|
-
logging.error("Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
138
|
+
logging.error("Authorization: Failed!!! Message: Can't connect to the Server while authorizing, Please check your Internet connection.")
|
|
134
139
|
exit(1) #server/saas error
|
|
135
140
|
else:
|
|
136
141
|
if res.status_code == 200:
|
|
137
142
|
try:
|
|
138
143
|
json_response = json.loads(res.content)
|
|
139
|
-
logging.info(
|
|
144
|
+
logging.info("Authorization: Success!!! Message: Successfully Authorized")
|
|
140
145
|
# logging.info(json_response)
|
|
141
146
|
except:
|
|
142
|
-
logging.info(
|
|
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
|
|
143
149
|
try:
|
|
144
150
|
Config.dast_response = json_response['data']['dast']
|
|
145
151
|
Config.sast_response = json_response['data']['sast']
|
|
@@ -153,16 +159,16 @@ def authorize():
|
|
|
153
159
|
|
|
154
160
|
return 1
|
|
155
161
|
except:
|
|
156
|
-
logging.
|
|
157
|
-
#uploadLogs() this wont work because the scan is not initated.
|
|
162
|
+
logging.info("Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
|
|
158
163
|
exit(1) ## server error
|
|
159
164
|
|
|
160
165
|
|
|
161
166
|
elif res.status_code == 401:
|
|
162
|
-
logging.error('Unauthorized Access. Check the tokens')
|
|
167
|
+
logging.error('Authorization: Failed!!! Message: Unauthorized Access. Check the tokens')
|
|
168
|
+
exit(2) ##auth error
|
|
163
169
|
else:
|
|
164
|
-
logging.error(f'Boman returned status code: {res.status_code}({res.reason})')
|
|
165
|
-
|
|
170
|
+
logging.error(f'Authorization: Failed!!! Message: Boman returned status code: {res.status_code}({res.reason})')
|
|
171
|
+
exit(2) ##auth error
|
|
166
172
|
|
|
167
173
|
# whether file present in the directory or not
|
|
168
174
|
def recursive_file_present_check(root_dir, file_name):
|
|
@@ -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
|
+
})
|