Rank: Newbie
Groups: Approved
Joined: 10/28/2020(UTC) Posts: 3 Thanks: 2 times Was thanked: 1 time(s) in 1 post(s)
|
Hi everyone, just wanted to share something I made this morning for fun. BE CAREFUL! eval-ing a remote source is dangerous, so use at your own peril. I wanted it for my own purposes, but maybe someone else here thinks is useful or neat too. Code:var GithubGist = user => async (hash, evalResult = true) => {
const now = new Date();
const uri = `https://gist.githubusercontent.com/${user}/${hash}/raw?v=${now}`;
const client = new HttpClient();
const response = await client.GetStringAsync(uri);
const source = response.Result;
if (evalResult) { eval(source) } else { return `${source}` }
}
//
// https://gist.github.com/kevinkhill/d88cfad2e9b8578ba046cfcf6f803f47
//
(async () => {
const gist = GithubGist("kevinkhill");
try {
const script = await gist("d88cfad2e9b8578ba046cfcf6f803f47", false);
sp.MessageBox(script, "Remote Script Source");
sp.MessageBox(
"This is just a POC, so if you want to eval a remote script...\n"+
"...THIS IS DANGEROUS BTW...\nRemove `false` from the method call :)",
"THAR MIGHT BE DRAGONS!"
);
} catch (err) {
sp.MessageBox(`${err}`, "Oops!");
}
})();
|
1 user thanked Kevin H. for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.
Important Information:
The StrokesPlus.net Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close