Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
Kevin H.  
#1 Posted : Saturday, April 24, 2021 2:05:48 PM(UTC)
Kevin H.

Rank: Newbie


Groups: Approved
Joined: 10/28/2020(UTC)
Posts: 3
United States

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. Smile

var GithubGist = user => async (hash, evalResult = true) => {
  const now = new Date();
  const uri = `${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}` }

(async () => {
  const gist = GithubGist("kevinkhill");
  try {    
    const script = await gist("d88cfad2e9b8578ba046cfcf6f803f47", false);
    sp.MessageBox(script, "Remote Script Source");
      "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 :)",
  } catch (err) {
    sp.MessageBox(`${err}`, "Oops!");
thanks 1 user thanked Kevin H. for this useful post.
carcinogen75 on 9/17/2021(UTC)
Users browsing this topic
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.