code
stringlengths
1
1.73M
language
stringclasses
1 value
class PortKey < ActiveRecord::Base end
Ruby
class Icmp < ActiveRecord::Base belongs_to :host set_table_name "view_icmp" end
Ruby
class Issue < ActiveRecord::Base belongs_to :port set_table_name "view_issues" end
Ruby
class PasswordHashsController < ApplicationController require 'paginator' # GET /password_hash # GET /password_hash.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].ni...
Ruby
class PortSummarysController < ApplicationController require 'paginator' # GET /port_summary # GET /port_summary.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class HelpController < ApplicationController # GET /help # GET /help.xml def index @yaptestfe_version="1.1" respond_to do |format| format.html # index.html.erb end end def show @yaptestfe_version="1.1" respond_to do |format| format.html # show.html.erb end end def test ...
Ruby
class WindowsHostInfosController < ApplicationController require 'paginator' # GET /windows_host_infos # GET /windows_host_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params...
Ruby
class PortInfosController < ApplicationController require 'paginator' # GET /port_infos # GET /port_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class CredentialsController < ApplicationController require 'paginator' # GET /credentials # GET /credentials.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class IssuesController < ApplicationController require 'paginator' # GET /issues # GET /issues.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[...
Ruby
class GroupsController < ApplicationController require 'paginator' # GET /groups def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sort_by] == "group_...
Ruby
class NmapInfosController < ApplicationController require 'paginator' # GET /nmap_infos # GET /nmap_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class HostInfosController < ApplicationController require 'paginator' # GET /host_infos # GET /host_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:hostname_v].nil? ...
Ruby
class HostsToMacAddressesController < ApplicationController require 'paginator' # GET /hosts_to_mac_addresses # GET /hosts_to_mac_addresses.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if...
Ruby
class TablenController < ApplicationController def set if not params[:id].nil? and params[:id].to_i > 0 and params[:id].to_i < 100000 session[:tablen] = params[:id].to_i end redirect_to :back end end
Ruby
class InsecureProtocolsController < ApplicationController require 'paginator' # GET /insecure_protocol # GET /insecure_protocol.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[...
Ruby
class HostsController < ApplicationController require 'paginator' # GET /hosts # GET /hosts.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:hostname_v].nil? where[:hostn...
Ruby
class TopologysController < ApplicationController def index if session[:test_area].nil? @topologies = Topology.find(:all) else @topologies = Topology.find_all_by_test_area_id(session[:test_area]) end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @topo...
Ruby
class PortsController < ApplicationController require 'paginator' # GET /ports # GET /ports.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:so...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. # DB selection code based on: # http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases class ApplicationController < ActionController::Base # here, we ho...
Ruby
class IcmpsController < ApplicationController require 'paginator' # GET /icmps # GET /icmps.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sor...
Ruby
class TestAreasController < ApplicationController require 'paginator' # GET /test_areas # GET /test_areas.xml def index @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sort_by] == "test_area...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require 'optparse' OPTIONS = { :username => "yaptest_user", :password => "pass", # doesn't matter if local trust is configured :port => 5432, :ip => "127.0.0.1", :dbname => nil, :webport => 3000, :webip => "127.0.0.1", :type => "postgresql" } ARGV.options do |op...
Ruby
#!/usr/bin/env ruby require 'optparse' OPTIONS = { :username => "yaptest_user", :password => "pass", # doesn't matter if local trust is configured :port => 5432, :ip => "127.0.0.1", :dbname => nil, :webport => 3000, :webip => "127.0.0.1", :type => "postgresql" } ARGV.options do |op...
Ruby
require 'forwardable' class Paginator VERSION = '1.1.0' include Enumerable class ArgumentError < ::ArgumentError; end class MissingCountError < ArgumentError; end class MissingSelectError < ArgumentError; end attr_reader :per_page, :count # Instantiate a new Paginator object # # Provi...
Ruby
ActiveRecord::Base.establish_connection( :adapter => ENV['YAPTESTFE_DBTYPE'], :host => ENV['YAPTESTFE_DBIP'], :port => ENV['YAPTESTFE_DBPORT'].to_i, :username => ENV['YAPTESTFE_DBUSER'], :password => ENV['YAPTESTFE_DBPASS'], :database => ENV['...
Ruby
# Settings specified here will take precedence over those in config/environment.rb # The production environment is meant for finished, "live" apps. # Code is not reloaded between requests config.cache_classes = true # Use a different logger for distributed setups # config.logger = SyslogLogger.new # Full error repor...
Ruby
# Be sure to restart your server when you modify this file # Uncomment below to force Rails into production mode when # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' # Specifies gem version of Rails to use when vendor/rails is not present # RAILS_GEM_VERSION = '2...
Ruby
# Don't change this file! # Configure your app in config/environment.rb and config/environments/*.rb RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) module Rails class << self def boot! unless booted? preinitialize pick_boot.run end end def booted? ...
Ruby
ActionController::Routing::Routes.draw do |map| map.resources :icmps map.resources :hosts_to_mac_addresses map.resources :mac_addresses map.resources :db map.resources :help map.resources :host_keys map.resources :topologys map.resources :host_info_keys map.resources :tablen map.resources :...
Ruby
# Methods added to this helper will be available to all templates in the application. module ApplicationHelper def filter_icon (tool_tip, param_v, link_opts={}) # If we aren't currely filtering on this field, print the filter icon if param_v.nil? return link_to(image_tag("filter.png", :align => 'absmiddle')...
Ruby
module PortsHelper end
Ruby
module TransportProtocolsHelper end
Ruby
module MacAddressesHelper end
Ruby
module IcmpsHelper end
Ruby
module PortInfosHelper end
Ruby
module HostsToMacAddressesHelper end
Ruby
module HostInfosHelper end
Ruby
module HostHelper end
Ruby
module CredentialsHelper end
Ruby
module CredentialTypesHelper end
Ruby
module TestAreasHelper end
Ruby
module PortKeysHelper end
Ruby
module HostKeysHelper end
Ruby
module PortSummaryHelper end
Ruby
module HostsHelper end
Ruby
class InsecureProtocol < ActiveRecord::Base set_table_name "view_insecure_protos" end
Ruby
class PasswordHash < ActiveRecord::Base set_table_name "view_password_hashes" end
Ruby
class Credential < ActiveRecord::Base belongs_to :port belongs_to :host set_table_name :view_credentials end
Ruby
class NmapInfo < ActiveRecord::Base belongs_to :port # belongs_to :port_key, :foreign_key => "key_id" set_table_name "view_nmap_info" end
Ruby
class PortSummary < ActiveRecord::Base set_table_name "view_port_summary" end
Ruby
class Host < ActiveRecord::Base set_table_name "view_hosts" set_primary_key "host_id" end
Ruby
class MacAddresses < ActiveRecord::Base end
Ruby
class Port < ActiveRecord::Base belongs_to :host set_primary_key "port_id" set_table_name "view_ports" end
Ruby
class HostInfo < ActiveRecord::Base belongs_to :host belongs_to :host_key set_table_name "view_host_info" end
Ruby
class PortInfoSsl < ActiveRecord::Base belongs_to :port # belongs_to :port_key, :foreign_key => "key_id" set_table_name "view_port_info_ssl" end
Ruby
class Topology < ActiveRecord::Base set_table_name "view_topology" end
Ruby
class HostKey < ActiveRecord::Base end
Ruby
class TestArea < ActiveRecord::Base end
Ruby
class Hostname < ActiveRecord::Base end
Ruby
class HostsToMacAddresses < ActiveRecord::Base belongs_to :host set_table_name "view_mac_addresses" end
Ruby
class CredentialType < ActiveRecord::Base end
Ruby
class TransportProtocol < ActiveRecord::Base end
Ruby
class WindowsHostInfo < ActiveRecord::Base belongs_to :host belongs_to :host_key set_table_name "view_windows_host_info" end
Ruby
class Group < ActiveRecord::Base belongs_to :port belongs_to :host set_table_name :view_groups end
Ruby
class Interface < ActiveRecord::Base set_table_name "view_interfaces" end
Ruby
class PortInfo < ActiveRecord::Base belongs_to :port # belongs_to :port_key, :foreign_key => "key_id" set_table_name "view_port_info" end
Ruby
class PortKey < ActiveRecord::Base end
Ruby
class Icmp < ActiveRecord::Base belongs_to :host set_table_name "view_icmp" end
Ruby
class Issue < ActiveRecord::Base belongs_to :port set_table_name "view_issues" end
Ruby
class PasswordHashsController < ApplicationController require 'paginator' # GET /password_hash # GET /password_hash.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].ni...
Ruby
class PortSummarysController < ApplicationController require 'paginator' # GET /port_summary # GET /port_summary.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class HelpController < ApplicationController # GET /help # GET /help.xml def index svn = "$Revision: 8 $".gsub(/[^0-9]/, "") @yaptestfe_version="1.1-rc4" if not svn =~ /^\s*$/ @yaptestfe_version = @yaptestfe_version + "-svn-" + svn end respond_to do |format| format.html # index.html.erb ...
Ruby
class WindowsHostInfosController < ApplicationController require 'paginator' # GET /windows_host_infos # GET /windows_host_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params...
Ruby
class PortInfosController < ApplicationController require 'paginator' # GET /port_infos # GET /port_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class CredentialsController < ApplicationController require 'paginator' # GET /credentials # GET /credentials.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class IssuesController < ApplicationController require 'paginator' # GET /issues # GET /issues.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[...
Ruby
class GroupsController < ApplicationController require 'paginator' # GET /groups def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sort_by] == "group_...
Ruby
class NmapInfosController < ApplicationController require 'paginator' # GET /nmap_infos # GET /nmap_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? ...
Ruby
class HostInfosController < ApplicationController require 'paginator' # GET /host_infos # GET /host_infos.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:hostname_v].nil? ...
Ruby
class HostsToMacAddressesController < ApplicationController require 'paginator' # GET /hosts_to_mac_addresses # GET /hosts_to_mac_addresses.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if...
Ruby
class TablenController < ApplicationController def set if not params[:id].nil? and params[:id].to_i > 0 and params[:id].to_i < 100000 session[:tablen] = params[:id].to_i end redirect_to :back end end
Ruby
class InsecureProtocolsController < ApplicationController require 'paginator' # GET /insecure_protocol # GET /insecure_protocol.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[...
Ruby
class HostsController < ApplicationController require 'paginator' # GET /hosts # GET /hosts.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:hostname_v].nil? where[:hostn...
Ruby
class TopologysController < ApplicationController def index if session[:test_area].nil? @topologies = Topology.find(:all) else @topologies = Topology.find_all_by_test_area_id(session[:test_area]) end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @topo...
Ruby
class PortsController < ApplicationController require 'paginator' # GET /ports # GET /ports.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:so...
Ruby
# Filters added to this controller apply to all controllers in the application. # Likewise, all the methods added will be available for all controllers. # DB selection code based on: # http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases class ApplicationController < ActionController::Base # here, we ho...
Ruby
class IcmpsController < ApplicationController require 'paginator' # GET /icmps # GET /icmps.xml def index where = {} @url_params = {} @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sor...
Ruby
class TestAreasController < ApplicationController require 'paginator' # GET /test_areas # GET /test_areas.xml def index @sort_by = nil @sort_dir = nil order_clause = nil if session[:tablen].nil? session[:tablen] = 20 end if not params[:sort_by].nil? if params[:sort_by] == "test_area...
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../config/boot' require 'commands/server'
Ruby
#!/usr/bin/env ruby require 'optparse' OPTIONS = { :username => "yaptest_user", :password => "pass", # doesn't matter if local trust is configured :port => 5432, :ip => "127.0.0.1", :dbname => nil, :webport => 3000, :webip => "127.0.0.1", :type => "postgresql", :wizard => 0, :...
Ruby
#!/usr/bin/env ruby require 'optparse' OPTIONS = { :username => "yaptest_user", :password => "pass", # doesn't matter if local trust is configured :port => 5432, :ip => "127.0.0.1", :dbname => nil, :webport => 3000, :webip => "127.0.0.1", :type => "postgresql", :wizard => 0, :...
Ruby
require 'forwardable' class Paginator VERSION = '1.1.0' include Enumerable class ArgumentError < ::ArgumentError; end class MissingCountError < ArgumentError; end class MissingSelectError < ArgumentError; end attr_reader :per_page, :count # Instantiate a new Paginator object # # Provi...
Ruby
class String def to_color_array [self[1,2], self[3,2], self[5,2]].map{|e| e.to_i(16) } end alias to_array to_color_array end class Integer def even? self[0].zero? end def odd? not even? end end class Object def acts_as_indexable_board class << self alias old_at [] def [](index) if not (...
Ruby
require 'helpers' class Controls attr_accessor :menu_color Surface.autoload_dirs << File.join(File.dirname(__FILE__), 'cards', 'pirates') Surface.autoload_dirs << File.join(File.dirname(__FILE__), 'cards', 'zombies') Actions = ['move', 'charge', 'card', 'end turn'] Actions_font = TTF.new('times_new_yorker.ttf'...
Ruby
require 'rubygems' require 'rubygame' include Rubygame raise 'Images disabled' unless VERSIONS[:sdl_image] != nil raise 'Font disabled' unless VERSIONS[:sdl_ttf] != nil raise 'Sound disabled' unless VERSIONS[:sdl_mixer] != nil Rubygame::TTF.setup require 'helpers' require 'events' require 'controls' require 'game' d...
Ruby
require 'helpers' require 'rubygame' class Tile attr_reader :x, :y, :item def initialize(x, y, item) @x, @y = x, y @item = item @hexagon = make_hexagon_coordinates(@x, @y) @color = GAME_COLORS::NEUTRAL_LAND end def draw(surface) surface.draw_polygon_s(@hexagon, @color) surface.draw_polygon_a(@hexago...
Ruby