Advertisement
Guest User

Convert NoScript forced HTTPS list to the addon Redirector

a guest
Mar 21st, 2018
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. First, sort out rules which only match a certain subdomain (only five in my case, so I'm adding them manually). For the others, convert the list to "include patterns" for Redirector:
  2. sed -i -r -e 's/\./\\\\\./g' -e 's/\*/\(\.\*\)/g' -e 's/^\\\\\./http\:\/\/\(\.\*\\\\\.\)\?/g' -e 's/$/\(\/\.\*\)\?\$/' noscript-https-converting-for-redirector.txt
  3. Now the difficult part: Generating the "redirect URL". Entries without TLD will need to be added manually.
  4. sed -i -r -e 's/^http\:\/\/\(\.\*\\\\\.\)\?(.*)\\\\\.([a-z]{2,8})\(\/\.\*\)\?\$$/\0\nhttps\:\/\/\$1\1\.\2\$2/g' noscript-https-converting-for-redirector.txt
  5. On entries with wildcards, you now need to replace "(.*)\" by "$2" and adjust the "$2" on the end of the line to "$3". (Done manually)
  6. Almost done, just place the JSON skeleton around this list:
  7. sed -i -r -e 's/^http\:.*$/\{\n \"includePattern\"\: \"\0\"\,/g' -e 's/^https\:.*/ \"redirectUrl\"\: \"\0\"\,\n \"patternType\"\: \"R\"\,\n \"appliesTo\"\:\[\"main_frame\"\,\"sub_frame\"\,\"stylesheet\"\,\"script\"\,\"image\"\,\"object\"\,\"xmlhttprequest\"\,\"other\"\]\n\},/g' noscript-https-converting-for-redirector.txt
  8. And as the last step, complete the JSON by adding
  9. { "redirects": [
  10. as the first line to the file, remove the comma in the last line and add "]}" instead. Congratulations, you should now have a file importable to the addon Redirector.
  11.  
  12. For the exclusion rules, I'm adding them manually to the redirects they belong to. Since the list is searchable (I used to copy the old NoScript list into a text editor if I was searching for an entry) this is quite easy, and I can take this opportunity to check whether the sites are actually still unavailable over HTTPS.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement