Esempio n. 1
0
 def get(self, *args, **kwargs):
     ''' This will let you delete a given tag from the system '''
     tags = Tag.all()
     try:
         uuid = self.get_argument('tag')
         if uuid != None:
             tag = Tag.by_uuid(uuid)
             if tag != None:
                 self.dbsession.delete(tag)
                 tags = Tag.all()
                 self.render(
                     "admin/manage_tags.html",
                     success="Successfuly deleted tag from the system",
                     tags=tags)
             else:
                 self.render("admin/manage_tags.html",
                             errors="Please Select a Tag",
                             tags=tags)
         else:
             self.render("admin/manage_tags.html",
                         errors="Please Select a Tag",
                         tags=tags)
     except Exception as e:
         self.render("admin/manage_tags.html",
                     errors="Invalid Tag Selected",
                     tags=tags)
Esempio n. 2
0
 def post(self, *args, **kwargs):
     ''' This is used to create new tags '''
     form = Form(name="Please enter a tag name")
     tags = Tag.all()
     if form.validate(self.request.arguments):
         self.create_tag()
         tags = Tag.all()
         self.render("admin/manage_tags.html", tags=tags)
     else:
         self.render("admin/manage_tags.html", tags=tags, errors=form.errors)
Esempio n. 3
0
 def post(self, *args, **kwargs):
     ''' This is used to create new tags '''
     form = Form(name="Please enter a tag name")
     tags = Tag.all()
     if form.validate(self.request.arguments):
         self.create_tag()
         tags = Tag.all()
         self.render("admin/manage_tags.html", tags=tags)
     else:
         self.render("admin/manage_tags.html",
                     tags=tags,
                     errors=form.errors)
Esempio n. 4
0
    def GET(self):
        user = users.get_current_user()
        if user:
            greeting = ("Welcome, %s! (<a href=\"%s\">sign out</a>)" % (user.nickname(), users.create_logout_url("/")))
            query = Tag.all()
            query.filter('author=',user)
            results = query.fetch(10)
            query = Tag.all()
            query.filter('author',user)
            r = query.run()
            tags = c = [ c.name for c in r ]
            return render.dashboard(greeting,tags, form_add_tag, form_add_note)
        else:
            greeting = ("<a href=\"%s\">Sign in or register</a>." % users.create_login_url("/"))

        return render.index(greeting)
Esempio n. 5
0
def show_tags_list(request, *args, **kwargs):
	params = {}
	tags = Tag.all().order('name').fetch(1000)
	for tag in tags:
		tag.num_links = LinkTag.all().filter('tag = ', tag).filter('is_actual = ', True).filter('owner = ', users.get_current_user().user_id()).count()

	min_count = 1
	max_count = 1
	min_size = 10
	max_size = 20
	for tag in tags:
		if min_count > tag.num_links:
			min_count = tag.num_links 
		if max_count < tag.num_links:
			max_count = tag.num_links
			
	for tag in tags:
		tag.size = _get_size(min_size, max_size, tag.num_links-(min_count-1), max_count+1)

	params['tags'] = tags
	params['page_title'] = 'список тэгов'
	params['menu_items'] = get_menu_items()
	params['user'] = users.get_current_user().nickname()
	
	return _render_to_response(params, 'tags');
Esempio n. 6
0
    def __init__(self):
        """load basic members using memcache"""
        logging.info("initialized")
        self.posts_tags_db=[]
        self.catdict={}
        self.posts_tags_dict={}
        self.posts=memcache.get(KEY)

      
        if self.posts is None:
            logging.info('cache is empty creating index')
            self.posts = BlogPost.all().order('-timestamp')
   
            createIndex(self.posts)
            memcache.add(KEY,self.posts)
        if isinstance(self.posts,list):self.nofposts=len(self.posts)-2
        else:self.nofposts=self.posts.count()-2
        self.tags=memcache.get(TAG)
        if self.tags is None:
            self.tags = Tag.all()
            memcache.add(TAG,self.tags)
        self.categories=memcache.get(CATEGORY)
        if self.categories is None:
            self.categories= Category.all()
            memcache.add(CATEGORY,self.categories)

        for post in self.posts:
            logging.info(['posts',post.title])
            self.posts_tags_db.extend(post.tags)
            tags=[]
            for key in post.tags:tags.append(db.get(key).tag)
            self.posts_tags_dict[post.key()]=tags
            self.catdict[post.category.key()]=post.category.category
        logging.info(['catdict',self.catdict])
        self.tagnames=list(chain.from_iterable(self.posts_tags_dict.values()))
Esempio n. 7
0
    def post(self, *args, **kwargs):
        ''' Create the Dork in the system '''
        form = Form(title="Please enter a title",
                    description="Please enter a Description",
                    author="Please Enter an Author",
                    query="Please Enter the Shodan Hq Search Query",
                    tag="Please Select a Category")
        try:
            #Getting the user
            session_manager = SessionManager.Instance()
            session = session_manager.get_session(
                self.get_secure_cookie('auth'), self.request.remote_ip)
            user = User.by_user_name(session.data['user_name'])

            #Get the tag
            old_tag = Tag.by_name(self.get_argument('tag'))

            #Get all the tags
            tags = Tag.all()

            if user != None:
                if form.validate(self.request.arguments):
                    old_dork = Dork.by_title(self.get_argument('title'))
                    if old_dork:
                        self.render(
                            'user/submit.html',
                            user=user,
                            errors=[
                                'A Dork by this title has already been submitted'
                            ],
                            success=None,
                            tags=tags)
                    elif old_tag == None:
                        self.render(
                            'user/submit.html',
                            user=user,
                            errors=[
                                'A Dork by this title has already been submitted'
                            ],
                            success=None,
                            tags=tags)
                    else:
                        self.create_dork(user)
                        self.render('user/submit.html',
                                    user=user,
                                    success='Successfully created new Dork',
                                    errors=None,
                                    tags=tags)
                else:
                    self.render('user/submit.html',
                                user=user,
                                errors=form.errors,
                                success=None,
                                tags=tags)
            else:
                self.render('public/please_login.html')
        except Exception as e:
            print e
            self.render('public/please_login.html')
Esempio n. 8
0
def search_links(request, *args, **kwargs):
	params = {}
	params['page'] = request.get('page')
	if request.get('make_search'):
		params['make_search'] = 1
		params['query'] = {}
		
		query_string = []
		query_string.append('owner = %s' % users.get_current_user().user_id())
		if request.get('text'):
			query_string.append('(link:"%s" OR description:"%s")' % (request.get('text'), request.get('text')))
			params['query']['text'] = request.get('text')
			
		if request.get('created'):
			params['query']['created'] = request.get('created')
			if request.get('created') == '1day':
				query_string.append('created > %s' % datetime.date.today())
			if request.get('created') == '1week':
				query_string.append('created > %s' % (datetime.date.today() - datetime.timedelta(days=7)))
			if request.get('created') == '1month':
				query_string.append('created > %s' % (datetime.date.today() - datetime.timedelta(days=30)))
			if request.get('created') == 'period':
				pass
				
		if request.get('show_not_actual'):
			params['query']['show_not_actual'] = request.get('show_not_actual')
		else:
			query_string.append('is_actual = 1')
		
		if request.get('tag'):
			params['query']['tag'] = request.get('tag')
			query_string.append('tags:"%s"' % request.get('tag'))
			
		search_index = search.Index(name='links')
		#print search_index
		#print query_string
		results = search_index.search(search.Query(
			query_string = ' AND '.join(query_string),
			options=search.QueryOptions(
				limit=20,
				#sort_options=search.SortOptions(
				#	expressions=[
				#		search.SortExpression(expression='created', direction=SortExpression.DESCENDING, #default_value='')],
				#	limit=1000),
				ids_only=True)))
		#for i,res in enumerate(results):
		#	print i, res

		params['keys'] = []
		for res in results:
			params['keys'].append(db.Key(res.doc_id))
	
	else:
		params['skip_get_list'] = 1
		
	params['tags'] = Tag.all()
	
	
	return _get_list_and_render(params, 'поиск', 'search')
Esempio n. 9
0
 def refetch(self):
     self.posts =BlogPost.all().order('-timestamp')
     memcache.add(KEY,self.posts)
     self.tags = Tag.all()
     memcache.add(TAG,self.tags)
     self.categories= Category.all()
     memcache.add(CATEGORY,self.categories)
     createIndex(self.posts)
Esempio n. 10
0
 def get(self, *args, **kwargs):
     ''' This will let you delete a given tag from the system '''
     tags = Tag.all()
     try:
         uuid = self.get_argument('tag')
         if uuid != None:
             tag = Tag.by_uuid(uuid)
             if tag != None:
                 self.dbsession.delete(tag)
                 tags = Tag.all()
                 self.render("admin/manage_tags.html", success="Successfuly deleted tag from the system", tags=tags)
             else:
                 self.render("admin/manage_tags.html", errors="Please Select a Tag", tags=tags)
         else:
             self.render("admin/manage_tags.html", errors="Please Select a Tag", tags=tags)
     except Exception as e:
         self.render("admin/manage_tags.html", errors="Invalid Tag Selected", tags=tags)
Esempio n. 11
0
    def test_tags_created_on_save(self):
        self.sharedfile.description = """#here #is some #tags that I got for #you. 
            #here is another word that #is not to be duplicated."""

        self.sharedfile.save()
        tags = Tag.all()
        for tag in tags:
            self.assertTrue(tag.name in ['is', 'you', 'here', 'tags'])
Esempio n. 12
0
 def get(self, *args, **kwargs):
     ''' Renders the welcome page '''
     top_dorks = Dork.get_top()
     tags = Tag.all()
     self.render("public/welcome.html",
                 tags=tags,
                 dorks=top_dorks,
                 errors=None,
                 title="Latest Entries:")
Esempio n. 13
0
    def render(self, context):
        output = ['']
        tags = Tag.all()
        #tags = tags.filter('valid=', True)
        for tag in tags:
            if tag.entrycount >= 1:
                output.append(tag)

        context['all_tags'] = output
        return ''
Esempio n. 14
0
    def render(self, context):
        output = ['']
        tags = Tag.all()
        #tags = tags.filter('valid=', True)
        for tag in tags:
            if tag.entrycount >= 1:
                output.append(tag)

        context['all_tags'] = output
        return ''
Esempio n. 15
0
def edit_item(request, *args, **kwargs):		
	params = {}
	params['item_id'] = request.get('item_id')
	if params['item_id']:
		link = Link.get(params['item_id'])
		link.tags = []
		for tag in LinkTag.all().filter('link = ', link).fetch(10):
			link.tags.append(tag.tag.name)
		params['link'] = link
	params['tags'] = Tag.all()
	return _render_to_response(params,'edit')
Esempio n. 16
0
 def get(self):
     q = Tag.all()
     tags = [t for t in q]
     buckets,keys = bucketize(tags, lambda t: t.tag)
     templatevalues = RequestContext(self.request, {
             'tags' : tags,
             'buckets' : buckets,
             'keys' : keys,
             })
     path = os.path.join(os.path.dirname(__file__), 'tags_by_name.html')
     self.response.out.write(template.render(path, templatevalues))
Esempio n. 17
0
    def test_not_signedin_user_cant_creat_tag(self):
        self.sign_in('bob', 'asdfasdf')
        response = self.post_url(
            '/p/%s/create_tag' % self.sharedfile.share_key, {'tag': 'asdf'})

        print self.response.code

        all_tags = Tag.all()
        all_tag_shared_files = TagSharedfile.all()

        self.assertTrue(len(all_tags) == 0)
        self.assertTrue(len(all_tag_shared_files) == 0)
Esempio n. 18
0
 def get(self,tagname):
     result = Tag.all().filter('tag', tagname).filter('valid', True)
     tag = result.fetch(limit=1)
     if len(tag) > 0:
         tagname = tag[0].tag
         if users.is_current_user_admin():
             websites = WebSite.all().filter('tags', tagname).order('-created')
         else:
             websites = WebSite.all().filter('tags', tagname).filter('is_public', True).order('-created')
         self.render('tag.html', tag=tagname, websites=websites)
     else:
         self.render('base.html', message='No Such Tag')
Esempio n. 19
0
    def test_create_tag_for_sf_creates_new_tag(self):
        self.sign_in('admin', 'asdfasdf')
        response = self.post_url(
            '/p/%s/create_tag' % self.sharedfile.share_key, {'tag': 'asdf'})

        all_tags = Tag.all()
        all_tag_shared_files = TagSharedfile.all()

        self.assertTrue(len(all_tags) == 1)
        self.assertTrue(all_tags[0].name == 'asdf')
        self.assertTrue(len(all_tag_shared_files) == 1)
        self.assertTrue(
            all_tag_shared_files[0].sharedfile_id == self.sharedfile.id)
Esempio n. 20
0
 def get(self, *args, **kwargs):
     try:
         session_manager = SessionManager.Instance()
         session = session_manager.get_session(
             self.get_secure_cookie('auth'), self.request.remote_ip)
         user = User.by_user_name(session.data['user_name'])
         if user != None:
             tags = Tag.all()
             self.render('user/submit.html', user=user, errors=None, success=None, tags=tags)
         else:
             self.render('public/please_login.html')
     except:
         self.render('public/please_login.html')
Esempio n. 21
0
def sitemap(request):
    str = """<?xml version="1.0" encoding="UTF-8"?>
            <?xml-stylesheet type="text/xsl" href="/static/xsl/sitemap.xsl"?>
            <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
               <url>
                  <loc>http://www.niubi.de/</loc>
                  <changefreq>weekly</changefreq>
                  <priority>0.9</priority>
               </url>
        """
    posts = Post.all().filter("is_published", True)
    for post in posts:
        str += (
            """<url>
                      <loc>http://www.niubi.de/post/%s/</loc>
                      <changefreq>weekly</changefreq>
                      <priority>0.8</priority>
                   </url>
                """
            % post.key().id()
        )

    categories = Category.all().order("-post_count")
    for category in categories:
        str += (
            """<url>
                      <loc>http://www.niubi.de/category/%s/</loc>
                      <changefreq>monthly</changefreq>
                      <priority>0.8</priority>
                   </url>
                """
            % category.key().id()
        )
    tags = Tag.all().order("-post_count")
    for tag in tags:
        str += (
            """<url>
                      <loc>http://www.niubi.de/tag/%s/</loc>
                      <changefreq>weekly</changefreq>
                      <priority>0.8</priority>
                   </url>
                """
            % tag.name
        )
    str += """<url>
                  <loc>http://www.niubi.de/about/</loc>
                  <changefreq>yearly</changefreq>
                  <priority>0.8</priority>
               </url>"""
    str += "</urlset>"
    return HttpResponse(str, content_type="text/xml")
Esempio n. 22
0
 def get(self, tagname):
     result = Tag.all().filter('tag', tagname).filter('valid', True)
     tag = result.fetch(limit=1)
     if len(tag) > 0:
         tagname = tag[0].tag
         if users.is_current_user_admin():
             websites = WebSite.all().filter('tags',
                                             tagname).order('-created')
         else:
             websites = WebSite.all().filter('tags', tagname).filter(
                 'is_public', True).order('-created')
         self.render('tag.html', tag=tagname, websites=websites)
     else:
         self.render('base.html', message='No Such Tag')
Esempio n. 23
0
 def get(self, *args, **kwargs):
     try:
         session_manager = SessionManager.Instance()
         session = session_manager.get_session(
             self.get_secure_cookie('auth'), self.request.remote_ip)
         user = User.by_user_name(session.data['user_name'])
         if user != None:
             tags = Tag.all()
             self.render('user/submit.html',
                         user=user,
                         errors=None,
                         success=None,
                         tags=tags)
         else:
             self.render('public/please_login.html')
     except:
         self.render('public/please_login.html')
Esempio n. 24
0
 def get(self):
     
     # we want a canonical url with the trailing slash
     # so if it's missing we need to throw a 301, adding the slash in 
     # the process
     if self.request.path[-1] != "/":
         self.redirect("%s/" % self.request.path, True)
         return
     
     output = get_cache("tags")
     if output is None:
         tags = Tag.all().order('-date').fetch(300)
         context = {
             "tags": tags,
             "title": "Latest tags",
         }
         output = self.render("tags.html", context)
         memcache.add("tags", output, 3600)
     self.response.out.write(output)
Esempio n. 25
0
    def get(self, slug):

        # we want a canonical url with the trailing slash
        # so if it's missing we need to throw a 301, adding the slash in 
        # the process
        if slug[-1] != "/":
            self.redirect("%s/" % slug, True)
            return

        output = get_cache(slug)
        if output is None:

            try:
                item = Page.gql("WHERE internal_url=:1", slug)[0]
            except IndexError:
                self.error(404)
                output = self.render("404.html", {"title": "Page not found"})
                self.response.out.write(output)
                return
        
            # get a list of related items based on taggings
            # remember to filter out the article we're on
            related = []
            for tag in item.tags:
                 related += (Tag.all().filter('name =', tag).filter('title !=', item.title))
            
            # we also need to deduplicate the list as sometimes items
            # will share tags
            seen = [] 
            deduped = []
            for related_item in related:
                if not related_item.url in seen:
                    deduped.append(related_item)
                    seen.append(related_item.url)
        
            context = {
                "item": item,
                "related": deduped,
                "title": item.title,
            }
            output = self.render("item.html", context)
            memcache.add(slug, output, 3600)
        self.response.out.write(output)
Esempio n. 26
0
def sitemap(request):
    str = '''<?xml version="1.0" encoding="UTF-8"?>
            <?xml-stylesheet type="text/xsl" href="/static/xsl/sitemap.xsl"?>
            <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
               <url>
                  <loc>http://www.niubi.de/</loc>
                  <changefreq>weekly</changefreq>
                  <priority>0.9</priority>
               </url>
        '''
    posts = Post.all().filter('is_published', True)
    for post in posts:
        str += '''<url>
                      <loc>http://www.niubi.de/post/%s/</loc>
                      <changefreq>weekly</changefreq>
                      <priority>0.8</priority>
                   </url>
                ''' % post.key().id()

    categories = Category.all().order('-post_count')
    for category in categories:
        str += '''<url>
                      <loc>http://www.niubi.de/category/%s/</loc>
                      <changefreq>monthly</changefreq>
                      <priority>0.8</priority>
                   </url>
                ''' % category.key().id()
    tags = Tag.all().order('-post_count')
    for tag in tags:
        str += '''<url>
                      <loc>http://www.niubi.de/tag/%s/</loc>
                      <changefreq>weekly</changefreq>
                      <priority>0.8</priority>
                   </url>
                ''' % tag.name
    str += '''<url>
                  <loc>http://www.niubi.de/about/</loc>
                  <changefreq>yearly</changefreq>
                  <priority>0.8</priority>
               </url>'''
    str += '</urlset>'
    return HttpResponse(str, content_type='text/xml')
Esempio n. 27
0
 def get(self, ws_id):
     website = db.get(ws_id)
     website.is_public=False
     #invalidate the tags?
     tags = website.get_tags()
     newtags = []
     
     for t in tags:
         if WebSite.all().filter('tags', t).count() > 1:
             tg = Tag.all().filter('tag',tag).fetch(1)
             if len(tg)>1: 
                 newtags.append(t)
                 if tg[0].entrycount > 0:
                     tg[0].entrycount -= 1
                     tg[0].put()
                     
     newtags = [t for t in newtags if t != ' ']
     website.tags_spc = ' '.join(newtags)
     website.put()
     self.render('website.html', website=website)
Esempio n. 28
0
    def get(self, ws_id):
        website = db.get(ws_id)
        website.is_public = False
        #invalidate the tags?
        tags = website.get_tags()
        newtags = []

        for t in tags:
            if WebSite.all().filter('tags', t).count() > 1:
                tg = Tag.all().filter('tag', tag).fetch(1)
                if len(tg) > 1:
                    newtags.append(t)
                    if tg[0].entrycount > 0:
                        tg[0].entrycount -= 1
                        tg[0].put()

        newtags = [t for t in newtags if t != ' ']
        website.tags_spc = ' '.join(newtags)
        website.put()
        self.render('website.html', website=website)
Esempio n. 29
0
def handleApost(id):
    posts=memcache.get(KEY)
    tags=memcache.get(TAG)
    categories=memcache.get(CATEGORY)
        
    if not posts:
      
        posts = BlogPost.all().order("-timestamp").fetch(20)
        memcache.add(KEY,posts)

    if not tags:
        tags = Tag.all().fetch(20)
        memcache.add(TAG,tags)
    if not categories:
        categories= Category.all().fetch(20)
        memcache.add(CATEGORY,categories)
        
    obj=BlogPost.get_by_id(int(id))
    tagkeys=obj.tags
    
    if request.method=="GET":
        apost=APost(id=id)
        data=apost.retrieve()
        return jsonify(msg="OK",posts=data)
    elif users.is_current_user_admin() and request.method=="DELETE":
        apost=APost(id=id)
        apost.delete()
        return jsonify(msg="OK")
        
    elif  users.is_current_user_admin() and request.method=="PUT":
        title=request.json['title']
        body=request.json['body']
        date=request.json['date']
        category=request.json['category']
        posttags=request.json['tags']
        apost=APost(title,body,date,category,posttags,id)
        (data,returnedTags)=apost.update()
       
            
       
        return jsonify(msg="OK",tags=returnedTags,posts=data)
Esempio n. 30
0
    def post(self, *args, **kwargs):
        ''' Create the Dork in the system '''
        form = Form(
            title="Please enter a title",
            description="Please enter a Description",
            author="Please Enter an Author",
            query="Please Enter the Shodan Hq Search Query",
            tag="Please Select a Category"
        )
        try:
            #Getting the user
            session_manager = SessionManager.Instance()
            session = session_manager.get_session(
                self.get_secure_cookie('auth'), self.request.remote_ip)
            user = User.by_user_name(session.data['user_name'])

            #Get the tag
            old_tag = Tag.by_name(self.get_argument('tag'))

            #Get all the tags
            tags = Tag.all()

            if user != None:
                if form.validate(self.request.arguments):
                    old_dork = Dork.by_title(self.get_argument('title'))
                    if old_dork:
                        self.render('user/submit.html', user=user, errors=['A Dork by this title has already been submitted'], success=None, tags=tags)
                    elif old_tag == None:
                        self.render('user/submit.html', user=user, errors=['A Dork by this title has already been submitted'], success=None, tags=tags)
                    else:
                        self.create_dork(user)
                        self.render('user/submit.html', user=user, success='Successfully created new Dork', errors=None, tags=tags)
                else:
                    self.render('user/submit.html', user=user, errors=form.errors, success=None, tags=tags)
            else:
                self.render('public/please_login.html')
        except Exception as e:
            print e
            self.render('public/please_login.html')
Esempio n. 31
0
    def post(self):
        user = users.get_current_user()
        url = self.request.get('url_text')
        tags = self.request.get('url_tag').split(",")

        usable_tags = []
        for tag_name in tags:
            if len(tag_name) is 0:
                continue
            tag = Tag(name = tag_name)
            tags_query = Tag.all()
            tags_query.filter('name =', tag_name)
            
            if len(tags_query.fetch(1)) is not 0:
                continue
            tag.put()
            usable_tags.append(tag.key())
        
        book_mark = Bookmark(user = user, url = url, tags = usable_tags)
        book_mark.put()
        json_data = simplejson.dumps({'result':True, 'link': url, 'tags': tags})
        self.response.out.write(json_data)
Esempio n. 32
0
def action(id=None):
    if 'posts' not in globals():
        global posts
        
    posts=memcache.get(KEY)
    tags=memcache.get(TAG)
    categories=memcache.get(CATEGORY)
        
    if not posts:
      
        posts = BlogPost.all().order("-timestamp").fetch(20)
        memcache.add(KEY,posts)

    if not tags:
        tags = Tag.all().fetch(20)
        memcache.add(TAG,tags)
    if not categories:
        categories= Category.all().fetch(20)
        memcache.add(CATEGORY,categories)
    data=[]
    

