Skip to content

Commit

Permalink
Improved exception handling in framework/http/requester.py to avoid c…
Browse files Browse the repository at this point in the history
…rashing OWTF for small library things like 'raise BadStatusLine(line)'
  • Loading branch information
7a committed May 1, 2013
1 parent d73da36 commit c10cba1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
14 changes: 12 additions & 2 deletions framework/http/requester.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ def send(self, s):

class MyHTTPHandler(urllib2.HTTPHandler):
def http_open(self, req):
return self.do_open(MyHTTPConnection, req)
try:
return self.do_open(MyHTTPConnection, req)
except KeyboardInterrupt:
raise KeyboardInterrupt # Not handled here
except Exception, e:
return '' # Can't have OWTF crash due to a library exception -i.e. raise BadStatusLine(line)-

class MyHTTPSConnection(httplib.HTTPSConnection):
def send(self, s):
Expand All @@ -52,7 +57,12 @@ def send(self, s):

class MyHTTPSHandler(urllib2.HTTPSHandler):
def https_open(self, req):
return self.do_open(MyHTTPSConnection, req)
try:
return self.do_open(MyHTTPSConnection, req)
except KeyboardInterrupt:
raise KeyboardInterrupt # Not handled here
except Exception, e:
return '' # Can't have OWTF crash due to a library exception -i.e. raise BadStatusLine(line)-

# SmartRedirectHandler is courtesy of: http://www.diveintopython.net/http_web_services/redirects.html
class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
Expand Down
2 changes: 2 additions & 0 deletions readme/CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
+ Fixed bug on draft Inbound proxy thanks to Bharadwaj Machiraju (@tunnelshade) for finding + fixing it! - https://github.com/7a/owtf/pull/16
+ Initial Kali Linux port (some tools still missing, the install script needs more work) thanks to Bharadwaj Machiraju (@tunnelshade) for a lot of help on this!
+ Fixed websecurify path, thanks to Anant Shrivastava (@anantshri) for finding and fixing the problem in a pull request!
+ Kali Linux fix: Removed setrubyenv.sh from default.cfg resource configuration file due to no longer being necessary and because it was stopping execution of ruby tools
+ Improved exception handling in framework/http/requester.py to avoid crashing OWTF for small library things like 'raise BadStatusLine(line)'

24/09/2012 - 0.15 "Brucon" pre-alpha release: Dedicated to Brucon (http://brucon.org), its organisers and attendants
+ Changed name to OWASP OWTF since this is an OWASP project now, thank you OWASP! - https://www.owasp.org/index.php/OWASP_OWTF
Expand Down

0 comments on commit c10cba1

Please sign in to comment.