lib/pastenum/targets/gist.rb
def page_numbers
      page_num = 1
      next_page = true
      
      print "[*] Parsing pages:".green if @verbose
      while next_page && page_num < @max_pages

        print "#".green if @verbose
        begin
          page = @agent.get("https://gist.github.com/search?page=#{page_num}&q=#{@dork}")
        rescue
          raise TargetUnreachable, "[!] ERROR: Can not load gist.github - Check Connectivity"
        end
        
        # Find the link with the -> arrow, is it enabled?
        # //div[@class='pagination']
        pagination_parsed = false
        
        page.links.each do |link|
          if link.href.match(/\/search\?page\=/)
            if link.text.match(/#x2192/)
              page_num += 1
            else
              next_page = false
            end
            pagination_parsed = true
          end
        end
        
        #handle single page of results
        next_page = false unless pagination_parsed
        
      end
      
      return page_num
      
    end
def page_numbers
      page_num = 1
      next_page = true
      
      print "[*] Parsing pages:".green if @verbose
      while next_page && page_num < @max_pages

        print "#".green if @verbose
        begin
          page = @agent.get("https://gist.github.com/search?page=#{page_num}&q=#{@dork}")
        rescue
          raise TargetUnreachable, "[!] ERROR: Can not load gist.github - Check Connectivity"
        end
        
        # Find the link with the -> arrow, is it enabled?
        # //div[@class='pagination']
        pagination_parsed = false
        
        page.links.each do |link|
          if link.href.match(/\/search\?page\=/)
            if link.text.match(/#x2192/)
              page_num += 1
            else
              next_page = false
            end
            pagination_parsed = true
          end
        end
        
        #handle single page of results
        next_page = false unless pagination_parsed
        
      end
      
      return page_num
      
    end
TODO: This is very inefficient. This is double fetch reading.