MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / write

Method write

lib/utils/api.py:234–262  ·  view source on GitHub ↗
(self, value, status=CONTENT_STATUS.IN_PROGRESS, content_type=None)

Source from the content-addressed store, hash-verified

232 sys.stderr = self
233
234 def write(self, value, status=CONTENT_STATUS.IN_PROGRESS, content_type=None):
235 if self.messagetype == "stdout":
236 if content_type is None:
237 if kb.partRun is not None:
238 content_type = PART_RUN_CONTENT_TYPES.get(kb.partRun)
239 else:
240 # Ignore all non-relevant messages
241 return
242
243 output = conf.databaseCursor.execute("SELECT id, status, value FROM data WHERE taskid = ? AND content_type = ?", (self.taskid, content_type))
244
245 # Delete partial output from IPC database if we have got a complete output
246 if status == CONTENT_STATUS.COMPLETE:
247 if len(output) > 0:
248 for index in xrange(len(output)):
249 conf.databaseCursor.execute("DELETE FROM data WHERE id = ?", (output[index][0],))
250
251 conf.databaseCursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)", (self.taskid, status, content_type, jsonize(value)))
252 if kb.partRun:
253 kb.partRun = None
254
255 elif status == CONTENT_STATUS.IN_PROGRESS:
256 if len(output) == 0:
257 conf.databaseCursor.execute("INSERT INTO data VALUES(NULL, ?, ?, ?, ?)", (self.taskid, status, content_type, jsonize(value)))
258 else:
259 new_value = "%s%s" % (dejsonize(output[0][2]), value)
260 conf.databaseCursor.execute("UPDATE data SET value = ? WHERE id = ?", (jsonize(new_value), output[0][0]))
261 else:
262 conf.databaseCursor.execute("INSERT INTO errors VALUES(NULL, ?, ?)", (self.taskid, str(value) if value else ""))
263
264 def flush(self):
265 pass

Callers 15

mainFunction · 0.45
do_REQUESTMethod · 0.45
mainFunction · 0.45
_speaker_beepFunction · 0.45
mainFunction · 0.45
icmpsh_m.pyFile · 0.45
storeHashesToFileFunction · 0.45
_show_consoleMethod · 0.45
do_GETMethod · 0.45
storeResultsToFileFunction · 0.45
onReturnPressFunction · 0.45
purgeFunction · 0.45

Calls 5

jsonizeFunction · 0.90
dejsonizeFunction · 0.90
xrangeClass · 0.85
getMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected