Last active
December 10, 2015 00:19
-
-
Save cholick/4350645 to your computer and use it in GitHub Desktop.
Groovy program that rewrites itself exactly using a new, random filename.
This file contains 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
def p = ''' | |
@Grab(group='commons-lang', module='commons-lang', version='2.4') import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric | |
File file = new File("${randomAlphanumeric(8)}.groovy").write(p) | |
new GroovyShell(new Binding([p: "def p = ${"'"*3}${p}${"'"*3}; ${p.readLines()[3]}"])).evaluate(p.readLines()[0..2].join(';') as String) | |
'''; new GroovyShell(new Binding([p: "def p = ${"'"*3}${p}${"'"*3}; ${p.readLines()[3]}"])).evaluate(p.readLines()[0..2].join(';') as String) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment