Not able to generate json from afr

sreedeep's Avatar


20 Nov, 2013 06:58 AM

I generated an afr file through command line But when i am trying to generate json file using the generated .afr file its give me this error

#<Encoding::UndefinedConversionError: "\xC2" from ASCII-8BIT to UTF-8>
  1. Support Staff 1 Posted by Tasos Laskos on 20 Nov, 2013 03:47 PM

    Tasos Laskos's Avatar

    Hey there,

    I fixed this issue a couple of days ago, some non-UTF8 data was getting into the AFR report. You can either grab one of the nightlies and re-run the scan or I can send you a script to sanitize the AFR report so that JSON generation will work.

    Which sounds best?


  2. 2 Posted by sreedeep on 21 Nov, 2013 06:08 AM

    sreedeep's Avatar


    Can you please send me the script so that it will be helpful to me.

    Thank you

  3. Support Staff 3 Posted by Tasos Laskos on 21 Nov, 2013 08:11 PM

    Tasos Laskos's Avatar

    Run the attached file like so:

    ./bin/arachni_script json_bug.rb <path to AFR report>

    The script will recode the report and save it as <original AFR report name>.sanitized, then use the sanitized report to for the conversion to JSON.

    Let me know how it worked.


  4. Support Staff 4 Posted by Tasos Laskos on 21 Nov, 2013 08:17 PM

    Tasos Laskos's Avatar

    I forgot to mention, you'll need to use one of the nightly packages to do that.

  5. 5 Posted by sreedeep on 22 Nov, 2013 08:06 AM

    sreedeep's Avatar


    I have generated the sanitized AFR even-though i am geting the same issues.

    I am running this command after generating the sanitized AFR

    arachni --repload=test.afr.sanitized --report=json:outfile=test.json

  6. Support Staff 6 Posted by Tasos Laskos on 22 Nov, 2013 03:53 PM

    Tasos Laskos's Avatar

    There must be some data elsewhere that I missed. Could you attach the AFR report please? You can mass-replace the hostname in the file with a placeholder if you wish.

  7. 7 Posted by sreedeep on 23 Nov, 2013 09:22 AM

    sreedeep's Avatar


    Ya i am sending you both the AFR files please check them.

    Thank You

  8. Support Staff 8 Posted by Tasos Laskos on 23 Nov, 2013 03:21 PM

    Tasos Laskos's Avatar

    Looking into it, cheers.

  9. Support Staff 9 Posted by Tasos Laskos on 23 Nov, 2013 03:58 PM

    Tasos Laskos's Avatar

    There's something weird going on, I couldn't sanitize the AFR. However, I've updated the json report to do the sanitization before converting the data to JSON since others will most likely be affected by the same issue.

    All you got to do is grab one of the nightlies and generate the report.

    I'll let you know when the fresh nightlies are up (could be a while because my phone line suffered some storm damage).


  10. Support Staff 10 Posted by Tasos Laskos on 23 Nov, 2013 09:24 PM

    Tasos Laskos's Avatar

    All done, grab one of the nightlies and give it a try.

  11. 11 Posted by sreedeep on 25 Nov, 2013 07:39 AM

    sreedeep's Avatar

    I am getting the same error after generating the sanitized file with new nighties.

  12. Support Staff 12 Posted by Tasos Laskos on 25 Nov, 2013 03:11 PM

    Tasos Laskos's Avatar

    No, I meant just generate the report using the original AFR:

    ./bin/arachni --repload=/home/zapotek/Documents/knol.afr --report=json:outfile=test.json

    Worked fine for me with the nightlies.

  13. 13 Posted by sreedeep on 26 Nov, 2013 05:40 AM

    sreedeep's Avatar


    It worked....

    Thanks a lot.

  14. Support Staff 14 Posted by Tasos Laskos on 26 Nov, 2013 02:15 PM

    Tasos Laskos's Avatar

    No problem, glad you got it working.

  15. Tasos Laskos closed this discussion on 26 Nov, 2013 02:15 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac