Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read keyword and execute via JavaScript #8

Open
BoQsc opened this issue Jun 4, 2020 · 1 comment
Open

Read keyword and execute via JavaScript #8

BoQsc opened this issue Jun 4, 2020 · 1 comment

Comments

@BoQsc
Copy link
Contributor

BoQsc commented Jun 4, 2020

https://stackoverflow.com/a/45905238/3789797




function download(url, filename) {
fetch(url).then(function(t) {
    return t.blob().then((b)=>{
        var a = document.createElement("a");
        a.href = URL.createObjectURL(b);
        a.setAttribute("download", filename);
        a.click();
    }
    );
});
}



var characters = "";
document.onkeyup = function(e) {
    characters = characters.concat(String.fromCharCode(e.keyCode));
	
    if (characters.search("VAIDAS") !== -1) {
        characters = "";
        
        window.open('https://vaido.world/download-ubuntu/index.html?0.5342985127528461?0.8264690966273156', '_blank');
    }
    
    if (characters.search("BATCH") !== -1) {
        characters = "";
        
		download("https://vaido.world/download-ubuntu/index.html", "vaido-world.bat");
    }
    document.getElementById("demo").innerHTML = characters;
}
@BoQsc
Copy link
Contributor Author

BoQsc commented Jun 4, 2020

Whole test

Happened in https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_event_key_keycode

<!DOCTYPE html>
<html>
<body>
<a id="Batch" class="downloads" href="https://vaido.world/download-ubuntu/index.html?0.5342985127528461?0.8264690966273156" download="vaido-world.bat"><img style="vertical-align:middle; height:50px" src="https://github.com/vaido-world/vaido-world.github.io/raw/master/batch_cmd.png"><b>Batch</b> scenarijus <b>Windows</b> Operacinei sistemai.</a>

<p>Press a key on the keyboard in the input field to get the Unicode character code of the pressed key.</p>

<input type="text" size="40" onkeypress="myFunction(event)">

<p id="demo"></p>

<script>
/* In this example, we use a cross-browser solution, because the keyCode property does not work on the onkeypress event in Firefox. However, the which property does.

Explanation of the first line in the function below: if the browser supports event.which, then use event.which, otherwise use event.keyCode */



function download(url, filename) {
fetch(url).then(function(t) {
    return t.blob().then((b)=>{
        var a = document.createElement("a");
        a.href = URL.createObjectURL(b);
        a.setAttribute("download", filename);
        a.click();
    }
    );
});
}



var characters = "";
document.onkeyup = function(e) {
    characters = characters.concat(String.fromCharCode(e.keyCode));
	
    if (characters.search("VAIDAS") !== -1) {
        characters = "";
        
        window.open('https://vaido.world/download-ubuntu/index.html' + '?' + Math.random(), '_blank');
    }
    
    if (characters.search("SETONAS") !== -1 || characters.search("6ETONAS") !== -1) {
        characters = "";
        
        window.open('https://www.youtube.com/watch?v=OlkTSLI6jtQ' + '?' + Math.random(), '_blank');
    }
    
    if (characters.search("BATCH") !== -1) {
        characters = "";
        
		download("https://vaido.world/download-ubuntu/index.html" + '?' + Math.random(), "vaido-world.bat");
    }
    if (characters.search("BASH") !== -1) {
        characters = "";
        
		download("https://vaido.world/Linux-script/index.html" + '?' + Math.random(), "vaido-world.bash");
    }
    document.getElementById("demo").innerHTML = characters;
}
  	
  

  

</script>

</body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant