sqlmapproject / sqlmap

Automatic SQL injection and database takeover tool
http://sqlmap.org
Other
32.5k stars 5.71k forks source link

Unhandled Exception: BrokenPipeError: [Errno 32] Broken pipe when running sqlmap #5255

Closed mai1x9 closed 1 year ago

mai1x9 commented 1 year ago

Describe the bug In very rare cases, sometimes handled exception is raised. as shown below, the error stack,

Traceback (most recent call last):
  File "sqlmap.py", line 222, in main
    start()
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/core/decorators.py", line 80, in _
    result = f(*args, **kwargs)
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/controller/controller.py", line 590, in start
    injection = checkSqlInjection(place, parameter, value)
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/controller/checks.py", line 662, in checkSqlInjection
    trueResult = Request.queryPage(reqPayload, place, timeBasedCompare=True, raise404=False)
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/core/decorators.py", line 80, in _
    result = f(*args, **kwargs)
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/request/connect.py", line 1470, in queryPage
    dataToStdout('.')
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/core/common.py", line 1037, in dataToStdout
    sys.stdout.flush()
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sqlmap.py", line 440, in main
    raise SystemExit
SystemExit

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "sqlmap.py", line 593, in <module>
    main()
  File "sqlmap.py", line 543, in main
    dataToStdout("\n[*] ending @ %s\n\n" % time.strftime("%X /%Y-%m-%d/"), forceOutput=True)
  File "/home/lns_vm05/Desktop/sqlinjection/sqlmap/lib/core/common.py", line 1037, in dataToStdout
    sys.stdout.flush()
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

To Reproduce

Running environment:

Target details:

stamparm commented 1 year ago

you are redirecting/pipe-ing the output to something else (most probably file or smth), while something interrupts it (e.g. Ctrl-C or similar). anyhow, with the latest revision it should behave "better"