def __init__(self): OutputPlugin.__init__(self) # These attributes hold the file pointers self._file = None # User configured parameters self._file_name = 'report.xml' self._timeFormat = '%a %b %d %H:%M:%S %Y' self._longTimestampString = str( time.strftime(self._timeFormat, time.localtime())) self._timestampString = str(int(time.time())) # List with additional xml elements self._errorXML = [] # xml self._xmldoc = xml.dom.minidom.Document() self._topElement = self._xmldoc.createElement("w3afrun") self._topElement.setAttribute("start", self._timestampString) self._topElement.setAttribute("startstr", self._longTimestampString) self._topElement.setAttribute("xmloutputversion", "2.0") # Add in the version details version_element = self._xmldoc.createElement("w3af-version") version_data = self._xmldoc.createTextNode( str(get_w3af_version.get_w3af_version())) version_element.appendChild(version_data) self._topElement.appendChild(version_element) self._scanInfo = self._xmldoc.createElement("scaninfo") # HistoryItem to get requests/responses self._history = HistoryItem()
def get_versions(): try: import gtk except ImportError: gtk_version = 'No GTK module installed' pygtk_version = 'No GTK module installed' else: gtk_version = ".".join(str(x) for x in gtk.gtk_version) pygtk_version = ".".join(str(x) for x in gtk.pygtk_version) # String containing the versions for python, gtk and pygtk versions = ' Python version: %s\n'\ ' GTK version: %s\n'\ ' PyGTK version: %s\n'\ ' w3af version:\n %s' w3af_version = '\n '.join(get_w3af_version().split('\n')) versions = versions % (sys.version.replace( '\n', ''), gtk_version, pygtk_version, w3af_version) return versions
def handle_crash(type, value, tb, **data): '''Function to handle any exception that is not addressed explicitly.''' if issubclass(type, KeyboardInterrupt ): helpers.endThreads() import core.controllers.outputManager as om om.out.console(_('Thanks for using w3af.')) om.out.console(_('Bye!')) sys.exit(0) return exception = traceback.format_exception(type, value, tb) exception = "".join(exception) print exception # get version info for python, gtk and pygtk versions = _("\nPython version:\n%s\n\n") % sys.version versions += _("GTK version:%s\n") % ".".join(str(x) for x in gtk.gtk_version) versions += _("PyGTK version:%s\n\n") % ".".join(str(x) for x in gtk.pygtk_version) # get the version info for w3af versions += '\n' + get_w3af_version() # save the info to a file filename = tempfile.gettempdir() + os.path.sep + "w3af_crash-" + createRandAlNum(5) + ".txt" arch = file(filename, "w") arch.write(_('Submit this bug here: https://sourceforge.net/apps/trac/w3af/newticket \n')) arch.write(versions) arch.write(exception) arch.close() # Create the dialog that allows the user to send the bug to sourceforge bug_report_win = bug_report.bug_report_window(_('Bug detected!'), exception, versions, filename, **data) # Blocks waiting for user interaction bug_report_win.show()
def get_versions(): try: import gtk except ImportError: gtk_version = 'No GTK module installed' pygtk_version = 'No GTK module installed' else: gtk_version = ".".join(str(x) for x in gtk.gtk_version) pygtk_version = ".".join(str(x) for x in gtk.pygtk_version) # String containing the versions for python, gtk and pygtk versions = ' Python version: %s\n'\ ' GTK version: %s\n'\ ' PyGTK version: %s\n'\ ' w3af version:\n %s' w3af_version = '\n '.join(get_w3af_version().split('\n')) versions = versions % (sys.version.replace('\n', ''), gtk_version, pygtk_version, w3af_version) return versions
def _cmd_version(self, params): ''' Show the w3af version and exit ''' om.out.console( get_w3af_version() )
def _cmd_version(self, params): """ Show the w3af version and exit """ om.out.console(get_w3af_version())
import StringIO from core.controllers.misc.get_w3af_version import get_w3af_version from core.data.fuzzer.fuzzer import createRandAlNum # String containing the versions for python, gtk and pygtk VERSIONS = ''' Python version:\n%s\n GTK version:%s PyGTK version:%s\n\n %s ''' % \ (sys.version, ".".join(str(x) for x in gtk_version), ".".join(str(x) for x in pygtk_version), get_w3af_version()) def pprint_plugins( w3af_core ): # Return a pretty-printed string from the plugins dicts import copy from itertools import chain plugs_opts = copy.deepcopy(w3af_core.plugins.getAllPluginOptions()) plugs = w3af_core.plugins.getAllEnabledPlugins() for ptype, plist in plugs.iteritems(): for p in plist: if p not in chain(*(pt.keys() for pt in \ plugs_opts.itervalues())): plugs_opts[ptype][p] = {} plugins = StringIO.StringIO()
def _cmd_version(self, params): ''' Show the w3af version and exit ''' om.out.console(get_w3af_version())