Added unicode conversion option for toolbar input

This commit is contained in:
Kevin F 2022-05-09 17:17:31 -05:00
parent abd9486a37
commit caae505777
7 changed files with 152 additions and 3 deletions

View File

@ -24,6 +24,14 @@ The easiest is to simply type on a page as normal. This method breaks the least
You can whitelist sites by using the button in the addon's popup or by manually adding them on the addon settings page.
## Unicode Conversion
There is a default disabled setting to convert ascii to look-alike unicode characters.
This doesn't do a lot, but it makes it a bit harder to do 'sentiment-analysis' and breaks typical text search.
This can also circumvent naive profanity filters.
## Toolbar input
You can also enter text into the textarea in the toolbar button which will be instantly transfered to the page. This method allows you to type without lag, but it breaks on many websites and can still be tracked if a website is checking input changes as opposed to key events.

View File

@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Private Keyboard",
"version": "2.0",
"version": "2.1",
"description": "Protect against keyboard biometrics",

View File

@ -4,6 +4,7 @@
<meta charset="utf-8">
<title>Private Keyboard</title>
<link rel="stylesheet" href="./button.css">
<script src="./unicodemapping.js"></script>
<script src="./button.js" defer></script>
<script src="./keybuffer2.js" defer></script>
</head>

View File

@ -1,5 +1,17 @@
let started = false
useUnicode = false
let usingUnicode = function(result){
console.debug(result)
if (result['keyboardprivacyunicode']){
useUnicode = true
}
}
let doUnicode = browser.storage.sync.get("keyboardprivacyunicode");
doUnicode.then(usingUnicode, onError);
function onError(error) {
console.error(`Error: ${error}`);
}
@ -35,7 +47,12 @@ let sender = async function(e){
}
let sendMessageToTabs = function(tabs){
doSendMsg(document.getElementById('keyBuffer').value, tabs)
let val = document.getElementById('keyBuffer').value
if (useUnicode){
val = getUnicode(val)
}
doSendMsg(val, tabs)
}
browser.tabs.query({

View File

@ -12,6 +12,9 @@
<input type="checkbox" id="usePrompt">
<label for="usePrompt">Use prompt() dialogs on single-line inputs. Faster typing and less CPU usage, but can break some websites and features like autocomplete.</label>
<br>
<input type="checkbox" id="useUnicode">
<label for="useUnicode">Convert english to unicode (will break a lot)</label>
<br>
<input type="checkbox" id="whitelistLAN">
<label for="whitelistLAN">Whitelist private IP + localhost range hostnames (e.g. routers)</label>
<h1>Trusted domains (comma delimited)</h1>

View File

@ -27,6 +27,9 @@ function saveOptions(e) {
browser.storage.sync.set({
keyboardprivacyprompt: document.querySelector("#usePrompt").checked
})
browser.storage.sync.set({
keyboardprivacyunicode: document.querySelector("#useUnicode").checked
})
document.getElementById('saved').innerHTML = '<br><b>Saved</b>'
setTimeout(function(){
document.getElementById('saved').innerHTML = '<br>'
@ -49,6 +52,10 @@ function saveOptions(e) {
document.querySelector("#usePrompt").checked = result['keyboardprivacyprompt']
}
function setCurrentUnicode(result){
document.querySelector("#useUnicode").checked = result['keyboardprivacyunicode']
}
function onError(error) {
console.log(`Error: ${error}`);
}
@ -61,6 +68,9 @@ function saveOptions(e) {
let gettingPrompt = browser.storage.sync.get("keyboardprivacyprompt");
gettingPrompt.then(setCurrentPrompt, onError);
let gettingUnicode = browser.storage.sync.get("keyboardprivacyunicode");
gettingUnicode.then(setCurrentUnicode, onError);
}
document.addEventListener("DOMContentLoaded", restoreOptions);

110
settings/unicodemapping.js Normal file
View File

@ -0,0 +1,110 @@
let getUnicode = function(input){
const uc =
{
"a": [
"\u0430",
"\u00e0",
"\u00e1",
"\u1ea1",
"\u0105"
],
"c": [
"\u0441",
"\u0188",
"\u010b"
],
"d": [
"\u0501",
"\u0257"
],
"e": [
"\u0435",
"\u1eb9",
"\u0117",
"\u0117",
"\u00e9",
"\u00e8"
],
"g": [
"\u0121"
],
"h": [
"\u04bb"
],
"i": [
"\u0456",
"\u00ed",
"\u00ec",
"\u00ef"
],
"j": [
"\u0458",
"\u029d"
],
"k": [
"\u03ba"
],
"l": [
"\u04cf",
"\u1e37"
],
"n": [
"\u0578"
],
"o": [
"\u043e",
"\u03bf",
"\u0585",
"\u022f",
"\u1ecd",
"\u1ecf",
"\u01a1",
"\u00f6",
"\u00f3",
"\u00f2"
],
"p": [
"\u0440"
],
"q": [
"\u0566"
],
"s": [
"\u0282"
],
"u": [
"\u03c5",
"\u057d",
"\u00fc",
"\u00fa",
"\u00f9"
],
"v": [
"\u03bd",
"\u0475"
],
"x": [
"\u0445",
"\u04b3"
],
"y": [
"\u0443",
"\u00fd"
],
"z": [
"\u0290",
"\u017c"
]
}
let output = ''
input.split("").forEach(element => {
if (uc[element] === undefined){
output += element
}
else{
output += uc[element][0]
}
})
return output
}