Last active
April 24, 2017 05:38
-
-
Save giannisp/573702636db91fc56b768c61f1d16b63 to your computer and use it in GitHub Desktop.
Automate HSTS domain delete action on Chrome (macOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env osascript -l JavaScript | |
function run(domain) { | |
const Chrome = Application('Google Chrome'); | |
Chrome.activate(); | |
const window = Chrome.windows[0]; | |
const tab = Chrome.Tab({ | |
url: 'chrome://net-internals/#hsts', | |
}); | |
window.tabs.push(tab); | |
delay(1); | |
Chrome.execute(tab, { | |
javascript: `document.getElementById('hsts-view-delete-input').value = '${domain}'` | |
}); | |
delay(0.5); | |
Chrome.execute(tab, { | |
javascript: 'document.getElementById(\'hsts-view-delete-submit\').click()' | |
}); | |
tab.close(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ chmod +x hsts-delete-domain | |
$ ./hsts-delete-domain example.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since Chrome 58 support for Javascript has been disabled:
https://bugs.chromium.org/p/chromium/issues/detail?id=661810