boman-cli 2.4.1__tar.gz → 2.4.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boman-cli
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: CLI tool of boman.ai
5
5
  Home-page: https://boman.ai
6
6
  Author: Sumeru Software Solutions Pvt. Ltd.
@@ -88,11 +88,6 @@ Example: boman-cli -a run -zap_session_script ./session.js
88
88
 
89
89
  ### Release Note:
90
90
 
91
-
92
- ### V2.4.1
93
- - **New:** New CLI arguments for ZAP custom arguments.
94
-
95
-
96
91
  ### V2.3.0
97
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.
98
93
 
@@ -73,11 +73,6 @@ Example: boman-cli -a run -zap_session_script ./session.js
73
73
 
74
74
  ### Release Note:
75
75
 
76
-
77
- ### V2.4.1
78
- - **New:** New CLI arguments for ZAP custom arguments.
79
-
80
-
81
76
  ### V2.3.0
82
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.
83
78
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boman-cli
3
- Version: 2.4.1
3
+ Version: 2.4.2
4
4
  Summary: CLI tool of boman.ai
5
5
  Home-page: https://boman.ai
6
6
  Author: Sumeru Software Solutions Pvt. Ltd.
@@ -88,11 +88,6 @@ Example: boman-cli -a run -zap_session_script ./session.js
88
88
 
89
89
  ### Release Note:
90
90
 
91
-
92
- ### V2.4.1
93
- - **New:** New CLI arguments for ZAP custom arguments.
94
-
95
-
96
91
  ### V2.3.0
97
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.
98
93
 
@@ -81,7 +81,7 @@ class Config:
81
81
  # custom_zap_auth_method = False
82
82
  # zap_custom_auth_method = 'form'
83
83
  zap_plan_config = None
84
- # custom_zap_plan_present = False
84
+ custom_zap_plan_present = False
85
85
  zap_script_config = None
86
86
  custom_zap_script_present = False
87
87
  zap_plan_config_file_name = 'boman_zap_auth_plan' ## .yaml will be added by the function runtime
@@ -120,7 +120,7 @@ class Config:
120
120
 
121
121
  log_level = "INFO"
122
122
 
123
- version = 'v2.4.1'
123
+ version = 'v2.4.2'
124
124
 
125
125
  boman_config_file = 'boman.yaml'
126
126
 
@@ -189,6 +189,4 @@ class Config:
189
189
  iac_scan_configuration = None
190
190
 
191
191
 
192
- zap_custom_arg_present = False
193
- zap_custom_arg = None
194
-
192
+ dast_adv_auth_enabled = None
@@ -31,7 +31,12 @@ def new_authorize():
31
31
  try:
32
32
  json_response = json.loads(res.content)
33
33
  logging.info("New Authorization: Success!!! Message: Successfully Authorized")
34
- # logging.info(json_response)
34
+ if json_response['advanced_zap_auth']:
35
+ Config.dast_adv_auth_enabled = True
36
+ else:
37
+ Config.dast_adv_auth_enabled = False
38
+ logging.info(json_response)
39
+
35
40
  except:
36
41
  logging.info('New Authorization: Failed!!! exit code: 2 (AUTH ERROR) Message: Authorization Failed unable to load json response')
37
42
  exit(2) ##auth error
@@ -133,7 +138,7 @@ def authorize():
133
138
  logging.info("Authorization: Communicating with SaaS for Authorization")
134
139
  res = requests.post(url, json=data, headers=headers)
135
140
  #print('req:', json.dumps(data))
136
- #print('res:',json.loads(res.content))
141
+ logging.info('res: %s',json.loads(res.content))
137
142
  except requests.ConnectionError:
138
143
  logging.error("Authorization: Failed!!! Message: Can't connect to the Server while authorizing, Please check your Internet connection.")
139
144
  exit(1) #server/saas error
@@ -142,6 +147,10 @@ def authorize():
142
147
  try:
143
148
  json_response = json.loads(res.content)
144
149
  logging.info("Authorization: Success!!! Message: Successfully Authorized")
150
+ if json_response['data']['advanced_zap_auth']:
151
+ Config.dast_adv_auth_enabled = True
152
+ else:
153
+ Config.dast_adv_auth_enabled = False
145
154
  # logging.info(json_response)
146
155
  except:
