Created
December 1, 2017 03:19
-
-
Save vitapluvia/fe13d1c7c4cfa90a259223dc4912876d to your computer and use it in GitHub Desktop.
Self-Replicating GScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// genesis script | |
// Description: Simple self-replicating gscript | |
function BeforeDeploy() { | |
return true; | |
} | |
function Deploy() { | |
var self = ReadFile('./examples/hello.gs'); | |
var randStr = '\n\/\/ ' + String(Math.random()).split('.').splice(-1) + '\n'; | |
var next = self + randStr; | |
var next_hash = MD5(next); | |
var nextDestination = './examples/hello-' + next_hash + '.gs'; | |
console.log('Next Hash:', next_hash); | |
console.log('Rand Str:', randStr); | |
return WriteFile(nextDestination, next); | |
} | |
function AfterDeploy() { | |
return console.log( | |
IP_ADDRS, | |
OS, | |
ARCH, | |
JSON.stringify(USER_INFO), | |
HOSTNAME | |
) || true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment