async def pending_list(self, ctx): out = [] async for report_data in query(db.reports, Attr("pending").eq(True)): out.append(Report.from_dict(report_data).report_id) out = ', '.join(f"`{_id}`" for _id in out) await ctx.send(f"Pending reports: {out}")
async def update(self, ctx, build_id, *, msg=""): """Owner only - To be run after an update. Resolves all -P2 reports.""" if not ctx.message.author.id == constants.OWNER_ID: return changelog = DiscordEmbedTextPaginator() async for report_data in query( db.reports, Attr("pending").eq(True)): # find all pending=True reports report = Report.from_dict(report_data) await report.resolve(ctx, f"Patched in build {build_id}", ignore_closed=True) report.pending = False report.commit() action = "Fixed" if not report.is_bug: action = "Added" if report.get_issue_link(): changelog.add( f"- {action} [`{report.report_id}`]({report.get_issue_link()}) {report.title}" ) else: changelog.add( f"- {action} `{report.report_id}` {report.title}") changelog.add(msg) embed = discord.Embed(title=f"**Build {build_id}**", colour=0x87d37c) changelog.write_to(embed) await ctx.send(embed=embed) await ctx.message.delete()
def extract_headers(): if (cherrypy.session.get('userid') is not None): d = {} d['userid'] = cherrypy.session.get('userid') d['scopes'] = 'FULL' d['type'] = 'session' #headers['X-Auth-Results'] = json.dumps(d) cherrypy.request.params['authdata'] = d return else: db = cherrypy.request.db headers = cherrypy.request.headers if ('Authorization' in headers): m = re_bearer.match(headers['Authorization']) if m: token = m.group(1) q = db.query(lib.db.OAuthAccess).filter(lib.db.OAuthAccess.token == token) if (q.count() == 1): rec = q.first() d = {} d['userid'] = rec.userid d['scopes'] = rec.scopes d['type'] = 'bearer' d['clientid'] = rec.clientid #headers['X-Auth-Results'] = json.dumps(d) cherrypy.request.params['authdata'] = d return else: m = re_basic.match(headers['Authorization']) if m: try: pair = b64decode(m.group(1)).decode('utf-8') except: raise cherrypy.HTTPError(400, "Malformed Authorization header.") username, password = pair.split(':', 1) q = db.query(lib.db.User).filter(or_(lib.db.User.username.ilike(username), lib.db.User.email.ilike(username))) if (q.count() == 1): rec = q.first() if (pwd_context.verify(password, rec.password.password)): d = {} d['userid'] = rec.userid d['scopes'] = 'FULL' d['type'] = 'authorization' #headers['X-Auth-Results'] = json.dumps(d) cherrypy.request.params['authdata'] = d return raise cherrypy.HTTPError(401)
def file_contents(): q = unquote(request.args.get('txt')) gists = [ gist for gist in db.query( 'select distinct (g.gist_id), * from gists g, files f where g.gist_id = f.gist_id and f.content ilike :q', q="%" + q + "%") ] return render('search.html', gists=gists)
def search(): q = request.args.get('desc') gists = [ gist for gist in db.query('select * from gists where description ~* :q', q=q) ] return render('search.html', gists=gists)
def language(language): q = str(language).lower() gists = [ gist for gist in db.query( 'select distinct (f.gist_id, f.filename), g.*,f.* from gists g join files f on g.gist_id = f.gist_id where f.language = :q order by f.gist_id,f.filename', q=q) ] return render('search.html', gists=gists)
if not args.single: try: while True: sleep(1) counter -= 1 logger.timer('Querying in %s seconds(s)' % logger.BLUE(counter)) if counter <= 0: runner.go() counter = interval except KeyboardInterrupt as e: logger.red('CTRL+C Detected!') quit() else: runner.go() subdomains, wildcards = db.query() if args.probe: logger.yellow('Running HTTP probe') sleep(3) probed = probe.do(subdomains, args.threads) if args.probe: log_results = db.log_results((subdomains, wildcards), probed) else: log_results = db.log_results((subdomains, wildcards), None) quit() else: log_results = db.log_results(db.query()) quit()
def home(): files = [ f for f in db.query('select distinct language from files') if f['language'] ] return render('home.html', files=files)
def file_contents(): q = unquote(request.args.get('txt')) gists = [gist for gist in db.query('select distinct (g.gist_id), * from gists g, files f where g.gist_id = f.gist_id and f.content ilike :q', q="%"+q+"%")] return render('search.html', gists=gists)
def language(language): q = str(language).lower() gists = [gist for gist in db.query('select distinct (f.gist_id, f.filename), g.*,f.* from gists g join files f on g.gist_id = f.gist_id where f.language = :q order by f.gist_id,f.filename', q=q)] return render('search.html', gists=gists)
def search(): q = request.args.get('desc') gists = [gist for gist in db.query('select * from gists where description ~* :q', q=q)] return render('search.html', gists=gists)
def home(): files = [f for f in db.query('select distinct language from files') if f['language']] return render('home.html', files=files)