147
156
  logging.info("Authorization: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
@@ -196,18 +196,16 @@ def runImage(data=None,type=None):
196
196
 
197
197
  Utils.checkImageAlreadyExsist(docker_image)
198
198
  logging.info('DAST Docker: Running %s on %s ',tool_name, Config.dast_target)
199
-
200
- if Config.zap_custom_arg_present:
201
- logging.info('DAST Docker: Custom arugument configured for ZAP [ command: %s ] ',Config.zap_custom_arg)
202
-
203
-
204
199
  logging.info('DAST Docker: Checking if Authenticated scan is configured...')
205
200
 
206
-
201
+ is_dast_auth_available = 0
202
+
207
203
  if Config.dast_auth_present == True:
208
204
  logging.info('DAST Docker: Authenticated scan is configured')
209
205
  logging.info('DAST Docker: Fetching Authenticated scan config from SaaS')
210
- Utils.fetchDASTConfigFromSaas()
206
+ is_dast_auth_available = Utils.fetchDASTConfigFromSaas()
207
+
208
+
211
209
  if Config.zap_plan_config is None:
212
210
  logging.warning('DAST Docker: Failed !!!. Message: Failed to fetch Authenticated scan config from SaaS')
213
211
  logging.warning('DAST Docker: Proceeding with DAST Baseline Scan')
@@ -246,7 +244,13 @@ def runImage(data=None,type=None):
246
244
  else:
247
245
  logging.info('DAST Docker: DAST Auth is not configured')
248
246
 
249
-
247
+ ## adding adv auth function here - MM
248
+ if Config.dast_adv_auth_enabled == True:
249
+ ## Calling the advance auth fucntion to fetch required files
250
+ ## logic to get files from saas and run the scan here by assigning all the required files to config
251
+ logging.info('DAST Docker: Zap Advanced Authentication is configured')
252
+ logging.info('DAST Docker: Fetching Zap config files from saas')
253
+ Utils.fetch_zap_advance_config()
250
254
 
251
255
  #command_line = '-h '+Config.dast_target+' -maxtime 10 -o tmp/'+output_file
252
256
  #print(command_line_nikto)
@@ -255,9 +259,6 @@ def runImage(data=None,type=None):
255
259
  if Config.sast_build_dir == None:
256
260
  Config.sast_build_dir = os.getcwd()+'/'
257
261
 
258
-
259
-
260
-
261
262
  if data['dynamic_comment'] == 1:
262
263
 
263
264
  target_url = Config.dast_target
@@ -266,11 +267,13 @@ def runImage(data=None,type=None):
266
267
  api_type = Config.dast_api_type
267
268
  command_line = "% s" % command_line.format(target_url = target_url, api_type=api_type)
268
269
  elif Config.dast_auth_present == True:
269
- # if Config.custom_zap_plan_present:
270
- # Config.zap_plan_config_file_name = Config.zap_plan_config_file_name
271
- # else:
272
- # Config.zap_plan_config_file_name = Config.zap_plan_config_file_name+'.yaml'
273
- command_line = "% s" % command_line.format(zap_plan_file = 'boman_zap_auth_plan.yaml')
270
+ if Config.custom_zap_plan_present:
271
+ Config.zap_plan_config_file_name = Config.zap_plan_config_file_name
272
+ else:
273
+ Config.zap_plan_config_file_name = Config.zap_plan_config_file_name+'.yaml'
274
+ command_line = "% s" % command_line.format(zap_plan_file = Config.zap_plan_config_file_name)
275
+ elif Config.dast_adv_auth_enabled == True:
276
+ command_line = "% s" % command_line.format(zap_plan_file = Config.zap_plan_config_file_name)
274
277
  else:
275
278
  command_line = "% s" % command_line.format(target_url = target_url)
276
279
 
@@ -290,20 +293,6 @@ def runImage(data=None,type=None):
290
293
  ## part where running dast based on the given env i.e jenkins or non jenkins
291
294
 
292
295
 
293
- ### adding custom argument for zap auth
294
-
295
-
296
- if Config.zap_custom_arg_present:
297
- command_line = command_line + " " + Config.zap_custom_arg
298
-
299
-
300
- logging.info('DAST Docker: custom argumented added with exisitng command %s', command_line)
301
- #exit(1)
302
-
303
-
304
-
305
-
306
-
307
296
 
308
297
  if Config.jenkins == 'yes':
309
298
 
@@ -338,6 +327,7 @@ def runImage(data=None,type=None):
338
327
 
339
328
  try:
340
329
  Config.build_dir = Config.sast_build_dir
330
+ logging.info('DAST Docker: Command for running the scan %s',command_line)
341
331
  container= docker.containers.run(docker_image, command_line, volumes={Config.sast_build_dir: {
342
332
  'bind': data['bind'], 'mode': 'rw'}},user=userid,detach=detach)
343
333
 
@@ -981,10 +971,9 @@ def default():
981
971
  parser.add_argument('-config','--config',default='boman.yaml',help="Pass the file name if you have any custom file name for the boman config. eg:boman-prod.yaml")
982
972
  # parser.add_argument('-custom_dast_auth_config','--custom_dast_auth_config',default=False,help="Pass True in the case of custom zap auth scan, this requires , -zap_auth_method , -zap_plan and -zap_session_script (incase of json auth method)")
983
973
  # parser.add_argument('-zap_auth_method','--zap_auth_method',default='form',help="Pass the auth method of DAST(zap) scan, supported method [form, json]. default value is form based")
984
- # parser.add_argument('-zap_plan','--zap_custom_plan',default='boman_zap_auth_plan.yaml',help="Pass the file name if you have any custom zap context plan. eg:custom-zap-plan.yaml")
974
+ parser.add_argument('-zap_plan','--zap_custom_plan',default='boman_zap_auth_plan.yaml',help="Pass the file name if you have any custom zap context plan. eg:custom-zap-plan.yaml")
985
975
  parser.add_argument('-zap_session_script','--zap_custom_session_script',default='session_management.js',help="Pass the file name if you have any custom zap session script file name. eg:custom-script.js")
986
976
  # parser.add_argument('-uid','--user_id',default='1000:1000',help="[internal] Pass the custom userid:groupid incase the lingu detec function is failed")
987
- parser.add_argument('-zap_arg','--zap_custom_arg',default=None,help="Pass the custom arguments for zap scanner")
988
977
  args = parser.parse_args()
989
978
 
990
979
  # if len(sys.args) == 1:
@@ -1037,14 +1026,14 @@ def default():
1037
1026
 
1038
1027
 
1039
1028
  ## custom script for zap auth scan automation
1040
- # if args.zap_custom_plan == 'boman_zap_auth_plan.yaml':
1041
- # Config.zap_plan_config_file_name = 'boman_zap_auth_plan.yaml'
1042
- # #exit(1)
1043
- # else:
1044
- # #logging.info('custom zap contct plan option is choosen')
1045
- # #Config.custom_zap_plan_present = True
1046
- # Config.zap_plan_config_file_name = args.zap_custom_plan
1047
- # #exit(1)
1029
+ if args.zap_custom_plan == 'boman_zap_auth_plan.yaml':
1030
+ Config.zap_plan_config_file_name = 'boman_zap_auth_plan.yaml'
1031
+ #exit(1)
1032
+ else:
1033
+ logging.info('custom zap contct plan option is choosen')
1034
+ Config.custom_zap_plan_present = True
1035
+ Config.zap_plan_config_file_name = args.zap_custom_plan
1036
+ #exit(1)
1048
1037
 
1049
1038
  ## custom script for zap auth scan automation
1050
1039
  if args.zap_custom_session_script == 'session_management.js':
@@ -1070,19 +1059,6 @@ def default():
1070
1059
  else:
1071
1060
  logging.error(f"Authorization Config: Failed !!!, Exit Code: 4 (Misconfiguration/Validation). The {Config.boman_config_file} file is not found and tokens were not found in cli arguments as well")
1072
1061
  exit(4) #validation error
1073
-
1074
-
1075
- #Zap custom arguments
1076
- if args.zap_custom_arg is not None:
1077
- Config.zap_custom_arg_present = True
1078
- Config.zap_custom_arg = args.zap_custom_arg
1079
- logging.info(f"Zap custom config: CLI has custom arguments: {Config.zap_custom_arg}")
1080
- else:
1081
- Config.zap_custom_arg_present = False
1082
-
1083
-
1084
-
1085
-
1086
1062
  ## auth method args validation
1087
1063
 
1088
1064
  # if args.custom_dast_auth_config == True:
@@ -1095,13 +1071,13 @@ def default():
1095
1071
  # exit(4)
1096
1072
 
1097
1073
 
1098
- # if Config.zap_custom_auth_method == 'form':
1099
- # if Config.custom_zap_plan_present :
1100
- # Config.dast_auth_present == True
1101
- # Config.custom_zap_plan_present = True
1102
- # else:
1103
- # logging.error('Zap auth method "form" needs plan file')
1104
- # exit(4)
1074
+ if Config.zap_custom_auth_method == 'form':
1075
+ if Config.custom_zap_plan_present :
1076
+ Config.dast_auth_present == True
1077
+ Config.custom_zap_plan_present = True
1078
+ else:
1079
+ logging.error('Zap auth method "form" needs plan file')
1080
+ exit(4)
1105
1081
 
1106
1082
 
1107
1083
 
@@ -1,139 +1,139 @@
1
- ---
2
- env:
3
- contexts:
4
- - name: "Boman Authenticated Scan"
5
- urls:
6
- - "https://demo.testfire.net/"
7
- authentication:
8
- method: "form"
9
- parameters: # May include any required for scripts. All of the parameters support vars except for the port
10
- loginPageUrl: "https://demo.testfire.net/login.jsp"
11
- loginRequestUrl: "https://demo.testfire.net/doLogin"
12
- loginRequestBody: "uid={%username%}&passw={%password%}&btnSubmit=Login"
13
- verification:
14
- method: "both" # String, one of 'response', 'request', 'both', 'poll'
15
- loggedOutRegex: ".*Sign In.*" # String, regex pattern for determining if logged
16
- sessionManagement:
17
- method: ""
18
- parameters:
19
- script: ""
20
- scriptEngine: ""
21
- users: # List of one or more users available to use for authentication
22
- - name: "demoadmin" # String, the name to be used by the jobs
23
- credentials: # List of user credentials - may include any required for scripts
24
- username: "admin" # String, the username to use when authenticating, vars supported
25
- password: "admin"
26
- includePaths: []
27
- excludePaths: []
28
- technology:
29
- exclude:
30
- - "C"
31
- - "ASP"
32
- - "IBM DB2"
33
- - "PHP"
34
- - "CouchDB"
35
- - "XML"
36
- - "Microsoft SQL Server"
37
- - "JSP/Servlet"
38
- - "Firebird"
39
- - "MongoDB"
40
- - "HypersonicSQL"
41
- - "SAP MaxDB"
42
- - "Ruby"
43
- - "SCM"
44
- - "WS"
45
- - "Microsoft Access"
46
- - "Sybase"
47
- - "Python"
48
- parameters:
49
- failOnError: true
50
- failOnWarning: false
51
- progressToStdout: true
52
- vars: {}
53
- jobs:
54
- - parameters:
55
- scanOnlyInScope: true
56
- enableTags: false
57
- disableAllRules: false
58
- rules: []
59
- name: "passiveScan-config"
60
- type: "passiveScan-config"
61
- - parameters:
62
- context: "Demo testfire"
63
- user: "demoadmin"
64
- url: "https://demo.testfire.net"
65
- maxDuration: 1
66
- maxDepth: 2
67
- maxChildren: 0
68
- name: "spider"
69
- type: "spider"
70
- tests:
71
- - onFail: "INFO"
72
- statistic: "automation.spider.urls.added"
73
- site: ""
74
- operator: ">="
75
- value: 100
76
- name: "At least 100 URLs found"
77
- type: "stats"
78
- - name: "spider logged in" # Name of the test, optional
79
- type: stats # Specifies that the test is of type 'stats'
80
- statistic: "stats.auth.success" # Name of an integer / long statistic
81
- operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
82
- value: 2 # Value to compare statistic against
83
- onFail: "info"
84
- - name: "spider failed" # Name of the test, optional
85
- type: stats # Specifies that the test is of type 'stats'
86
- statistic: "stats.auth.failure" # Name of an integer / long statisti
87
- operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
88
- value: 2 # Value to compare statistic against
89
- onFail: "info"
90
- - parameters: {}
91
- name: "passiveScan-wait"
92
- type: "passiveScan-wait"
93
- - parameters:
94
- context: "Demo testfire"
95
- user: "demoadmin"
96
- policy: ""
97
- maxRuleDurationInMins: 0
98
- maxScanDurationInMins: 5
99
- maxAlertsPerRule: 0
100
- policyDefinition:
101
- defaultStrength: "medium"
102
- defaultThreshold: "medium"
103
- rules: []
104
- tests:
105
- - name: "spider logged in" # Name of the test, optional
106
- type: stats # Specifies that the test is of type 'stats'
107
- statistic: "stats.auth.success" # Name of an integer / long statistic
108
- operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
109
- value: 2 # Value to compare statistic against
110
- onFail: "info"
111
- - name: "spider failed" # Name of the test, optional
112
- type: stats # Specifies that the test is of type 'stats'
113
- statistic: "stats.auth.failure" # Name of an integer / long statisti
114
- operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
115
- value: 2 # Value to compare statistic against
116
- onFail: "info"
117
- name: "activeScan"
118
- type: "activeScan"
119
- - parameters:
120
- template: "traditional-json"
121
- reportDir: ""
122
- reportFile: ""
123
- reportTitle: "Boman_Scanning_Report"
124
- reportDescription: ""
125
- displayReport: false
126
- risks:
127
- - "info"
128
- - "low"
129
- - "medium"
130
- - "high"
131
- confidences:
132
- - "falsepositive"
133
- - "low"
134
- - "medium"
135
- - "high"
136
- - "confirmed"
137
- sites: []
138
- name: "report"
139
- type: "report"
1
+ ---
2
+ env:
3
+ contexts:
4
+ - name: "Boman Authenticated Scan"
5
+ urls:
6
+ - "https://demo.testfire.net/"
7
+ authentication:
8
+ method: "form"
9
+ parameters: # May include any required for scripts. All of the parameters support vars except for the port
10
+ loginPageUrl: "https://demo.testfire.net/login.jsp"
11
+ loginRequestUrl: "https://demo.testfire.net/doLogin"
12
+ loginRequestBody: "uid={%username%}&passw={%password%}&btnSubmit=Login"
13
+ verification:
14
+ method: "both" # String, one of 'response', 'request', 'both', 'poll'
15
+ loggedOutRegex: ".*Sign In.*" # String, regex pattern for determining if logged
16
+ sessionManagement:
17
+ method: ""
18
+ parameters:
19
+ script: ""
20
+ scriptEngine: ""
21
+ users: # List of one or more users available to use for authentication
22
+ - name: "demoadmin" # String, the name to be used by the jobs
23
+ credentials: # List of user credentials - may include any required for scripts
24
+ username: "admin" # String, the username to use when authenticating, vars supported
25
+ password: "admin"
26
+ includePaths: []
27
+ excludePaths: []
28
+ technology:
29
+ exclude:
30
+ - "C"
31
+ - "ASP"
32
+ - "IBM DB2"
33
+ - "PHP"
34
+ - "CouchDB"
35
+ - "XML"
36
+ - "Microsoft SQL Server"
37
+ - "JSP/Servlet"
38
+ - "Firebird"
39
+ - "MongoDB"
40
+ - "HypersonicSQL"
41
+ - "SAP MaxDB"
42
+ - "Ruby"
43
+ - "SCM"
44
+ - "WS"
45
+ - "Microsoft Access"
46
+ - "Sybase"
47
+ - "Python"
48
+ parameters:
49
+ failOnError: true
50
+ failOnWarning: false
51
+ progressToStdout: true
52
+ vars: {}
53
+ jobs:
54
+ - parameters:
55
+ scanOnlyInScope: true
56
+ enableTags: false
57
+ disableAllRules: false
58
+ rules: []
59
+ name: "passiveScan-config"
60
+ type: "passiveScan-config"
61
+ - parameters:
62
+ context: "Demo testfire"
63
+ user: "demoadmin"
64
+ url: "https://demo.testfire.net"
65
+ maxDuration: 1
66
+ maxDepth: 2
67
+ maxChildren: 0
68
+ name: "spider"
69
+ type: "spider"
70
+ tests:
71
+ - onFail: "INFO"
72
+ statistic: "automation.spider.urls.added"
73
+ site: ""
74
+ operator: ">="
75
+ value: 100
76
+ name: "At least 100 URLs found"
77
+ type: "stats"
78
+ - name: "spider logged in" # Name of the test, optional
79
+ type: stats # Specifies that the test is of type 'stats'
80
+ statistic: "stats.auth.success" # Name of an integer / long statistic
81
+ operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
82
+ value: 2 # Value to compare statistic against
83
+ onFail: "info"
84
+ - name: "spider failed" # Name of the test, optional
85
+ type: stats # Specifies that the test is of type 'stats'
86
+ statistic: "stats.auth.failure" # Name of an integer / long statisti
87
+ operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
88
+ value: 2 # Value to compare statistic against
89
+ onFail: "info"
90
+ - parameters: {}
91
+ name: "passiveScan-wait"
92
+ type: "passiveScan-wait"
93
+ - parameters:
94
+ context: "Demo testfire"
95
+ user: "demoadmin"
96
+ policy: ""
97
+ maxRuleDurationInMins: 0
98
+ maxScanDurationInMins: 5
99
+ maxAlertsPerRule: 0
100
+ policyDefinition:
101
+ defaultStrength: "medium"
102
+ defaultThreshold: "medium"
103
+ rules: []
104
+ tests:
105
+ - name: "spider logged in" # Name of the test, optional
106
+ type: stats # Specifies that the test is of type 'stats'
107
+ statistic: "stats.auth.success" # Name of an integer / long statistic
108
+ operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
109
+ value: 2 # Value to compare statistic against
110
+ onFail: "info"
111
+ - name: "spider failed" # Name of the test, optional
112
+ type: stats # Specifies that the test is of type 'stats'
113
+ statistic: "stats.auth.failure" # Name of an integer / long statisti
114
+ operator: ">=" # One of '==', '!=', '>=', '>', '<', '<='
115
+ value: 2 # Value to compare statistic against
116
+ onFail: "info"
117
+ name: "activeScan"
118
+ type: "activeScan"
119
+ - parameters:
120
+ template: "traditional-json"
121
+ reportDir: ""
122
+ reportFile: ""
123
+ reportTitle: "Boman_Scanning_Report"
124
+ reportDescription: ""
125
+ displayReport: false
126
+ risks:
127
+ - "info"
128
+ - "low"
129
+ - "medium"
130
+ - "high"
131
+ confidences:
132
+ - "falsepositive"
133
+ - "low"
134
+ - "medium"
135
+ - "high"
136
+ - "confirmed"
137
+ sites: []
138
+ name: "report"
139
+ type: "report"
@@ -44,6 +44,7 @@ def checkImageAlreadyExsist(imagename):
44
44
 
45
45
  logging.info('Image is not present in the local machine')
46
46
  logging.info('Pulling the required image [%s]',imagename)
47
+ return 1
47
48
 
48
49
  try:
49
50
  pulled = docker.images.pull(imagename)
@@ -529,6 +530,8 @@ def fetchDASTConfigFromSaas():
529
530
 
530
531
  else:
531
532
  logging.info('No DAST Auth Config found on SaaS')
533
+ Config.zap_plan_config = None
534
+ return 0
532
535
 
533
536
 
534
537
  except requests.ConnectionError as e:
@@ -848,8 +851,99 @@ def getGitDetails():
848
851
  return {'repo':'None','branch':'None','commit_message':'None'}
849
852
 
850
853
 
854
+ #### create a zap plan and script with advanced scan
855
+ def download_file(url, save_path):
856
+ """
857
+ Downloads a file from the given URL and saves it to the specified path.
858
+
859
+ :param url: The URL of the file to download.
860
+ :param save_path: The path where the file will be saved.
861
+ :return: None
862
+ """
863
+ try:
864
+ url = url
865
+ response = requests.get(url, stream=True)
866
+ response.raise_for_status() # Raise an error for HTTP errors
867
+
868
+ with open(save_path, 'wb') as file:
869
+ for chunk in response.iter_content(chunk_size=8192):
870
+ file.write(chunk)
871
+
872
+ logging.info(f"File downloaded successfully and saved to {save_path}")
873
+ return 1
874
+ except requests.exceptions.RequestException as e:
875
+ logging.error(f"Failed to download file: {e}")
876
+
877
+
878
+
879
+ ### fetch zap advance auth config
880
+ def fetch_zap_advance_config():
881
+ logging.info('Initiating connection with SaaS')
882
+ #scan_token = Config.scan_token
883
+ app_token = Config.app_token
884
+ customer_token = Config.customer_token
885
+
886
+ url = Config.boman_url+"/api/app/advanced_zap_authentication"
887
+ values = {'app_token':app_token, 'customer_token':customer_token}
888
+ try:
889
+ x = requests.post(url,json=values)
890
+
891
+
892
+ response = x.json()
893
+
894
+
895
+
896
+ if response['status'] == True:
897
+ logging.info('Zap Advacne config: Analyzing DAST Auth config')
898
+
899
+ ## fetching the urls
900
+
901
+ config_files = response['zap_config']['files']
902
+ logging.info('Config from SaaS: %s',config_files)
903
+ files_count = len(config_files)
904
+ logging.info('Zap Advance Config: Total %s file(s) uploaded in saas' )
905
+ logging.info('Zap Advance Config: Downloading files one by one' )
906
+
907
+ plan_file_present_in_adv_zap_config = False
908
+ for file in config_files:
909
+ logging.info('Zap Advacne Config: Fetching from %s filename %s',file['file_path'], file['file_name'])
910
+ download_file(file['file_path'], file['file_name'])
911
+
912
+
913
+ if file['is_plan_file']:
914
+ Config.zap_plan_config_file_name = file['file_name']
915
+ #Config.dast_auth_present = True
916
+ Config.custom_zap_plan_present = True
917
+ # with open(Config.zap_plan_config_file_name , 'r') as file:
918
+ # Config.zap_plan_config = yaml.safe_load(file)
919
+ # print(Config.zap_plan_config)
920
+ # exit(1)
921
+ # logging.info('Validation: SUCCESS!!! Message: Config yaml file found and parsed')
922
+
923
+ plan_file_present_in_adv_zap_config = True
924
+ logging.info('Zap Advacne Config: Plan file found %s',Config.zap_plan_config_file_name)
925
+
926
+
927
+
928
+ logging.info('Zap Advance Config: files are downloaded')
929
+ if plan_file_present_in_adv_zap_config == False:
930
+ logging.info('Zap Advance Config: Plan.yaml file not found in the server, will be unable to continue the zap advance scan')
931
+ logging.info('Main: Terminating the scan')
932
+ exit(4)
933
+
934
+
935
+ return 1
936
+
937
+ else:
938
+ logging.info('No DAST Auth Config found on SaaS')
851
939
 
852
940
 
941
+ except requests.ConnectionError as e:
942
+
943
+ logging.error("Can't connect to the Server, Please check your Internet connection.")
944
+ logging.error(e)
945
+ exit(1) #server/saas error
946
+
853
947
 
854
948
  def uploadLogs():
855
949
 
@@ -354,8 +354,10 @@ def tool_configuration_validation():
354
354
  logging.info("Tool Config: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
355
355
  exit(1) #server error
356
356
  try:
357
- # logging.info( json_response['data'])
357
+ logging.info( json_response['data'])
358
+
358
359
  Config.dast_response = json_response['data']['dast']
360
+ logging.info(Config.dast_response)
359
361
  Config.sast_response = json_response['data']['sast']
360
362
  Config.sca_response = json_response['data']['sca']
361
363
  Config.secret_scan_response = json_response['data']['secret_scan']
@@ -363,7 +365,14 @@ def tool_configuration_validation():
363
365
  Config.scan_name = json_response['data']['scan_name']
364
366
  Config.con_scan_response = json_response['data']['cs']
365
367
  Config.sbom_response = json_response['data']['sbom']
366
- Config.iac_scan_response = json_response['data']['iac']
368
+ Config.iac_scan_response = json_response['data']['iac']
369
+
370
+
371
+ # if Config.json_response['data']['advanced_zap_auth']:
372
+ # Config.dast_adv_auth_enabled = True
373
+ # else:
374
+ # Config.dast_adv_auth_enabled = False
375
+
367
376
  except:
368
377
  logging.info("Tool Config: Failed!!! exit code: 1 (Server ERROR) Message: Problem occured while authorizing the scan, Please contact boman.ai team")
369
378
  exit(1) ## server error
@@ -1,9 +1,8 @@
1
1
  [metadata]
2
2
  environment = prod
3
- version = 2.4.1
3
+ version = 2.4.2
4
4
  name = boman-cli
5
- saas_base_url =
6
- https = //dashboard.boman.ai/
5
+ saas_base_url = https://dashboard.boman.ai/
7
6
 
8
7
  [egg_info]
9
8
  tag_build =
File without changes
File without changes