我在bottle
之上构建了一个非常简单的API服务器。只是在被调用时返回JSON,JSON的内容是随机字符串。它很棒。
此服务器昨天被漏洞扫描程序(nessus
)扫描并因扫描程序的错误行为而崩溃。我在下面添加了Traceback信息,其中显示了error: [Errno 10054] An existing connection was forcibly closed by the remote host
例外。
我的问题如下:谁应该处理这个问题?
这是nessus
,它是不是在做什么?一方面是的,它应该以标准方式运行(这是一种扫描仪,其中包括用于工业扫描的扫描仪,它可以满足各种设备并且应该尝试降低崩溃的风险)。另一方面,生活是残酷的,接收端(被扫描的东西)应该能够应付。
这是bottle
吗?它是一个框架,应该处理典型的,不那么典型的Web流量,并给程序员留下处理业务逻辑而不是内部的任务
这是我吗?处理所有可能的例外
我问我希望帮助改进nessus
或bottle
(或我自己) - 这不是一个严格的编程问题(“如何捕捉异常”)所以如果你真的感觉如此,投票以意见为基础关闭,但我仍然要求我将其视为“程序员方法论”问题。
错误堆栈:
C:\Python27\python.exe C:/Users/yop/Documents/dev/infoscreen/webserver.py
10.81.163.129 - - [03/Feb/2015 18:21:00] code 400, message Bad request syntax ('\x16\x03\x01\x00\xea\x01\x00\x00\xe6\x03\x01T\xd1\x03|\xb3\x02lm\xf0\xb92\x9a\xd7\xa7\xec\xbca\xdaR9\xfc\xe3]);`\xfbI\x98\x17\x94\xe3\x00\x00x\xc0\x14\xc0')
10.81.163.129 - - [03/Feb/2015 18:21:05] code 400, message Bad HTTP/0.9 request type ('\x16\x03\x01\x00\xea\x01\x00\x00\xe6\x03\x01T\xd1\x03\x81\xfcxI\x0e\xd5\xc4\xba\x17\xd9\x92\x9f+\x83BR\x10\x94N\xa5\x12\xc0')
10.81.163.129 - - [03/Feb/2015 18:21:24] code 400, message Bad request version ('Secure-HTTP/1.4')
10.81.163.129 - - [03/Feb/2015 18:21:24] code 400, message Bad request syntax ("\x16\x03\x01\x00\xea\x01\x00\x00\xe6\x03\x01T\xd1\x03\x95\x95\x154\x94h/5\x8dL\xa6\x148\x04#s\x13\x9f'\xec\x1az\xbc\x87/L\x0e\xc7\x02\x00\x00x\xc0\x14\xc0")
Traceback (most recent call last):
----------------------------------------
File "C:\Python27\lib\SocketServer.py", line 295, in _handle_request_noblock
Exception happened during processing of request from ('10.81.163.129', 57035)
self.process_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\SocketServer.py", line 651, in __init__
self.handle()
File "C:\Python27\lib\wsgiref\simple_server.py", line 117, in handle
if not self.parse_request(): # An error code has been sent, just exit
File "C:\Python27\lib\BaseHTTPServer.py", line 291, in parse_request
self.headers = self.MessageClass(self.rfile, 0)
File "C:\Python27\lib\mimetools.py", line 25, in __init__
----------------------------------------
rfc822.Message.__init__(self, fp, seekable)
File "C:\Python27\lib\rfc822.py", line 108, in __init__
self.readheaders()
File "C:\Python27\lib\rfc822.py", line 155, in readheaders
line = self.fp.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
Traceback (most recent call last):
----------------------------------------
File "C:\Python27\lib\SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
Exception happened during processing of request from ('10.81.163.129', 37539)
File "C:\Python27\lib\SocketServer.py", line 321, in process_request
----------------------------------------
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\SocketServer.py", line 651, in __init__
self.handle()
File "C:\Python27\lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
Traceback (most recent call last):
Exception happened during processing of request from ('10.81.163.129', 38322)
File "C:\Python27\lib\SocketServer.py", line 295, in _handle_request_noblock
----------------------------------------
self.process_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\SocketServer.py", line 651, in __init__
self.handle()
File "C:\Python27\lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
Process finished with exit code -1