Skip to content

Commit 2acf8a4

Browse files
author
Hysia
authored
Merge pull request #146 from h4rdy/dev
在console模式下,修复未设置目标url直接进行attack/verify导致的异常情况。
2 parents a2935bb + 89a5d6e commit 2acf8a4

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

pocsuite/lib/core/option.py

+19-15
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,26 @@ def setMultipleTarget():
216216
if not conf.urlFile:
217217
for pocname, pocInstance in kb.registeredPocs.items():
218218
target_urls = []
219-
if conf.url.endswith('/24'):
220-
try:
221-
socket.inet_aton(conf.url.split('/')[0])
222-
base_addr = conf.url[:conf.url.rfind('.') + 1]
223-
target_urls = ['{}{}'.format(base_addr, i)
224-
for i in xrange(1, 255 + 1)]
225-
except socket.error:
226-
errMsg = 'only id address acceptable'
227-
logger.log(CUSTOM_LOGGING.ERROR, errMsg)
219+
if conf.url:
220+
if conf.url.endswith('/24'):
221+
try:
222+
socket.inet_aton(conf.url.split('/')[0])
223+
base_addr = conf.url[:conf.url.rfind('.') + 1]
224+
target_urls = ['{}{}'.format(base_addr, i)
225+
for i in xrange(1, 255 + 1)]
226+
except socket.error:
227+
errMsg = 'only id address acceptable'
228+
logger.log(CUSTOM_LOGGING.ERROR, errMsg)
229+
else:
230+
target_urls = conf.url.split(',')
231+
232+
for url in target_urls:
233+
if url:
234+
kb.targets.put((url, pocInstance, pocname))
228235
else:
229-
target_urls = conf.url.split(',')
230-
231-
for url in target_urls:
232-
if url:
233-
kb.targets.put((url, pocInstance, pocname))
234-
236+
errMsg = 'the url needs to be set'
237+
logger.log(CUSTOM_LOGGING.ERROR, errMsg)
238+
break
235239
return
236240

237241
conf.urlFile = safeExpandUser(conf.urlFile)

0 commit comments

Comments
 (0)