#   
    if request.method=='GET':
      
       # posts = BlogPost.all()
       # posts.order("-timestamp")

    
           # if category=="categories":
                Categories=[] 
                [Categories.append([categoryobj.category,categoryobj.key().id()]) for categoryobj in categories]
                Categories=map(lambda category:{"category":category[0],"catid":category[1]} ,Categories)
                logging.info(Categories)
      
  
                return jsonify(msg="OK",categories=Categories,header="Categories",type="categories")
Esempio n. 33
0
 def post(self, *args, **kwargs):
     ''' This will search for a specific dork '''
     # top_dorks = Dork.get_top()
     form = Form(search="Please enter a search")
     tags = Tag.all()
     try:
         #Check to see if they selected  a tag
         tag_name = self.get_argument('tag')
         tag = Tag.by_name(tag_name)
     except:
         tag = None
     if form.validate(self.request.arguments):
         title = "Results:"
         if tag == None:
             #Search for all dorks
             top_dorks = Dork.search_all(self.get_argument('search'))
             self.render("public/welcome.html",
                         tags=tags,
                         dorks=top_dorks,
                         errors=None,
                         title=title)
         else:
             #Search for dorks with only that tag
             top_dorks = Dork.search_by_tag(tag,
                                            self.get_argument('search'))
             self.render("public/welcome.html",
                         tags=tags,
                         dorks=top_dorks,
                         errors=None,
                         title=title)
     else:
         top_dorks = Dork.all()
         self.render("public/welcome.html",
                     tags=tags,
                     dorks=top_dorks,
                     errors=['Please enter a Search'],
                     title="Latest Entries:")
Esempio n. 34
0
 def post(self, *args, **kwargs):
     ''' This will search for a specific dork '''
     # top_dorks = Dork.get_top()
     form = Form(search="Please enter a search")
     tags = Tag.all()
     try:
         #Check to see if they selected  a tag
         tag_name = self.get_argument('tag')
         tag = Tag.by_name(tag_name)
     except:
         tag = None
     if form.validate(self.request.arguments):
         title = "Results:"
         if tag == None:
             #Search for all dorks
             top_dorks = Dork.search_all(self.get_argument('search'))
             self.render("public/welcome.html",  tags=tags, dorks=top_dorks, errors=None, title=title)
         else:
             #Search for dorks with only that tag
             top_dorks = Dork.search_by_tag(tag, self.get_argument('search'))
             self.render("public/welcome.html",  tags=tags, dorks=top_dorks, errors=None, title=title)
     else:
         top_dorks = Dork.all()
         self.render("public/welcome.html",  tags=tags, dorks=top_dorks, errors=['Please enter a Search'], title="Latest Entries:")
Esempio n. 35
0
 def get(self, *args, **kwargs):
     top_dorks = Dork.get_top()
     tags = Tag.all()
     self.render('public/top_dorks.html', tags=tags, dorks=top_dorks)
Esempio n. 36
0
 def get(self):
     for tag in Tag.all():
         tag.delete()
     self.redirect('/tags/')
Esempio n. 37
0
 def get(self, *args, **kwargs):
     ''' Display all of the tags in the system '''
     tags = Tag.all()
     self.render("admin/manage_tags.html", tags=tags)
Esempio n. 38
0
 def get(self, *args, **kwargs):
     top_dorks = Dork.get_top()
     tags = Tag.all()
     self.render('public/top_dorks.html', tags=tags, dorks=top_dorks)
Esempio n. 39
0
 def get(self, *args, **kwargs):
     ''' Renders the welcome page '''
     top_dorks = Dork.get_top()
     tags = Tag.all()
     self.render("public/welcome.html", tags=tags, dorks=top_dorks, errors=None, title="Latest Entries:")
Esempio n. 40
0
def tags():
    return render_template('tags.html', tags=Tag.all())
Esempio n. 41
0
 def get(self, *args, **kwargs):
     ''' Display all of the tags in the system '''
     tags = Tag.all()
     self.render("admin/manage_tags.html", tags=tags)
Esempio n. 42
0
def tags():
	return render_template('tags.html', tags=Tag.all())
Esempio n. 43
0
def getAllTags():
    return Tag.all().order('-useCount')
Esempio n. 44
0
def recipe_viewmodel(json):
    return {
        'json' : json,
        'alltags' : [t for t in Tag.all()]
        }