ouspg / urlhandlers

Discover and Hack URL handlers
MIT License
35 stars 3 forks source link

Add script to validate web/db/handlerpresets.json file #10

Closed oherrala closed 8 years ago

oherrala commented 8 years ago

Simple validation for web/db/handlerpresets.json file. It prints error if handler's name is not same as beginning of value's string.

Catches problems like this in handlerpresets.json:

"slack:": {
    "presets": [
        {
            "description": "Opens man page",
            "value": "x-man-page://1/man"
        }
    ]
}

Exmple command line usage:

$ ./bin/validate-presets.py web/db/handlerpresets.json
ERROR: "ms-word:" handler with "word:http://www.microsoft.com/investor/downloads/events/CreditSuisseReller.docx" value
ERROR: "slack:" handler with "x-man-page://1/man" value
ERROR: "word:" handler with "ms-word:http://www.microsoft.com/investor/downloads/events/CreditSuisseReller.docx" value
ERROR: "map:" handler with "maps://?ll=50.894967,4.341626" value
ERROR: "map:" handler with "maps://?daddr=San+Francisco&dirflg=d&t=h" value
ERROR: "map:" handler with "maps://?saddr=San+Jose&daddr=San+Francisco&dirflg=r" value
ERROR: "map:" handler with "maps://?address=1,Infinite+Loop,Cupertino,California" value