@@ -0,0 +1,2727 @@
+#!/usr/bin/env python%0A%0Aimport os%0Aimport json%0Aimport argparse%0Aimport sys%0Aimport textwrap%0Aimport re%0Afrom os import path%0Afrom collections import OrderedDict%0A%0A%0ADEFAULT_EFFORT = 50%0A%0A%0Adef slugify(filename):%0A    filename = re.sub(r'%5CW+', '-', filename.lower())%0A    return filename.strip(%22-%22)%0A%0A%0Adef convert_multi_string(text):%0A    text = text.strip()%0A    if len(text) %3E 70:%0A        return textwrap.wrap(text, width=70,%0A                             expand_tabs=False,%0A                             break_on_hyphens=False,%0A                             replace_whitespace=False,%0A                             break_long_words=False)%0A    return text%0A%0A%0Adef convert_file(arachni_file, vuln_id):%0A    with open(arachni_file) as f:%0A        arachni_data = json.load(f)%0A%0A    result = OrderedDict(%5B%0A        (%22id%22, vuln_id),%0A        (%22title%22, arachni_data%5B%22name%22%5D),%0A        (%22severity%22, arachni_data%5B%22severity%22%5D),%0A        (%22description%22, convert_multi_string(arachni_data%5B%22description%22%5D)),%0A        (%22fix%22,%0A         OrderedDict(%5B%0A             (%22effort%22, DEFAULT_EFFORT),%0A             (%22guidance%22, convert_multi_string(arachni_data.get(%22remedy_guidance%22, %22%22))),%0A         %5D)%0A         ),%0A    %5D)%0A    if %22tags%22 in arachni_data and len(arachni_data%5B%22tags%22%5D):%0A        result%5B%22tags%22%5D = arachni_data%5B%22tags%22%5D%0A    if %22references%22 in arachni_data and len(arachni_data%5B%22references%22%5D):%0A        result%5B%22references%22%5D = %5B%7B%22url%22: url, %22title%22: title%7D%0A                                for title, url in arachni_data%5B%22references%22%5D.items()%5D%0A    return result%0A%0A%0Adef main():%0A    parser = argparse.ArgumentParser(description='Convert arachni format to vulndb format')%0A    parser.add_argument('src', type=unicode, help='path to arachni files')%0A    parser.add_argument('dst', type=unicode, help='output path for vulndb files')%0A    parser.add_argument('--id', type=int, default=1, help='initial id')%0A    args = parser.parse_args()%0A%0A    src = args.src%0A    if not path.exists(src):%0A        print(%22src path doesn't exist %25s%22 %25 src)%0A        sys.exit(1)%0A%0A    dst = args.dst%0A    if not path.exists(dst):%0A        print(%22dst path doesn't exist %25s%22 %25 dst)%0A        sys.exit(1)%0A%0A    vuln_id = args.id%0A%0A    files = %5Bf for f in os.listdir(src) if path.isfile(path.join(src, f))%5D%0A    converted_files = %5B%5D%0A    for arachniFile in files:%0A        converted = convert_file(path.join(src, arachniFile), vuln_id)%0A        converted_files.append(converted)%0A        vuln_id += 1%0A%0A    for arachniFile in converted_files:%0A        filename = slugify(arachniFile%5B%22title%22%5D)%0A        filename = %22%25d-%25s.json%22 %25 (arachniFile%5B%22id%22%5D, filename)%0A        filename = path.join(dst, filename)%0A        with open(filename, %22w%22) as f:%0A            json.dump(arachniFile, f, indent=2)%0A%0A%0Aif __name__ == %22__main__%22:%0A    main()

Add arachni to vulndb convertor