Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.


#8 How to run w3af from Jenkins or Hudson


I'm trying to run w3af from Jenkins ( or Hudson against our development server after we deployed our latest software to a server.

If I run a batch file with the following command - It runs fine producing the html report I need.

set HOME=C:\testApps\w3af\w3af_scripts\devtest
"C:\testApps\w3af\w3af\w3af_console.bat" -ns C:\testApps\w3af\w3af_scripts\devtest\dev_test.w3af

If I run the same batch file from Jenkins or Hudson it fails:
Traceback (most recent call last):
File "w3af\w3af_console", line 153, in <module>
errCode = main()
File "w3af\w3af_console", line 149, in main
File "C:\testApps\w3af\w3af\w3af\core\ui\consoleUi\", line 138, in sh
File "C:\testApps\w3af\w3af\w3af\core\ui\consoleUi\", line 445, in _showPrompt
term.write(self._context.getPath() + ">>> ")
File "C:\testApps\w3af\w3af\w3af\core\ui\consoleUi\io\", line 43, in write
File "C:\testApps\w3af\w3af\Python26\lib\site-packages\pyreadline\console\", line 379, in write
return self.write_color(text)
File "C:\testApps\w3af\w3af\Python26\lib\site-packages\pyreadline\console\", line 355, in write_color
text = ensure_unicode(text)
File "C:\testApps\w3af\w3af\Python26\lib\site-packages\pyreadline\", line 20, in ensure_unicode
return text.decode(pyreadline_codepage, "replace")
TypeError: decode() argument 1 must be string, not None

The problem is the output.
w3af is doing something that is affecting standard output.
The problem can be recreated without Jenkins or Hudson by just redirect the output from the above batch script.

TestRun.bat > output.txt

I tried it on Windows XP and Windows Server 2008 - same result.

Any help or trick would be appreciated.


  • Andres Riancho
    Andres Riancho

    Sorry but I can't help you without spending significant time on it. This seems to be a problem with pyreadline. What I would do (and I think you can do that too) is:
    * Find a minimal PoC that uses pyreadline and reproduces this error
    * Post that PoC to the pyreadline developer forum (or send to the developer?)
    * Get a response :)
    * Apply the fix to w3af [if any is needed]
    * Send me the patch so I can apply it to w3af

  • EKS_Forge

    Not being a Pyton developer I was not going to try and attempt to setup a test environment since know nothing about pyreadline never mind finding the correct forums to post a follow-up questions on :(

    So I did the next best thing, cheat :)

    w3af\python26\Lib\site-packages\pyreadline\console\ line 355.
    I comment out the validation - #text = ensure_unicode(text)
    Now when I run the TestRun.bat file the console output displays a bunch of unreadable txt (no longer readable), BUT since my script is setup to also output to an html file (what I really need) – that file is perfect shape!

    This might help someone else to get automation going.