Repository: tresacton/dspectrumgui Branch: master Commit: d80d063cd7c8 Files: 267 Total size: 274.5 KB Directory structure: gitextract_do_0u321/ ├── .gitignore ├── .rspec ├── .ruby-gemset ├── .ruby-version ├── .well-known/ │ └── .placeholder ├── COMM-LICENSE ├── Gemfile ├── Guardfile ├── LICENSE ├── README.md ├── Rakefile ├── SECURITY.md ├── app/ │ ├── assets/ │ │ ├── images/ │ │ │ └── .keep │ │ ├── javascripts/ │ │ │ ├── advisories.coffee │ │ │ ├── advisory_comments.coffee │ │ │ ├── application.js │ │ │ ├── captures.coffee │ │ │ ├── categories.coffee │ │ │ ├── challenge_attempts.coffee │ │ │ ├── challenges.coffee │ │ │ ├── dashboard.coffee │ │ │ ├── devices.coffee │ │ │ ├── messages.coffee │ │ │ ├── product_versions.coffee │ │ │ ├── products.coffee │ │ │ ├── profile.coffee │ │ │ ├── sections.coffee │ │ │ ├── submission.coffee │ │ │ ├── triage.coffee │ │ │ ├── units.coffee │ │ │ └── vendors.coffee │ │ └── stylesheets/ │ │ ├── advisories.scss │ │ ├── advisory_comments.scss │ │ ├── application.scss │ │ ├── captures.scss │ │ ├── categories.scss │ │ ├── challenge_attempts.scss │ │ ├── challenges.scss │ │ ├── dashboard.scss │ │ ├── devices.scss │ │ ├── messages.scss │ │ ├── product_versions.scss │ │ ├── products.scss │ │ ├── profile.scss │ │ ├── researcher.scss │ │ ├── scaffolds.scss │ │ ├── sections.scss │ │ ├── submission.scss │ │ ├── triage.scss │ │ ├── units.scss │ │ └── vendors.scss │ ├── controllers/ │ │ ├── application_controller.rb │ │ ├── captures_controller.rb │ │ ├── concerns/ │ │ │ └── .keep │ │ ├── dashboard_controller.rb │ │ ├── devices_controller.rb │ │ ├── registrations_controller.rb │ │ ├── section_templates_controller.rb │ │ ├── sections_controller.rb │ │ └── units_controller.rb │ ├── helpers/ │ │ ├── application_helper.rb │ │ ├── captures_helper.rb │ │ ├── dashboard_helper.rb │ │ ├── devices_helper.rb │ │ ├── section_templates_helper.rb │ │ ├── sections_helper.rb │ │ └── units_helper.rb │ ├── models/ │ │ ├── .keep │ │ ├── capture.rb │ │ ├── concerns/ │ │ │ └── .keep │ │ ├── cons.rb │ │ ├── device.rb │ │ ├── section.rb │ │ ├── section_template.rb │ │ ├── unit.rb │ │ └── user.rb │ └── views/ │ ├── application/ │ │ └── _favicon.html.erb │ ├── captures/ │ │ ├── _form.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── index.json.jbuilder │ │ ├── new.html.haml │ │ ├── show.html.haml │ │ └── show.json.jbuilder │ ├── dashboard/ │ │ ├── about.html.haml │ │ ├── contribute.html.haml │ │ └── temp.html.haml │ ├── devices/ │ │ ├── _add_unit.html.haml │ │ ├── _form.html.haml │ │ ├── _manchester_analysis.html.haml │ │ ├── _pwm_analysis.html.haml │ │ ├── _raw_analysis.html.haml │ │ ├── _show_units.html.haml │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ ├── index.json.jbuilder │ │ ├── new.html.haml │ │ ├── show.html.haml │ │ └── show.json.jbuilder │ ├── devise/ │ │ ├── confirmations/ │ │ │ └── new.html.erb │ │ ├── mailer/ │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── password_change.html.erb │ │ │ ├── reset_password_instructions.html.erb │ │ │ └── unlock_instructions.html.erb │ │ ├── passwords/ │ │ │ ├── edit.html.haml │ │ │ └── new.html.haml │ │ ├── registrations/ │ │ │ ├── edit.html.erb │ │ │ └── new.html.haml │ │ ├── sessions/ │ │ │ └── new.html.haml │ │ ├── shared/ │ │ │ └── _links.html.erb │ │ └── unlocks/ │ │ └── new.html.haml │ ├── layouts/ │ │ ├── _footer.html.erb │ │ ├── _messages.html.haml │ │ ├── _navigation.html.haml │ │ ├── _navigation_links.html.erb │ │ ├── application.html.haml │ │ ├── mailer.html.haml │ │ └── mailer.text.haml │ ├── profile/ │ │ ├── edit.html.haml │ │ ├── index.html.haml │ │ └── show.html.haml │ ├── section_templates/ │ │ ├── index.html.haml │ │ └── show.html.haml │ ├── sections/ │ │ ├── _form.html.haml │ │ ├── _manchester_analysis.html.haml │ │ ├── _no_sections.html.haml │ │ ├── _pwm_analysis.html.haml │ │ ├── _raw_analysis.html.haml │ │ ├── _rfcat_config.html.haml │ │ ├── _section_transformations.html.haml │ │ ├── _sections.html.haml │ │ ├── edit.html.haml │ │ ├── generate.html.haml │ │ ├── index.html.haml │ │ ├── index.json.jbuilder │ │ ├── new.html.haml │ │ ├── show.html.haml │ │ └── show.json.jbuilder │ └── units/ │ ├── _captures.html.haml │ ├── _form.html.haml │ ├── _manchester_analysis.html.haml │ ├── _manchester_decoding.html.haml │ ├── _pwm_analysis.html.haml │ ├── _pwm_decoding.html.haml │ ├── _raw_analysis.html.haml │ ├── _raw_decoding.html.haml │ ├── edit.html.haml │ ├── index.html.haml │ ├── index.json.jbuilder │ ├── new.html.haml │ ├── show.html.haml │ └── show.json.jbuilder ├── bin/ │ ├── bundle │ ├── rails │ ├── rake │ └── setup ├── config/ │ ├── application.rb │ ├── boot.rb │ ├── database.yml │ ├── environment.rb │ ├── environments/ │ │ ├── development.rb │ │ ├── production.rb │ │ └── test.rb │ ├── favicon.json │ ├── initializers/ │ │ ├── action_mailer.rb │ │ ├── assets.rb │ │ ├── backtrace_silencers.rb │ │ ├── cookies_serializer.rb │ │ ├── devise.rb │ │ ├── filter_parameter_logging.rb │ │ ├── inflections.rb │ │ ├── kaminari.rb │ │ ├── mime_types.rb │ │ ├── session_store.rb │ │ ├── simple_form.rb │ │ └── wrap_parameters.rb │ ├── locales/ │ │ ├── devise.en.yml │ │ ├── en.yml │ │ ├── simple_form.en.yml │ │ ├── social_share_button.en.yml │ │ ├── social_share_button.zh-CN.yml │ │ └── social_share_button.zh-TW.yml │ ├── railscomposer.yml │ ├── routes.rb │ └── secrets.yml ├── config.ru ├── db/ │ ├── migrate/ │ │ ├── 20160225071956_devise_create_users.rb │ │ ├── 20160227015521_add_full_name_to_user.rb │ │ ├── 20160918060423_create_devices.rb │ │ ├── 20160918060509_create_units.rb │ │ ├── 20160918060631_create_captures.rb │ │ ├── 20170515023720_create_sections.rb │ │ ├── 20170520033410_add_flip_pwm_to_devices.rb │ │ └── 20170525084143_create_section_templates.rb │ ├── schema.rb │ ├── seeds.rb │ └── template_seeds/ │ └── user_contributions.rb ├── lib/ │ ├── assets/ │ │ └── .keep │ ├── tasks/ │ │ ├── .keep │ │ ├── account_seeds.rake │ │ └── custom_seed.rake │ └── templates/ │ └── haml/ │ └── scaffold/ │ └── _form.html.haml ├── public/ │ ├── 404.html │ ├── 422.html │ ├── 500.html │ └── robots.txt ├── spec/ │ ├── controllers/ │ │ ├── captures_controller_spec.rb │ │ ├── devices_controller_spec.rb │ │ ├── section_templates_controller_spec.rb │ │ ├── sections_controller_spec.rb │ │ └── units_controller_spec.rb │ ├── factories/ │ │ ├── captures.rb │ │ ├── devices.rb │ │ ├── section_templates.rb │ │ ├── sections.rb │ │ └── units.rb │ ├── helpers/ │ │ ├── captures_helper_spec.rb │ │ ├── devices_helper_spec.rb │ │ ├── section_templates_helper_spec.rb │ │ ├── sections_helper_spec.rb │ │ └── units_helper_spec.rb │ ├── models/ │ │ ├── capture_spec.rb │ │ ├── device_spec.rb │ │ ├── section_spec.rb │ │ ├── section_template_spec.rb │ │ └── unit_spec.rb │ ├── rails_helper.rb │ ├── requests/ │ │ ├── captures_spec.rb │ │ ├── devices_spec.rb │ │ ├── section_templates_spec.rb │ │ ├── sections_spec.rb │ │ └── units_spec.rb │ ├── routing/ │ │ ├── captures_routing_spec.rb │ │ ├── devices_routing_spec.rb │ │ ├── section_templates_routing_spec.rb │ │ ├── sections_routing_spec.rb │ │ └── units_routing_spec.rb │ ├── spec_helper.rb │ └── views/ │ ├── captures/ │ │ ├── edit.html.haml_spec.rb │ │ ├── index.html.haml_spec.rb │ │ ├── new.html.haml_spec.rb │ │ └── show.html.haml_spec.rb │ ├── devices/ │ │ ├── edit.html.haml_spec.rb │ │ ├── index.html.haml_spec.rb │ │ ├── new.html.haml_spec.rb │ │ └── show.html.haml_spec.rb │ ├── section_templates/ │ │ ├── edit.html.haml_spec.rb │ │ ├── index.html.haml_spec.rb │ │ ├── new.html.haml_spec.rb │ │ └── show.html.haml_spec.rb │ ├── sections/ │ │ ├── edit.html.haml_spec.rb │ │ ├── index.html.haml_spec.rb │ │ ├── new.html.haml_spec.rb │ │ └── show.html.haml_spec.rb │ └── units/ │ ├── edit.html.haml_spec.rb │ ├── index.html.haml_spec.rb │ ├── new.html.haml_spec.rb │ └── show.html.haml_spec.rb ├── test/ │ ├── controllers/ │ │ └── .keep │ ├── fixtures/ │ │ └── .keep │ ├── helpers/ │ │ └── .keep │ ├── integration/ │ │ └── .keep │ ├── mailers/ │ │ └── .keep │ ├── models/ │ │ └── .keep │ └── test_helper.rb └── vendor/ └── assets/ ├── javascripts/ │ └── .keep └── stylesheets/ └── .keep ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ #---------------------------------------------------------------------------- # Ignore these files when commiting to a git repository. # # See http://help.github.com/ignore-files/ for more about ignoring files. # # The original version of this file is found here: # https://github.com/RailsApps/rails-composer/blob/master/files/gitignore.txt # # Corrections? Improvements? Create a GitHub issue: # http://github.com/RailsApps/rails-composer/issues #---------------------------------------------------------------------------- # user files /mcs/* # github issue template files /.github # bundler state /.bundle /vendor/bundle/ /vendor/ruby/ # minimal Rails specific artifacts db/*.sqlite3 /db/*.sqlite3-journal /log/* /tmp/* # add /config/database.yml if it contains passwords # /config/database.yml # various artifacts **.war *.rbc *.sassc .redcar/ .sass-cache /config/config.yml /coverage.data /coverage/ /db/*.javadb/ /db/*.sqlite3 /doc/api/ /doc/app/ /doc/features.html /doc/specs.html /public/cache /public/stylesheets/compiled /public/system/* /spec/tmp/* /cache /capybara* /capybara-*.html /gems /specifications rerun.txt pickle-email-*.html .zeus.sock # If you find yourself ignoring temporary files generated by your text editor # or operating system, you probably want to add a global ignore instead: # git config --global core.excludesfile ~/.gitignore_global # # Here are some files you may want to ignore globally: # scm revert files **.orig # Mac finder artifacts .DS_Store # Netbeans project directory /nbproject/ # RubyMine project files .idea # Textmate project files /*.tmproj # vim artifacts **.swp # Environment files that may contain sensitive data .env .powenv # tilde files are usually backup files from a text editor *~ ================================================ FILE: .rspec ================================================ --require spec_helper --format Fuubar --color ================================================ FILE: .ruby-gemset ================================================ dspectrumgui ================================================ FILE: .ruby-version ================================================ ruby-2.5.5 ================================================ FILE: .well-known/.placeholder ================================================ ================================================ FILE: COMM-LICENSE ================================================ MIT License Copyright (c) 2017 Très Acton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: Gemfile ================================================ source 'https://rubygems.org' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' ruby '2.5.5' gem 'rails', '4.2.11.1' # gem 'letsencrypt_plugin' # free SSL # Use sqlite3 as the database for Active Record # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.1.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks gem 'turbolinks' gem 'jquery-turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' # bundle exec rake doc:rails generates the API under doc/api. gem 'will_paginate' gem 'will_paginate-bootstrap' gem 'seed_dump' gem 'shareable' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Unicorn as the app server # gem 'unicorn' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug' gem 'rake-progressbar' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'rails_real_favicon' gem 'pry' end gem "administrate" gem 'bootstrap-sass' gem 'devise' gem 'devise_invitable' gem 'haml-rails' gem 'high_voltage' # gem 'pg' gem 'simple_form' gem 'upmin-admin' group :development do # Access an IRB console on exception pages or by using <%= console %> in views gem 'web-console', '~> 2.0' gem 'better_errors' gem 'binding_of_caller', :platforms=>[:mri_21] gem 'guard-bundler' gem 'guard-rails' gem 'html2haml' gem 'quiet_assets' gem 'rails_apps_pages' gem 'rails_apps_testing' gem 'rails_layout' gem 'rb-fchange', :require=>false gem 'rb-inotify', :require=>false gem 'spring-commands-rspec' end group :development, :test do gem "sqlite3", "~> 1.3.6" gem 'factory_girl_rails' gem 'faker' gem 'rspec-rails' gem 'shoulda' gem 'rb-fsevent', :require => false #if RUBY_PLATFORM =~ /darwin/i gem 'guard-rspec' gem 'fuubar' end group :production do #gem 'puma' gem 'rails_12factor' end group :test do gem 'capybara' gem 'database_cleaner' gem 'launchy' gem 'selenium-webdriver' end ================================================ FILE: Guardfile ================================================ # A sample Guardfile # More info at https://github.com/guard/guard#readme ## Uncomment and set this to only include directories you want to watch # directories %w(app lib config test spec features) \ # .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")} ## Note: if you are using the `directories` clause above and you are not ## watching the project directory ('.'), then you will want to move ## the Guardfile to a watched dir and symlink it back, e.g. # # $ mkdir config # $ mv Guardfile config/ # $ ln -s config/Guardfile . # # and, you'll have to watch "config/Guardfile" instead of "Guardfile" # Note: The cmd option is now required due to the increasing number of ways # rspec may be run, below are examples of the most common uses. # * bundler: 'bundle exec rspec' # * bundler binstubs: 'bin/rspec' # * spring: 'bin/rspec' (This will use spring if running and you have # installed the spring binstubs per the docs) # * zeus: 'zeus rspec' (requires the server to be started separately) # * 'just' rspec: 'rspec' guard :rspec, cmd: "bundle exec rspec" do require "guard/rspec/dsl" dsl = Guard::RSpec::Dsl.new(self) # Feel free to open issues for suggestions and improvements # RSpec files rspec = dsl.rspec watch(rspec.spec_helper) { rspec.spec_dir } watch(rspec.spec_support) { rspec.spec_dir } watch(rspec.spec_files) # Ruby files ruby = dsl.ruby dsl.watch_spec_files_for(ruby.lib_files) # Rails files rails = dsl.rails(view_extensions: %w(erb haml slim)) dsl.watch_spec_files_for(rails.app_files) dsl.watch_spec_files_for(rails.views) watch(rails.controllers) do |m| [ rspec.spec.("routing/#{m[1]}_routing"), rspec.spec.("controllers/#{m[1]}_controller"), rspec.spec.("acceptance/#{m[1]}") ] end # Rails config changes watch(rails.spec_helper) { rspec.spec_dir } watch(rails.routes) { "#{rspec.spec_dir}/routing" } watch(rails.app_controller) { "#{rspec.spec_dir}/controllers" } # Capybara features specs watch(rails.view_dirs) { |m| rspec.spec.("features/#{m[1]}") } watch(rails.layouts) { |m| rspec.spec.("features/#{m[1]}") } # Turnip features and steps watch(%r{^spec/acceptance/(.+)\.feature$}) watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) do |m| Dir[File.join("**/#{m[1]}.feature")][0] || "spec/acceptance" end end ================================================ FILE: LICENSE ================================================ GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Remote Network Interaction; Use with the GNU General Public License. Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . ================================================ FILE: README.md ================================================ # DSpectrumGUI The goal of this app is to make it trivial to demodulate common RF signals, and provide a digital worksheet for your reverse engineering efforts. ![DSpectrumGUI Screenshot](https://raw.githubusercontent.com/tresacton/dspectrumgui/master/public/screenshot.png) # Installation Step by step instructions for Kali Linux (Debian based OS), and MAC OSX, are both available in the wiki: # Features * Community can trivially donate reverse engineering worksheet templates * Users can trivially import donated reverse engineering worksheet templates * Ability to store device metadata and transmission binary * Wraps Inspectrum and uses its "Extract Symbols" feature to help convert pulses into raw binary * Automatic analysis of the binary to determine the modulation and encoding types (see Supported modulation types) * Some error detection and verbose comments where the app believes it knows which modulation type would have been valid if the user better aligned the symbols in Inspectrum (particularly where significant whitespace was missed in PWM or where symbols are misaligned for Manchester) * Reverse Engineering Worksheet to help you visualise the packet structure and comment on sections of the signal * Binary Generation for RFCat transmission # Do I need any hardware? You do if you need to capture transmissiosn from your device. An RTL-SDR, a HackRF, or anything else that will work with tools like osmocom_fft (which is the recommended way to capture your transmission for use with this tool). If you're just here to try it out and have no hardware, find a CFILE/IQ file on the internet for a simple device and give it a shot. As long as its a format supported by Inspectrum, you're good to go. # How does it work? Assuming you have already captured some signals (Osmocom_fft is great for this!), and have created a new "Device" and "Unit" in DSpectrumGUI, you can click the link "Add New Capture". The application will then spawn an instance of Inspectrum. Once you've appropriately adjusted your symbol/grid overlay in Inspectrum, and asked it to "extract symbols", DSpectrumGUI will then convert that data into a binary string and attempt to automatically demodulate/decode it for you. It also provides a database for you to store pertinent information such as the frequency, baudrate, and FCC ID of the device for your future reference. When you have some demodulated signals and navigate to the "Reverse Engineering Worksheet" for the device, DSpectrumGUI will present you with a form that allows you to define your own definitions for each section of the data (e.g. marking the first 'n' bits as the Device Identifier string - if that's what you discover they represent), and record your notes/observations about that section as you are working. This is very useful as you are reverse engineering your device. It allows you to keep all of your notes and observations in once place, in a structured and organised manner. Once you're satisfied with your demodulation and reverse engineering, you can choose to share your section definitions as a template for other DSpectrumGUI users to benefit from. The reverse engineering worksheet view also helps you to view some common binary to integer translations for your defined sections, and gives you some code you can use to attempt to generate your own signals using RFCat. # Supported Modulation/Encoding * Pulse-width Modulation (PWM) - 77/25 duty cycle version, and 66/33 duty cycle version * Frequency Shift Keying (2FSK) - though the app will treat it as OOK * On-off Keying (OOK) / Amplitude Shift Keying (ASK) * Manchester encoding - both "G. E. Thomas" format, and "IEE 802" format # Usage The wiki will be updated as I have time. In the interim, there's a high-level PDF guide I developed for a workshop which demonstrates the basic use of this application. It's available here: [DSpectrumGUI Reverse Engineering Guide](https://github.com/tresacton/dspectrumgui/raw/master/public/DSpectrumGUI%20%E2%80%93%20Reverse%20Engineering%20Guide.pdf) ## License Licensing is AGPL by default for personal use. An MIT license is available for purchase for commercial use. ================================================ FILE: Rakefile ================================================ # 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__) Rails.application.load_tasks ================================================ FILE: SECURITY.md ================================================ # Security Policy ## Supported Versions | Version | Supported | | ------- | ------------------ | | Master | :white_check_mark: | | v1.0.0 | :white_check_mark: | ## Reporting a Vulnerability Open an issue. This isn't a production / public facing tool, and it can be run in a VM in isolation (with a local only connection) as it doesn't interface directly with any SDR/RF hardware to mitigate risks. If you found a vuln, chances are someone else has too. Add it in as an issue here for all to see so I'm pressured to do something about it =P That said - this application isn't intended to have a high security maturity. I'll certainly make an effort to fix things where possible. Feel empowered to help me out by submitting a pull request for a fix. If it seems sound and doesn't break anything, I'll pull it into the codebase. Thanks xD ================================================ FILE: app/assets/images/.keep ================================================ ================================================ FILE: app/assets/javascripts/advisories.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/advisory_comments.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/application.js ================================================ // This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require jquery.turbolinks //= require bootstrap-sprockets //= require_tree . ================================================ FILE: app/assets/javascripts/captures.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/categories.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/challenge_attempts.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/challenges.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/dashboard.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/devices.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/messages.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/product_versions.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/products.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/profile.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/sections.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/submission.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/triage.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/units.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/javascripts/vendors.coffee ================================================ # Place all the behaviors and hooks related to the matching controller here. # All this logic will automatically be available in application.js. # You can use CoffeeScript in this file: http://coffeescript.org/ ================================================ FILE: app/assets/stylesheets/advisories.scss ================================================ // Place all the styles related to the Advisories controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/advisory_comments.scss ================================================ // Place all the styles related to the AdvisoryComments controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/application.scss ================================================ /* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any styles * defined in the other CSS/SCSS files in this directory. It is generally better to create a new * file per style scope. * *= require_tree . *= require_self */ // "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables" @import "bootstrap-sprockets"; @import "bootstrap"; @import "bootstrap.min"; @font-face { font-family: "neuropol"; src: asset-url('neuropol.ttf') format('truetype'), } .neuro { font-family: 'neuropol'; } .nounderline{text-decoration: none} ================================================ FILE: app/assets/stylesheets/captures.scss ================================================ // Place all the styles related to the Captures controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/categories.scss ================================================ // Place all the styles related to the Categories controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/challenge_attempts.scss ================================================ // Place all the styles related to the ChallengeAttempts controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/challenges.scss ================================================ // Place all the styles related to the Challenges controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/dashboard.scss ================================================ // Place all the styles related to the Dashboard controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ .mcontainer { width: 100%; height: 10em; margin: 1em auto; overflow: hidden; /*background: grey;*/ position: bottom; box-sizing: border-box; } .right { float:right; } .marquee { top: 6em; position: relative; box-sizing: border-box; animation: marquee 15s linear infinite; &:hover { animation-play-state: paused; } } /* Make it move! */ @keyframes marquee { 0% { top: 8em; } 100% { top: -11em; } } /* Make it look pretty */ .microsoft { .marquee { margin: 0; padding: 0 1em; line-height: 1.5em; font: 1em 'Segoe UI', Tahoma, Helvetica, Sans-Serif; } &:before, &::before, &:after, &::after { left: 0; z-index: 1; content: ''; position: absolute; pointer-events: none; width: 100%; height: 2em; background-image: linear-gradient(top, black, rgba(255, 255, 255, 0)); } &:after, &::after { bottom: 0; transform: rotate(180deg); } &:before, &::before { top: 0; } } /* Style the links */ .vanity { color: black; text-align: center; font: .75em 'Segoe UI', Tahoma, Helvetica, Sans-Serif; a { color: #1570A6; transition: color .5s; text-decoration: none; } } .microsoft a { color: #1570A6; transition: color .5s; text-decoration: none; } .vanity a:hover, .microsoft a:hover { color: #F65314; } /* Style toggle button */ .toggle { display: block; margin: 2em auto; } ================================================ FILE: app/assets/stylesheets/devices.scss ================================================ // Place all the styles related to the Devices controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/messages.scss ================================================ // Place all the styles related to the Messages controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/product_versions.scss ================================================ // Place all the styles related to the ProductVersions controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/products.scss ================================================ // Place all the styles related to the Products controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/profile.scss ================================================ // Place all the styles related to the profile controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/researcher.scss ================================================ // Place all the styles related to the researcher controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/scaffolds.scss ================================================ body { background-color: #fff; color: #333; font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18px; } button.plus { background-image: url(image_path('plus.png')); } p, ol, ul, td { font-family: verdana, arial, helvetica, sans-serif; font-size: 13px; line-height: 18px; } pre { background-color: #eee; padding: 10px; font-size: 11px; } a { color: #000; &:visited { color: #666; } &:hover { color: #fff; background-color: #000; } } div { &.field, &.actions { margin-bottom: 10px; } } #notice { color: green; } .field_with_errors { padding: 2px; background-color: red; display: table; } #error_explanation { width: 450px; border: 2px solid red; padding: 7px; padding-bottom: 0; margin-bottom: 20px; background-color: #f0f0f0; h2 { text-align: left; font-weight: bold; padding: 5px 5px 5px 15px; font-size: 12px; margin: -7px; margin-bottom: 0px; background-color: #c00; color: #fff; } ul li { font-size: 12px; list-style: square; } } ================================================ FILE: app/assets/stylesheets/sections.scss ================================================ // Place all the styles related to the Sections controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/submission.scss ================================================ // Place all the styles related to the submission controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/triage.scss ================================================ // Place all the styles related to the Triage controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/units.scss ================================================ // Place all the styles related to the Units controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/assets/stylesheets/vendors.scss ================================================ // Place all the styles related to the Vendors controller here. // They will automatically be included in application.css. // You can use Sass (SCSS) here: http://sass-lang.com/ ================================================ FILE: app/controllers/application_controller.rb ================================================ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception before_filter :authenticate_user! end ================================================ FILE: app/controllers/captures_controller.rb ================================================ class CapturesController < ApplicationController before_action :set_capture, only: [:show, :edit, :update, :destroy, :shift_left, :shift_right] require 'pty' # GET /captures # GET /captures.json def index @captures = Capture.all end # GET /captures/1 # GET /captures/1.json def show end def shift_right @capture.shift_right redirect_to :back end def shift_left @capture.shift_left redirect_to :back end # GET /captures/new def new @capture = Capture.new(unit_id:params[:unit_id],device_id:params[:device_id]) # dd # `inspectrum` cmd = 'inspectrum' begin PTY.spawn(cmd) do |r, stdin, pid| begin got_it = false loop do if !got_it line = r.gets raw = line.chomp.strip.split(',') puts "\n[*] Data as array: #{raw}" if raw.count > 1 demod = '' arr = raw threshold = arr.inject { |sum, el| sum + el }.to_f / arr.size raw.to_a.each do |r| r.to_f > threshold.to_f ? demod << '1' : demod << '0' end # threshold safety check start # threshold_safety_check raw, threshold # threshold safety check end # hex = print_results demod # compare demod @capture.original_binary = demod got_it = true unless demod == '' end else break end end Process.kill 'INT', pid rescue Errno::EIO puts '[!] Errno:EIO error, this may just mean the process has finished giving output'.colorize(:red) Process.kill 'INT', pid end end rescue PTY::ChildExited puts '[!] The child process exited!'.colorize(:red) end end # GET /captures/1/edit def edit end # POST /captures # POST /captures.json def create @capture = Capture.new(capture_params) respond_to do |format| if @capture.save @capture.binary = @capture.original_binary @capture.save puts "the above update occured on create..." format.html { redirect_to @capture.unit, notice: 'Capture was successfully created.' } format.json { render :show, status: :created, location: @capture } else format.html { render :new } format.json { render json: @capture.errors, status: :unprocessable_entity } end end end # PATCH/PUT /captures/1 # PATCH/PUT /captures/1.json def update respond_to do |format| if @capture.update(capture_params) format.html { redirect_to @capture, notice: 'Capture was successfully updated.' } format.json { render :show, status: :ok, location: @capture } else format.html { render :edit } format.json { render json: @capture.errors, status: :unprocessable_entity } end end end # DELETE /captures/1 # DELETE /captures/1.json def destroy @capture.destroy respond_to do |format| format.html { redirect_to captures_url, notice: 'Capture was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_capture begin @capture = Capture.find(params[:id]) rescue @capture = Capture.find(params[:capture_id]) end end # Never trust parameters from the scary internet, only allow the white list through. def capture_params params.require(:capture).permit(:unit_id, :device_id, :name, :notes, :binary, :original_binary) end end ================================================ FILE: app/controllers/concerns/.keep ================================================ ================================================ FILE: app/controllers/dashboard_controller.rb ================================================ class DashboardController < ApplicationController skip_before_filter :authenticate_user!, only: [:about] def about `git fetch` @tags = `git describe --tags` @version = `git log -n 1 --pretty=format:"%H"` @count_behind_origin = `git rev-list master..origin/master --count`.to_i end def temp end def contribute @cont = `cat #{Rails.root.join('mcs', 'contribution.md').to_s}` end end ================================================ FILE: app/controllers/devices_controller.rb ================================================ class DevicesController < ApplicationController require 'csv' before_action :set_device, only: [:show, :edit, :update, :destroy] # GET /devices # GET /devices.json def index @devices = Device.all end # GET /devices/1 # GET /devices/1.json def show @unit = Unit.new(device_id:params[:id]) @without_baseline = params[:without_baseline].present? ? true : false end # GET /devices/new def new @device = Device.new end # GET /devices/1/edit def edit end # POST /devices # POST /devices.json def create @device = Device.new(device_params) respond_to do |format| if @device.save format.html { redirect_to @device, notice: 'Device was successfully created.' } format.json { render :show, status: :created, location: @device } else format.html { render :new } format.json { render json: @device.errors, status: :unprocessable_entity } end end end # PATCH/PUT /devices/1 # PATCH/PUT /devices/1.json def update respond_to do |format| if @device.update(device_params) format.html { redirect_to @device, notice: 'Device was successfully updated.' } format.json { render :show, status: :ok, location: @device } else format.html { render :edit } format.json { render json: @device.errors, status: :unprocessable_entity } end end end # DELETE /devices/1 # DELETE /devices/1.json def destroy @device.destroy respond_to do |format| format.html { redirect_to :back, notice: 'Device was successfully destroyed.' } format.json { head :no_content } end end def apply_template @device = Device.find params[:device_id] @template = SectionTemplate.find params[:template][:template_id] the_csv = CSV.parse(@template.sections, :headers => true, :encoding => 'ISO-8859-1') the_csv.each do |row| s = Section.new s.device_id = @device.id s.start_pos = row['start_pos'] s.end_pos = row['end_pos'] s.name = row['name'] s.notes = row['notes'] s.colour = row['colour'] s.save end redirect_to :back, :notice => "Successfully imported sections" end private # Use callbacks to share common setup or constraints between actions. def set_device @device = Device.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def device_params params.require(:device).permit(:fcc_id, :baudrate, :frequency, :modulation, :encoding, :name, :notes, :flip_pwm) end end ================================================ FILE: app/controllers/registrations_controller.rb ================================================ class RegistrationsController < Devise::RegistrationsController skip_before_filter :authenticate_user! private def sign_up_params params.require(:user).permit(:full_name, :email, :password, :password_confirmation) end def account_update_params params.require(:user).permit(:full_name, :email, :password, :password_confirmation, :current_password) end end ================================================ FILE: app/controllers/section_templates_controller.rb ================================================ class SectionTemplatesController < ApplicationController before_action :set_section_template, only: [:show] # GET /section_templates # GET /section_templates.json def index @section_templates = SectionTemplate.all end # GET /section_templates/1 # GET /section_templates/1.json def show end def create @device = Device.find params[:section_template][:device_id] @device.sections_to_csv params[:section_template][:name], params[:section_template][:added_by] redirect_to controller: 'dashboard', action: 'contribute' end private # Use callbacks to share common setup or constraints between actions. def set_section_template @section_template = SectionTemplate.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def section_template_params params.require(:section_template).permit(:name, :sections, :added_by) end end ================================================ FILE: app/controllers/sections_controller.rb ================================================ class SectionsController < ApplicationController before_action :set_section, only: [:show, :edit, :update, :destroy] # GET /sections # GET /sections.json def index @device = Device.find params[:device_id] @sections = @device.sections.sort_by(&:start_pos) @section = Section.new(device_id: @device.id) end # GET /sections/1 # GET /sections/1.json def show end # GET /sections/new def new @section = Section.new end # GET /sections/1/edit def edit end # POST /sections # POST /sections.json def create @section = Section.new(section_params) respond_to do |format| if @section.save format.html { redirect_to device_sections_path(@section.device,@section), notice: 'Section was successfully created.' } format.json { render :show, status: :created, location: @section } else format.html { render :new } format.json { render json: @section.errors, status: :unprocessable_entity } end end end # PATCH/PUT /sections/1 # PATCH/PUT /sections/1.json def update respond_to do |format| if @section.update(section_params) format.html { redirect_to device_sections_path(@section.device,@section), notice: 'Section was successfully updated.' } format.json { render :show, status: :ok, location: @section } else format.html { render :edit } format.json { render json: @section.errors, status: :unprocessable_entity } end end end # DELETE /sections/1 # DELETE /sections/1.json def destroy @section.destroy respond_to do |format| format.html { redirect_to device_sections_path(@section.device,@section), notice: 'Section was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_section @section = Section.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def section_params params.require(:section).permit(:device_id, :name, :notes, :start_pos, :end_pos, :colour) end end ================================================ FILE: app/controllers/units_controller.rb ================================================ class UnitsController < ApplicationController before_action :set_unit, only: [:show, :edit, :update, :destroy] # GET /units # GET /units.json def index @units = Unit.all end # GET /units/1 # GET /units/1.json def show @manchester_format = params[:manchester_format] @pwm_format = params[:pwm_format] end # GET /units/new def new @unit = Unit.new(device_id:params[:device_id]) end # GET /units/1/edit def edit end # POST /units # POST /units.json def create @unit = Unit.new(unit_params) respond_to do |format| if @unit.save format.html { redirect_to @unit.device, notice: 'Unit was successfully created.' } format.json { render :show, status: :created, location: @unit } else format.html { render :new } format.json { render json: @unit.errors, status: :unprocessable_entity } end end end # PATCH/PUT /units/1 # PATCH/PUT /units/1.json def update respond_to do |format| if @unit.update(unit_params) format.html { redirect_to @unit, notice: 'Unit was successfully updated.' } format.json { render :show, status: :ok, location: @unit } else format.html { render :edit } format.json { render json: @unit.errors, status: :unprocessable_entity } end end end # DELETE /units/1 # DELETE /units/1.json def destroy @unit.destroy respond_to do |format| format.html { redirect_to :back, notice: 'Unit was successfully destroyed.' } format.json { head :no_content } end end private # Use callbacks to share common setup or constraints between actions. def set_unit @unit = Unit.find(params[:id]) end # Never trust parameters from the scary internet, only allow the white list through. def unit_params params.require(:unit).permit(:device_id, :name, :notes) end end ================================================ FILE: app/helpers/application_helper.rb ================================================ module ApplicationHelper end ================================================ FILE: app/helpers/captures_helper.rb ================================================ module CapturesHelper end ================================================ FILE: app/helpers/dashboard_helper.rb ================================================ module DashboardHelper end ================================================ FILE: app/helpers/devices_helper.rb ================================================ module DevicesHelper end ================================================ FILE: app/helpers/section_templates_helper.rb ================================================ module SectionTemplatesHelper end ================================================ FILE: app/helpers/sections_helper.rb ================================================ module SectionsHelper end ================================================ FILE: app/helpers/units_helper.rb ================================================ module UnitsHelper end ================================================ FILE: app/models/.keep ================================================ ================================================ FILE: app/models/capture.rb ================================================ class Capture < ActiveRecord::Base belongs_to :unit belongs_to :device def flip bin flipped = "" bin.scan(/./).each do |b| b == '1' ? flipped << '0' : flipped << '1' end flipped end def check_signals shift=false if shift manchester_failures = {} shifted_bin = '0' << original_binary shifted_bin.scan(/../).each do |pair| manchester_failures[pair]='invalid manchester' if (pair != "10") and (pair != "01") end else manchester_failures = {} original_binary.scan(/../).each do |pair| manchester_failures[pair]='invalid manchester' if (pair != "10") and (pair != "01") end end manchester_failures end def pwm_decode # 66/33 # 66/33 Format PWM symbols = "" the_bin = original_binary while ((the_bin.size % 3) != 0) the_bin+='0' end the_bin.scan(/.../).each do |s| # 100 == 0 # 110 == 1 symbols << "1" if s.to_i == 110 symbols << "0" if s.to_i == 100 end symbols = (device.flip_pwm ? (flip symbols) : symbols) end def pwm_decode_7525 # 66/33 Format PWM symbols = "" the_bin = original_binary while ((the_bin.size % 3) != 0) the_bin+='0' end the_bin.scan(/..../).each do |s| # 100 == 0 # 110 == 1 symbols << "1" if s.to_i == 1110 symbols << "0" if s.to_i == 1000 end symbols = (device.flip_pwm ? (flip symbols) : symbols) end def valid_pwm? human=false pwm_errors = {} the_bin = original_binary fixed_incomplete = false pre_padded_zero_alignment_error = false # The Dr Nick Edge Case if the_bin.scan(/./)[0] == '0' pre_padded_zero_alignment_error = true pwm_errors[the_bin.last]='shifted and possibly irrepairably incomplete pwm' the_bin = the_bin[1..-1] end if ((the_bin.size % 3) != 0) pwm_errors[the_bin.last]='incomplete pwm' while ((the_bin.size % 4) != 0) the_bin+='0' end end the_bin.scan(/.../).each do |set| pwm_errors[set]='invalid pwm' if (set != "110") and (set != "100") end shared_pwm_valid_response pwm_errors, the_bin, fixed_incomplete, pre_padded_zero_alignment_error, human end def valid_pwm_7525? human=false pwm_errors = {} the_bin = original_binary fixed_incomplete = false pre_padded_zero_alignment_error = false # The Dr Nick Edge Case if the_bin.scan(/./)[0] == '0' pre_padded_zero_alignment_error = true pwm_errors[the_bin.last]='shifted and possibly irrepairably incomplete pwm' the_bin = the_bin[1..-1] end if ((the_bin.size % 4) != 0) pwm_errors[the_bin.last]='incomplete pwm' while ((the_bin.size % 4) != 0) the_bin+='0' end end the_bin.scan(/..../).each do |set| pwm_errors[set]='invalid pwm' if (set != "1110") and (set != "1000") end shared_pwm_valid_response pwm_errors, the_bin, fixed_incomplete, pre_padded_zero_alignment_error, human end def shared_pwm_valid_response pwm_errors, the_bin, fixed_incomplete, pre_padded_zero_alignment_error, human message = nil if pwm_errors.present? if pwm_errors.count == 1 if pwm_errors.has_value? 'incomplete pwm' #message = "Valid PWM if padding at end was captured. Re-capture with padding and delete this item for best results." message = "This was valid PWM but significant whitespace at the end was missed by you. I have added 0s to the end and saved the change." fixed_incomplete = true end if (pwm_errors.has_value? "shifted and possibly irrepairably incomplete pwm") && (!pwm_errors.has_value? "invalid pwm") message = "This is likely to be a PWM capture but there was an unexpected '0' at the beginning which suggests the last cell was also chopped off. It is STRONGLY recommended that you re-create this capture but this time start one cell later, and add an extra cell at the end even if it is empty. This is an edge-case that seems to occur rarely with rtl-sdr captures. We don't know why exactly." end end end if human == false if fixed_incomplete && pwm_errors.size == 1 return true else return pwm_errors.blank? end else response = "" if pwm_errors.blank? response = "Yes" elsif pwm_errors.present? if message.blank? response << "No" else self.original_binary = self.binary = the_bin self.save unless pwm_errors.has_value? "shifted and possibly irrepairably incomplete pwm" response << message # message will only show first time. gone from subsequent attempts due to being corrected and saved end end response end end def manchester_decode symbols = "" original_binary.scan(/../).each do |s| symbols += '1' if s.to_i == 10 symbols += '0' if s.to_i == 01 end symbols end def valid_manchester? human=false if human == false check_signals.blank? else response = "" if check_signals.blank? then response = "Yes" else check_signals(shift=true).blank? ? response << "\n If you add a 0 at the start it is... re-capture the signal with an empty cell at the beginning" : response << "No" end response end end def to_hexcode bin=nil hex = '' f_hex = '\x' if bin hex << '%02x' % bin.to_i(2) f_hex << hex.scan(/.{2}|.+/).join('\x') else hex << '%02x' % original_binary.to_i(2) f_hex << hex.scan(/.{2}|.+/).join('\x') end f_hex end def to_ascii manchester=false, pwm=false if manchester f_hex = to_hexcode manchester_decode.gsub("\\x","") "#{f_hex.gsub(/../) { |pair| pair.hex.chr }}".force_encoding(Encoding::UTF_8).encode('utf-8', :invalid=>:replace, :replace=>"?") elsif pwm f_hex = to_hexcode pwm_decode.gsub("\\x","") "#{f_hex.gsub(/../) { |pair| pair.hex.chr }}".force_encoding(Encoding::UTF_8).encode('utf-8', :invalid=>:replace, :replace=>"?") else f_hex = to_hexcode "#{f_hex.gsub(/../) { |pair| pair.hex.chr }}".force_encoding(Encoding::UTF_8).encode('utf-8', :invalid=>:replace, :replace=>"?") end end def bin_to_ascii bin f_hex = to_hexcode bin "#{f_hex.gsub(/../) { |pair| pair.hex.chr }}".force_encoding(Encoding::UTF_8).encode('utf-8', :invalid=>:replace, :replace=>"?") end def shift_right update_attribute(:binary, binary.scan(/\w/).unshift('p')) save end def shift_left if binary.scan(/\w/).first == 'p' update_attribute(:binary, binary.scan(/\w/).drop(1)) save end end def self.to_hexcode bin hex = '' f_hex = '\x' hex << '%02x' % bin.to_i(2) f_hex << hex.scan(/.{2}|.+/).join('\x') if f_hex.split("\\x").last.size == 1 f_hex << "0" end f_hex end end ================================================ FILE: app/models/concerns/.keep ================================================ ================================================ FILE: app/models/cons.rb ================================================ class Cons # this isn't an active record model. it's soley here to help with console commands for usability def self.live_capture_seed_file device_id, unit_id, capture_name, stop_at_first=false first_bin = "" last_bin = "" d = Device.find device_id u = Unit.find unit_id loop.with_index do |_, i| c = Capture.new c.unit_id = u.id c.device_id = d.id c.name = "#{capture_name}_#{i+1}" until !c.new_record? bin = `cat "#{Rails.root}/tmp/test_change.tmp"`.gsub("\\n","") if (bin.to_s != last_bin) && (bin.to_s.present?) break if (bin.to_s == first_bin) && (stop_at_first == true) c.original_binary = bin.to_s c.binary = c.original_binary c.save last_bin = c.original_binary end end end end end ================================================ FILE: app/models/device.rb ================================================ class Device < ActiveRecord::Base require 'csv' has_many :units, dependent: :destroy has_many :captures has_many :sections def could_be_manchester? captures.map(&:valid_manchester?).any? end def could_be_pwm? captures.map(&:valid_pwm?).any? end def could_be_pwm_7525? captures.map(&:valid_pwm_7525?).any? end def update_modulation if (modulation == "OOK" && encoding == "n/a") || (modulation.blank? && encoding.blank?) if could_be_pwm? update_attribute(:modulation,"PWM") update_attribute(:encoding,"66/33") elsif could_be_pwm_7525? update_attribute(:modulation,"PWM") update_attribute(:encoding,"75/25") elsif could_be_manchester? update_attribute(:modulation,"OOK") update_attribute(:encoding,"Manchester") else update_attribute(:modulation,"OOK") update_attribute(:encoding,"n/a") end end end def format_frequency number_of_decimals = decimals(frequency) pad = 5 - number_of_decimals frequency.to_s.gsub(".","") + ("0"*pad) end def decimals(a) num = 0 while(a != a.to_i) num += 1 a *= 10 end num end # export a section template def sections_to_csv template_name, added_by column_names = "name", "start_pos", "end_pos", "colour", "notes" the_csv = CSV.generate(headers: true) do |csv_text| csv_text << column_names sections.each do |section| csv_text << section.attributes.values_at(*column_names) end end the_csv.gsub('"',"'") open(Rails.root.join('mcs', 'contribution.md').to_s, 'w') {|f| f.puts "```ruby" f.puts "SectionTemplate.find_or_create_by(:name => \"#{template_name}\") do |st|" f.puts " st.sections = \"#{the_csv}\" " f.puts " st.added_by = '#{added_by}' " f.puts "end" f.puts "```" } end end ================================================ FILE: app/models/section.rb ================================================ class Section < ActiveRecord::Base belongs_to :device def section_range start_pos..end_pos end end ================================================ FILE: app/models/section_template.rb ================================================ class SectionTemplate < ActiveRecord::Base end ================================================ FILE: app/models/unit.rb ================================================ class Unit < ActiveRecord::Base belongs_to :device has_many :captures, dependent: :destroy end ================================================ FILE: app/models/user.rb ================================================ class User < ActiveRecord::Base # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :rememberable, :trackable end ================================================ FILE: app/views/application/_favicon.html.erb ================================================ ================================================ FILE: app/views/captures/_form.html.haml ================================================ = simple_form_for(@capture) do |f| = f.error_notification = f.hidden_field :device_id = f.hidden_field :unit_id = f.hidden_field :original_binary .form-group %label.col-lg-2.control-label{:for => "inputEmail"} Name .col-lg-10 = f.input :name, label: false, input_html: { class: 'form-control' } %br .form-group .col-lg-10.col-lg-offset-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit"} Submit ================================================ FILE: app/views/captures/edit.html.haml ================================================ %h1 Editing capture = render 'form' = link_to 'Show', @capture \| = link_to 'Back', captures_path ================================================ FILE: app/views/captures/index.html.haml ================================================ %h1 Listing captures %table %thead %tr %th Unit %th Device %th Name %th Notes %th Binary %th Original binary %th %th %th %tbody - @captures.each do |capture| %tr %td= capture.unit_id %td= capture.device_id %td= capture.name %td= capture.notes %td= capture.binary %td= capture.original_binary %td= link_to 'Show', capture %td= link_to 'Edit', edit_capture_path(capture) %td= link_to 'Destroy', capture, :method => :delete, :data => { :confirm => 'Are you sure?' } %br = link_to 'New Capture', new_capture_path ================================================ FILE: app/views/captures/index.json.jbuilder ================================================ json.array!(@captures) do |capture| json.extract! capture, :id, :unit_id, :device_id, :name, :notes, :binary, :original_binary json.url capture_url(capture, format: :json) end ================================================ FILE: app/views/captures/new.html.haml ================================================ %fieldset %legend Add Capture From Inspectrum = render 'form' = link_to 'Back', @capture.unit ================================================ FILE: app/views/captures/show.html.haml ================================================ %p#notice= notice %p %b Unit: = @capture.unit_id %p %b Device: = @capture.device_id %p %b Name: = @capture.name %p %b Notes: = @capture.notes %p %b Binary: = @capture.binary %p %b Original binary: = @capture.original_binary = link_to 'Edit', edit_capture_path(@capture) \| = link_to 'Back', captures_path ================================================ FILE: app/views/captures/show.json.jbuilder ================================================ json.extract! @capture, :id, :unit_id, :device_id, :name, :notes, :binary, :original_binary, :created_at, :updated_at ================================================ FILE: app/views/dashboard/about.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h4 DSpectrumGUI %br %p DSpectrumGUI is a locally hosted web application designed to facilitate the rapid reverse engineering of SDR/RF signals. %hr %h5 Application Status %p= "You are currently running: #{@tags} || #{@version}" - if @count_behind_origin == 0 %p{:style => "color:darkgreen;"}= "This app is up-to-date with master" - else - message = "This app is #{@count_behind_origin} " + "commit".pluralize(@count_behind_origin) + " behind origin/master. If you'd like to update it, shutdown this server (ctrl-c in the terminal window you launched it from), and type the following commands in your terminal" %p{:style => "color:darkred;"}= message %pre{:style => "white-space: pre-line;background-color:grey;"} cd ~/dspectrum_gui # update this if you've clone DSpectrumGUI somewhere else git fetch git checkout master git pull origin master rake db:migrate # just incase a change to the database was made %br \# launch the app again rails s -p 3001 %br %br %p.vanity %a="Want to stay in touch?     ".html_safe %a= "-    ".html_safe %a{:href => "https://twitter.com/tresacton"}=" @tresacton (on twitter)     ".html_safe %a= "-     ".html_safe %a="@nullwolf (on slack)    ".html_safe / %a / © AdvisoryDB / =Time.now.year ================================================ FILE: app/views/dashboard/contribute.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h4 DSpectrumGUI %br %p Please follow the instructions below to contribute %hr %p ="Navigate to " =link_to('https://github.com/tresacton/dspectrumgui','https://github.com/tresacton/dspectrumgui').html_safe %p= "Create a new issue with the title: [SectionTemplate] " %p= "Copy and paste the below text into the Issue description field, and hit submit" %pre{:style => "white-space: pre-line;background-color:grey;"} =@cont %br %p Thank you for donating this to our template library. %br %p.vanity %a="Want to stay in touch?     ".html_safe %a= "-    ".html_safe %a{:href => "https://twitter.com/tresacton"}=" @tresacton (on twitter)     ".html_safe %a= "-     ".html_safe %a="@nullwolf (on slack)    ".html_safe / %a / © AdvisoryDB / =Time.now.year ================================================ FILE: app/views/dashboard/temp.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h3 Analysis Helper %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - zero = [1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,1,1,1,1,1,1] - one = [nil,1,0,1,0,1,0,1,0,1,0,1,0,1,0] - two = [nil,1,0,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0] - x1 = [zero,one,two] - x = x1.sort_by {|y|y.size} - baseline = x.last %thead %tr %th -x.last.each_with_index do |it,index| %th{:style => "color:grey;"}= index %th %tbody - x.each do |barray| %tr %td < - barray.each_with_index do |b, index| - if b == baseline[index] %td{:style => "color:green"}= b -else %td{:style => "color:red"}= b %td > %td b -baseline.each do |b| %td{:style => "color:blue"}= b %td = form_for '' do | f | =f.label 'notes' %br =f.text_area 'd', :cols => 140 %br ================================================ FILE: app/views/devices/_add_unit.html.haml ================================================ %div.col-lg-12 %hr %h4 Units = simple_form_for(unit) do |f| = f.error_notification = f.hidden_field :device_id .form-group .col-lg-2 %h5 Add new .col-lg-8 = f.input :name, placeholder: 'name', label: false, input_html: { class: 'form-control' } .col-lg-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit", :style => "float:right;"} Create ================================================ FILE: app/views/devices/_form.html.haml ================================================ = simple_form_for(@device) do |f| = f.error_notification .form-group %label.col-lg-2.control-label{:for => "inputEmail"} Name .col-lg-10 = f.input :name, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} FCC ID .col-lg-10 = f.input :fcc_id, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} Modulation .col-lg-10 = f.input :modulation, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} Encoding .col-lg-10 = f.input :encoding, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} Frequency .col-lg-10 = f.input :frequency, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} Baudrate .col-lg-10 = f.input :baudrate, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "inputPassword"} Flip Decoding Assumption .col-lg-10 %span{:style => "float:right;"} = f.input :flip_pwm, label: false, as: :boolean, checked_value: true, unchecked_value: false %br %br %br .form-group %label.col-lg-2.control-label{:for => "notes"} Notes .col-lg-10 = f.input :notes, label: false, type: 'text-area', input_html: { class: 'form-control textArea', rows: 10 } %br .form-group .col-lg-10.col-lg-offset-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit"} Submit ================================================ FILE: app/views/devices/_manchester_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.present? - if device.could_be_manchester? %div.col-lg-12 %hr %h4 Manchester Bit Position Analysis Tool %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.manchester_decode.scan(/\w/).count} - baseline = x.last.manchester_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.manchester_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.manchester_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" %br = barray.name - barray.manchester_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br / Taken from line 13 under flatten / - device.units.map(&:captures).flatten.each do |c| / - c.update_attribute(:binary, c.manchester_decode) if c.binary.blank? ================================================ FILE: app/views/devices/_pwm_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.present? - if device.could_be_pwm? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (66/33) %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.pwm_decode.scan(/\w/).count} - baseline = x.last.pwm_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" %br = barray.name - barray.pwm_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br - if device.could_be_pwm_7525? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (75/25) %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.pwm_decode_7525.scan(/\w/).count} - baseline = x.last.pwm_decode_7525.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode_7525.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode_7525 << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" %br = barray.name - barray.pwm_decode_7525.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/devices/_raw_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.any? %div.col-lg-12 %hr %h4 Analysis Helper %p The longest binary string is used as the comparison baseline (B) %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - device.units.map(&:captures).flatten.each do |c| - c.update_attribute(:binary, c.original_binary) if c.binary.blank? - x = x1.sort_by {|y|y.original_binary.scan(/\w/).count} - baseline = x.last.original_binary.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.original_binary.scan(/\w/).count - xx.binary = xx.original_binary - if diff > 0 - diff.times do |i| - xx.binary = xx.binary << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" %br = barray.name - barray.binary.scan(/\w/).each_with_index do |b, index| - if without_baseline == false - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td - elsif without_baseline == true - if b.to_s == '1' %td.text-success= b - else %td.text-danger= b - if without_baseline == false %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/devices/_show_units.html.haml ================================================ %div.col-lg-12 %br %table.table.table-bordered.table.hover %thead %tr.bg-primary %th Name %th Notes %th Captures %th Actions %tbody - device.units.each do |u| %tr %td= link_to u.name, u, :style => "color:#2a9fd6;" %td= u.notes %td= u.captures.count -#- u.captures.each do |c| -# = "#{c.name} " -# %br -# =" #{c.original_binary}\n" -# %hr %td{:style => "width:15%;"} = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' }, :style => "color:red;" ================================================ FILE: app/views/devices/edit.html.haml ================================================ %h1 Editing device = render 'form' = link_to 'Show', @device \| = link_to 'Back', devices_path ================================================ FILE: app/views/devices/index.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h3 Devices %p A device is effectively a category. It should have at least one unit. If you have multiple units of the same type (e.g. 3 identical garage door remotes), they are best represented as multiple units of the same device. %br %table.table.table-bordered.table-hover %thead %tr.bg-primary %th Name %th FCC ID %th Modulation %th Encoding %th Baudrate %th Frequency %th Notes %th %tbody - @devices.each do |device| %tr %td= link_to device.name, device %td= device.fcc_id %td= device.modulation %td= device.encoding %td= device.baudrate %td= device.frequency %td= device.notes.truncate(100) %td = link_to 'Edit', edit_device_path(device) = link_to 'Destroy', device, :method => :delete, :data => { :confirm => 'Are you sure?' } %br = link_to 'New Device', new_device_path ================================================ FILE: app/views/devices/index.json.jbuilder ================================================ json.array!(@devices) do |device| json.extract! device, :id, :fcc_id, :baudrate, :frequency, :modulation, :encoding, :name, :notes json.url device_url(device, format: :json) end ================================================ FILE: app/views/devices/new.html.haml ================================================ %fieldset %legend New Device = render 'form' = link_to 'Back', devices_path ================================================ FILE: app/views/devices/show.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h3 Device: = @device.name - @device.update_modulation %p A device is effectively a category. It should have at least one unit. If you have multiple units of the same type (e.g. 3 identical garage door remotes), they are best represented as multiple units of the same device. %br %div.col-lg-8 %table.table.table-bordered %tr %th.bg-primary{style:"width:15%;"} Name %td= @device.name %tr %th.bg-primary FCC ID %td= @device.fcc_id %tr %th.bg-primary Modulation %td = @device.modulation %tr %th.bg-primary Encoding %td= @device.encoding %tr %th.bg-primary Frequency %td = @device.frequency = ' Mhz' %tr %th.bg-primary Baudrate %td= @device.baudrate %tr %th.bg-primary Decoding Rules %td= @device.flip_pwm == true ? "Bits flipped after demodulation" : "Bits not flipped (Default State)" %tr %th.bg-primary Notes %td= @device.notes %div.col-lg-3 .well.well-lg %h5 Actions = link_to 'View Reversing Worksheet', device_sections_path(@device), :style => "color:#2a9fd6;" %br =link_to 'Edit Device', edit_device_path(@device), :style => "color:#2a9fd6;" %br = link_to 'Go Back to Devices', devices_path, :style => "color:#2a9fd6;" =render "manchester_analysis", device: @device, without_baseline: @without_baseline / =render "manchester_analysis", unit: @unit =render "pwm_analysis", device: @device, without_baseline: @without_baseline / =render "raw_analysis", unit: @unit =render "raw_analysis", device: @device, without_baseline: @without_baseline =render "add_unit", unit: @unit =render "show_units", device: @device %br -#Vertical text style for TH -#%th{:style => "color:grey;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg);-ms-transform: rotate(-90deg);-o-transform: rotate(-90deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);color: #FFF;text-transform: uppercase;"} 0 ================================================ FILE: app/views/devices/show.json.jbuilder ================================================ json.extract! @device, :id, :fcc_id, :baudrate, :frequency, :modulation, :encoding, :name, :notes, :created_at, :updated_at ================================================ FILE: app/views/devise/confirmations/new.html.erb ================================================

Resend confirmation instructions

<%= simple_form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %> <%= f.error_notification %> <%= f.full_error :confirmation_token %>
<%= f.input :email, required: true, autofocus: true %>
<%= f.button :submit, "Resend confirmation instructions" %>
<% end %> <%= render "devise/shared/links" %> ================================================ FILE: app/views/devise/mailer/confirmation_instructions.html.erb ================================================

Welcome <%= @email %>!

You can confirm your account email through the link below:

<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>

================================================ FILE: app/views/devise/mailer/password_change.html.erb ================================================

Hello <%= @resource.full_name %>!

We're contacting you to notify you that your password has been changed.

================================================ FILE: app/views/devise/mailer/reset_password_instructions.html.erb ================================================

Hello <%= @resource.full_name %>!

Someone has requested a link to change your password. You can do this through the link below.

<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token, :host => (Rails.env == 'production' ? "advisorydb.com" : "localhost")) %>

If you didn't request this, please ignore this email.

Your password won't change until you access the link above and create a new one.

================================================ FILE: app/views/devise/mailer/unlock_instructions.html.erb ================================================

Hello <%= @resource.full_name %>!

Your account has been locked due to an excessive number of unsuccessful sign in attempts.

Click the link below to unlock your account:

<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>

================================================ FILE: app/views/devise/passwords/edit.html.haml ================================================ %h3 Change your password? = simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| = f.error_notification = f.full_error :reset_password_token %table.table.table-bordered{style:'width:57%;'} %tr %th{style:"width:30%;padding:10px;"} Password %td{style:"color:grey;width:60px;padding:10px;"}= f.input :password, label: false, required: true, autofocus: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %tr %th{style:"width:30%;padding:10px;"} Password Confirmation %td{style:"color:grey;width:60px;padding:10px;"}=f.input :password_confirmation, label: false, required: true, maxlength:72, size:72 %div.row{style:'padding-top:20px;'} = f.input :reset_password_token, as: :hidden %div.col-lg-4 = f.button :submit, "Submit", :class => "btn btn-primary" %div.col-lg-3.form-action{style:'padding-top:5px;'} = render "devise/shared/links" %div.col-lg-5{style:'padding-top:5px;'} ================================================ FILE: app/views/devise/passwords/new.html.haml ================================================ %h3 Forgot your password? = simple_form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %table.table.table-bordered{style:'width:57%;'} %tr %th{style:"width:30%;padding:10px;"} Email %td{style:"color:black;;width:60px;padding:10px;"}= f.text_field :email, required: true, autofocus: true, label: false, size: 40 %div.row{style:'padding-top:20px;'} %div.col-lg-4 = f.button :submit, "Submit", :class => "btn btn-primary" %div.col-lg-3.form-action{style:'padding-top:5px;'} = render "devise/shared/links" %div.col-lg-5{style:'padding-top:5px;'} ================================================ FILE: app/views/devise/registrations/edit.html.erb ================================================

Edit <%= resource_name.to_s.humanize %>

<%= simple_form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> <%= f.error_notification %>
<%= f.input :email, required: true, autofocus: true %> <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>

Currently waiting confirmation for: <%= resource.unconfirmed_email %>

<% end %> <%= f.input :password, autocomplete: "off", hint: "leave it blank if you don't want to change it", required: false %> <%= f.input :password_confirmation, required: false %> <%= f.input :current_password, hint: "we need your current password to confirm your changes", required: true %>
<%= f.button :submit, "Update" %>
<% end %>

Cancel my account

Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>

<%= link_to "Back", :back %> ================================================ FILE: app/views/devise/registrations/new.html.haml ================================================ %h3 Sign Up %div.row %div.col-lg-8 = simple_form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| = f.error_notification = devise_error_messages! %table.table.table-bordered{style:'width:57%;'} %tbody %tr{style:''} %th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Name %td{style:"color:black;width:20%;padding:10px;"} = f.text_field :full_name, required: true, autofocus: true, label: false, size: 40 %tr %th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Email %td{style:"color:black;padding:10px;"}= f.text_field :email, required: true, label: false, size: 40 %tr %th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password %td{style:"color:black;padding:10px;"}= f.password_field :password, required: true, label: false, autocomplete: false, size: 40 %tr %th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password Confirmation %td{style:"color:black;padding:10px;"}= f.password_field :password_confirmation, label: false, required: true, size: 40 %div.row{style:'padding-top:20px;'} %div.col-lg-6 = f.button :submit, "Submit", :class => "btn btn-primary" %div.col-lg-3.form-action{style:'padding-top:5px;'} = render "devise/shared/links" %div.col-lg-4{style:'padding-top:5px;'} %div.col-lg-4 %strong Things you need to know: %ul %li Registration is required to access challenge information and to allow you to check your challenge solutions. %li We won't email you or give your email address to others. Other participants will not see your email address in the application interface. If you're super concerned, use a fake email address (just make sure you remember it for today). %li This app is hosted in a VM, which will be reset at the end of today. So the data within will be destroyed or de-anonymised. %li{:style => "color:red;"} OBLIGATORY DISCLAIMER: Neither myself (Très Acton), or the Platypus hosts, condone criminal activity. By registering, you agree that you will not interpret the simulation challenges as instructions or suggestions to break any state or federal laws. I'm no legal expert, but "I learned it at a hacker con" is probably not going to be a suitable defence if you break into someone's garage without the proper owner's consent... ================================================ FILE: app/views/devise/sessions/new.html.haml ================================================ %h3 Authenticate = simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %table.table.table-bordered{style:'width:57%;'} %tr %th{style:"width:30%;padding:10px;"} Email %td{style:"color:black;width:60px;padding:10px;"}= f.text_field :email, required: true, autofocus: true, label: false, size: 40 %tr %th{style:"width:30%;padding-top:10px;padding-left:10px;padding-bottom:10px;"} Password %td{style:"color:black;padding:10px;"}=f.password_field :password, required: true, label: false, autocomplete: false, size: 40 %div.row{style:'padding-top:20px;'} %div.col-lg-4 = f.button :submit, "Submit", :class => "btn btn-primary" %div.col-lg-3.form-action{style:'padding-top:5px;'} = render "devise/shared/links" %div.col-lg-5{style:'padding-top:5px;'} ================================================ FILE: app/views/devise/shared/_links.html.erb ================================================
<%- if controller_name != 'sessions' %> <%= link_to "Log in", new_session_path(resource_name) %>
<% end -%> <%- if devise_mapping.registerable? && controller_name != 'registrations' %> <%= link_to "Sign up", new_registration_path(resource_name) %>
<% end -%> <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> <%= link_to "Forgot your password?", new_password_path(resource_name) %>
<% end -%> <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %> <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %>
<% end -%> <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %> <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %>
<% end -%> <%- if devise_mapping.omniauthable? %> <%- resource_class.omniauth_providers.each do |provider| %> <%= link_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider) %>
<% end -%> <% end -%>
================================================ FILE: app/views/devise/unlocks/new.html.haml ================================================

Resend unlock instructions

= simple_form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %table.table.table-bordered{style:'width:57%;'} %tr %th{style:"width:30%;padding:10px;"} Email %td{style:"color:black;width:60px;padding:10px;"}= f.text_field :email, required: true, autofocus: true, label: false, size: 40 %div.row{style:'padding-top:20px;'} %div.col-lg-6 = f.button :submit, "Resend unlock instructions", :class => "btn btn-primary" %div.col-lg-3.form-action{style:'padding-top:5px;'} = render "devise/shared/links" %div.col-lg-5{style:'padding-top:5px;'} ================================================ FILE: app/views/layouts/_footer.html.erb ================================================

Copyright © nullwolf 2016

================================================ FILE: app/views/layouts/_messages.html.haml ================================================ -# Rails flash messages styled for Bootstrap 3.0 - flash.each do |name, msg| - if msg.is_a?(String) %div{:class => "alert alert-#{name.to_s == 'notice' ? 'success' : 'danger'}"} %button.close{"aria-hidden" => "true", "data-dismiss" => "alert", :type => "button"} × = content_tag :div, msg, :id => "flash_#{name}" ================================================ FILE: app/views/layouts/_navigation.html.haml ================================================ -# navigation styled for Bootstrap 3.0 %nav.navbar.navbar-default.navbar-fixed-top %a.nounderline{:href => "/",style:'float:left;padding-right:20px;padding-left:15px;'} %div{style:'float:left;padding-right:20px;padding-left:15px;'} %h3.neuro /dspectrum/ %span.right by nullwolf %button.navbar-toggle{"data-target" => ".navbar-collapse", "data-toggle" => "collapse", :type => "button"} %span.sr-only Toggle navigation %span.icon-bar %span.icon-bar %span.icon-bar / %a.navbar-brand{:href => "/", :rel => "/", :title => ""} %div{style:'float:right;'} ================================================ FILE: app/views/layouts/_navigation_links.html.erb ================================================ <%# add navigation links to this file %> ================================================ FILE: app/views/layouts/application.html.haml ================================================ !!! %html %head = render 'favicon' %meta{:name => "viewport", :content => "width=device-width, initial-scale=1.0"} %title= content_for?(:title) ? yield(:title) : '/dspectrum/' = stylesheet_link_tag 'application', media: 'all' = javascript_include_tag 'bootstrap.min' = javascript_include_tag 'application' = csrf_meta_tags %body %header = render 'layouts/navigation' %main{:role => "main",style:"padding-top:35px;"} #banner.page-header .row .col-lg-4 %br %br %br .col-sm-2 .list-group.table-of-contents.navbar-collapse -if current_user.present? %a.list-group-item{:style => "background-color:black;color:white;"}= "Welcome, #{current_user.full_name}" =link_to("Devices", devices_path, :class => "a list-group-item", :style => "background-color:black;") =link_to("About", '/about', :class => "a list-group-item", :style => "background-color:black;") -else %a.list-group-item{:style => "background-color:black;",:href => new_user_registration_path, :style => "background-color:black;"} Create an account %a.list-group-item{:style => "background-color:black;",:href => new_session_path('user'), :style => "background-color:black;"} Log in - if @current_user.present? || current_user.present? =link_to("Logout", destroy_user_session_path, :method => :delete, :class => "a list-group-item", :style => "background-color:black;") .col-lg-8.col-md-7.col-sm-6 = render 'layouts/messages' = yield ================================================ FILE: app/views/layouts/mailer.html.haml ================================================ %hmtl %body = yield ================================================ FILE: app/views/layouts/mailer.text.haml ================================================ = yield ================================================ FILE: app/views/profile/edit.html.haml ================================================ %h1 Profile#edit %p Find me in app/views/profile/edit.html.haml ================================================ FILE: app/views/profile/index.html.haml ================================================ %h1 Profile#index %p Find me in app/views/profile/index.html.haml ================================================ FILE: app/views/profile/show.html.haml ================================================ - if @myprofile %table.table.table-bordered.table-hover %tr %th{style:'width:20%;'} Name %td= @profile.full_name %tr %th Email Address %td= "#{@profile.email} - (this is not visible to other users)" %tr %th Became a Member %td= "#{time_ago_in_words(@profile.created_at)} ago" %tr %th Sharing your Profile - my_url = root_url + 'profile/' + @profile.id.to_s - link = link_to my_url, my_url %td= "Your profile can be accessed by others at: #{link}".html_safe %br %hr %h4 Submissions - (this is not visible to other users) - if @submissions.any? %table.table.table-bordered.table-hover %tr %th{style:'width:20%;'} ADB ID %th.visible-lg.visible-md Title %th.visible-lg.visible-md Description %th Status %th Submitted %th Interactions %tr -@submissions.each do |s| %tr %td= s.adb_id %td.visible-lg.visible-md= s.title %td.visible-lg.visible-md= s.description %td= s.status.titleize %td= "#{time_ago_in_words(s.created_at)} ago" -if s.advisory_comments.count > 0 %td = "#{s.advisory_comments.count} - " = link_to 'View', "/submission/#{s.adb_id}/interactions" -else %td= "#{s.advisory_comments.count}" -else None %hr %h4 Published Advisories %span.badge{style:"float:right;font-size:16px;"}= @advisories.count - if @advisories.any? %table.table.table-striped.table-bordered %thead %tr %th ADB ID %th Submitted %th.visible-lg.visible-md Category %th Title %th{style:'text-align:center;'} ADBS %tbody - @advisories.each do |advisory| %tr %td{style:'width:170px;'}= link_to advisory.adb_id,advisory %td= "#{time_ago_in_words(advisory.created_at)} ago" %td.visible-lg.visible-md= advisory.category.try(:name) %td= advisory.title %td{style:'text-align:center;'} %p - if advisory.score - if advisory.score < 5 %span.label.label-success{style:'font-size:100%;'}= "ADBS: #{advisory.score}" - if advisory.score >= 5 && advisory.score < 7 %span.label.label-warning{style:'font-size:100%;'}= "ADBS: #{advisory.score}" - if advisory.score >= 7 %span.label.label-danger{style:'font-size:100%;'}= "ADBS: #{advisory.score}" / ADD CVE to model also add notion of production category - else None - else %h3= @profile.full_name %table.table.table-bordered.table-hover %tr %th{style:'width:20%;'} Name %td= @profile.full_name %tr %th Became a Member %td= "#{time_ago_in_words(@profile.created_at)} ago" %hr %h4 Published Advisories %span.badge{style:"float:right;font-size:16px;"}= @advisories.count - if @advisories.any? %table.table.table-striped.table-bordered %thead %tr %th ADB ID %th Submitted %th.visible-lg.visible-md Category %th Title %th{style:'text-align:center;'} ADBS %tbody - @advisories.each do |advisory| %tr %td{style:'width:170px;'}= link_to advisory.adb_id,advisory %td= "#{time_ago_in_words(advisory.created_at)} ago" %td.visible-lg.visible-md= advisory.category.try(:name) %td= advisory.title %td{style:'text-align:center;'} %p - if advisory.score - if advisory.score < 5 %span.label.label-success{style:'font-size:100%;'}= "ADBS: #{advisory.score}" - if advisory.score >= 5 && advisory.score < 7 %span.label.label-warning{style:'font-size:100%;'}= "ADBS: #{advisory.score}" - if advisory.score >= 7 %span.label.label-danger{style:'font-size:100%;'}= "ADBS: #{advisory.score}" / ADD CVE to model also add notion of production category - else None ================================================ FILE: app/views/section_templates/index.html.haml ================================================ %h1 Listing section_templates %table %thead %tr %th Name %th Sections %th Added by %th %th %th %tbody - @section_templates.each do |section_template| %tr %td= section_template.name %td= section_template.sections %td= section_template.added_by %td= link_to 'Show', section_template %td= link_to 'Edit', edit_section_template_path(section_template) %td= link_to 'Destroy', section_template, :method => :delete, :data => { :confirm => 'Are you sure?' } %br = link_to 'New Section template', new_section_template_path ================================================ FILE: app/views/section_templates/show.html.haml ================================================ %p#notice= notice %p %b Name: = @section_template.name %p %b Sections: = @section_template.sections %p %b Added by: = @section_template.added_by = link_to 'Edit', edit_section_template_path(@section_template) \| = link_to 'Back', section_templates_path ================================================ FILE: app/views/sections/_form.html.haml ================================================ = simple_form_for(@section) do |f| = f.error_notification / .form-inputs / = f.input :device_id / = f.input :name / = f.input :notes / = f.input :start_pos / = f.input :end_pos / = f.input :colour / .form-actions / = f.button :submit = f.hidden_field :device_id .form-group %label.col-lg-2.control-label{:for => "name"} Name .col-lg-10 = f.input :name, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "start_pos"} Start Position (bit) .col-lg-10 = f.input :start_pos, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "end_pos"} End Position (bit) .col-lg-10 = f.input :end_pos, label: false, input_html: { class: 'form-control' } %br .form-group %label.col-lg-2.control-label{:for => "notes"} Notes .col-lg-10 = f.input :notes, label: false, type: 'text-area', input_html: { class: 'form-control textArea', rows: 10 } %br .form-group %label.col-lg-2.control-label{:for => "colour"} Colour .col-lg-10 - the_options = options_for_select([['gray', 'gray'], ['blue', 'blue'], ['aqua', 'aqua'], ['cadetblue', 'cadetblue'], ['darkblue', 'darkblue'], ['green', 'green'], ['darkgreen', 'darkgreen'], ['red', 'red'], ['darkred', 'darkred'], ['deeppink', 'deeppink'], ['fuchsia', 'fuchsia'], ['indigo', 'indigo'], ['goldenrod', 'goldenrod']],@section.colour) = f.select :colour, the_options, label: false, input_html: { class: 'form-control' } %br %br .form-group .col-lg-10.col-lg-offset-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit"} Submit Definition %br %br ================================================ FILE: app/views/sections/_manchester_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.present? - if device.could_be_manchester? %div.col-lg-12 %hr %h4 Manchester Bit Position Analysis Tool %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.manchester_decode.scan(/\w/).count} - baseline = x.last.manchester_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.manchester_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.manchester_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| - section_bits = [] - device.sections.each do |section| -if section.section_range.member? index - section_bits << index %th{:style => "color:white;background:#{section.colour}"}= index -if section_bits.exclude? index %th{:style => "color:white;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" %br = barray.name - barray.manchester_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br / Taken from line 13 under flatten / - device.units.map(&:captures).flatten.each do |c| / - c.update_attribute(:binary, c.manchester_decode) if c.binary.blank? ================================================ FILE: app/views/sections/_no_sections.html.haml ================================================ - unless @sections.present? %div.col-lg-12 %hr %h4 Sections Defined /# %p The longest binary string is used as the comparison baseline (B) below %p No sections have been defined. You can either define your own in the "Define New Section" form (scroll down), or import a section template from the library. = simple_form_for(:template, url: device_apply_template_path(:deivce_id => @device_id)) do |f| /-#%button.btn.btn-default{:type => "reset"} Cancel .col-lg-10 = f.input :template_id, collection: SectionTemplate.all, label: false, input_html: { class: 'form-control' } %br .form-group .col-lg-10.col-lg-offset-0 %button.btn.btn-primary{:type => "submit"} Add sections from template %br ================================================ FILE: app/views/sections/_pwm_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.present? - if device.could_be_pwm? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (66/33) - with Sections %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.pwm_decode.scan(/\w/).count} - baseline = x.last.pwm_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| - section_bits = [] - device.sections.each do |section| -if section.section_range.member? index - section_bits << index %th{:style => "color:white;background:#{section.colour}"}= index -if section_bits.exclude? index %th{:style => "color:white;"}= index %tbody - x.each do |barray| %tr %td = barray.class %br = barray.name - barray.pwm_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br - if device.could_be_pwm_7525? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (75/25) - with Sections %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - x = x1.sort_by {|y|y.pwm_decode_7525.scan(/\w/).count} - baseline = x.last.pwm_decode_7525.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode_7525.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode_7525 << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| - section_bits = [] - device.sections.each do |section| -if section.section_range.member? index - section_bits << index %th{:style => "color:white;background:#{section.colour}"}= index -if section_bits.exclude? index %th{:style => "color:white;"}= index %tbody - x.each do |barray| %tr %td = barray.unit.name %br = barray.name %br = "id: #{barray.id}" - barray.pwm_decode_7525.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/sections/_raw_analysis.html.haml ================================================ - if device.units.map(&:captures).flatten.any? - vanilla = true - if device.could_be_pwm? || device.could_be_pwm_7525? || device.could_be_manchester? - vanilla = false - if vanilla %div.col-lg-12 %hr %h4 Analysis Helper %p The longest binary string is used as the comparison baseline (B) %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = device.units.map(&:captures).flatten.each - device.units.map(&:captures).flatten.each do |c| - c.update_attribute(:binary, c.original_binary) if c.binary.blank? - x = x1.sort_by {|y|y.original_binary.scan(/\w/).count} - baseline = x.last.original_binary.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.original_binary.scan(/\w/).count - xx.binary = xx.original_binary - if diff > 0 - diff.times do |i| - xx.binary = xx.binary << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| - section_bits = [] - device.sections.each do |section| -if section.section_range.member? index - section_bits << index %th{:style => "color:white;background:#{section.colour}"}= index -if section_bits.exclude? index %th{:style => "color:white;"}= index %tbody - x.each do |barray| %tr %td = link_to "#{barray.unit.name}: ",barray.unit, :style => "color:#2a9fd6;" = barray.name - barray.binary.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/sections/_rfcat_config.html.haml ================================================ %p="d.setFreq(#{device.format_frequency})" %p="d.setMdmDRate(#{device.baudrate})" %p="d.setMdmModulation(MOD_ASK_OOK)" %p="d.setMdmSyncMode(0)" /%p="d.setMaxPower(0)" %p ================================================ FILE: app/views/sections/_section_transformations.html.haml ================================================ %div.col-lg-12 %hr %h4 Transformation Scratchpad /# %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` - @sections.each do |section| %h5= section.name %table.table.table-hover.table-bordered{style:'background-color:black;'} %thead %tr %th{:style => "color:grey;"} Capture %th{:style => "color:grey;"} Binary %th{:style => "color:grey;"} Decimal %th{:style => "color:grey;"} Flipped Decimal %tbody - captures.each do |capture| %tr %th{style:"background-color:#{section.colour};"} = capture.unit.name %br = capture.name %br = "id: #{capture.id}" %td{:style=>"min-width:200px;"} - if device.could_be_pwm_7525? - b=capture.pwm_decode_7525 - elsif device.could_be_pwm? - b=capture.pwm_decode - elsif device.could_be_manchester? - b=capture.manchester_decode - else - b=capture.original_binary - section_binary = b[section.start_pos..section.end_pos] = section_binary %td = section_binary.to_i(2) %td = section_binary.gsub("1","one").gsub("0","zero").gsub("zero","1").gsub("one",'0').to_i(2) %br ================================================ FILE: app/views/sections/_sections.html.haml ================================================ - if @sections.present? %div.col-lg-12 %hr %h4 Sections Defined /# %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} %thead %tr %th{:style => "color:grey;"} Name %th{:style => "color:grey;"} Start Position %th{:style => "color:grey;"} End Position %th{:style => "color:grey;"} Colour %th{:style => "color:grey;"} Notes %th{:style => "color:grey;"} %tbody - @sections.each do |section| %tr %th{style:"background-color:#{section.colour};"} = section.name %td = section.start_pos %td = section.end_pos %td = section.colour %td = section.notes %td = link_to 'Edit', edit_section_path(section), :style => "color:#2a9fd6;" %br = link_to 'Destroy', section, :method => :delete, :data => { :confirm => 'Are you sure?' }, :style => "color:red;" %br ================================================ FILE: app/views/sections/edit.html.haml ================================================ %h1 Editing section = render 'form' = link_to 'Show', @section \| = link_to 'Back', sections_path ================================================ FILE: app/views/sections/generate.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %div.col-lg-12{:style=>" max-width:700px;"} %h3{:style => "padding-left:3px;"} Generated Binary %br -device = nil .well.well-lg{:style=>" max-width:700px;"} %h5 Generation Configuration - params.to_a.each do |p| - if p[0].include? "section" - sect_id = p[0].gsub("section_","") - s = Section.find(sect_id) - c = Capture.find(p[1]) - d = device = c.unit.device %p{:style=>" max-width:500px; word-wrap:break-word;"} %span= "Section: " %span{:style=>" color:white;"}= "#{s.name} " %span= "(bits #{s.start_pos} to #{s.end_pos})" %span= "from: " %span{:style=>" color:white;"}= "#{c.unit.name}" %span= " - " %span{:style=>" color:white;"}= "#{c.name}" %br .well.well-lg{:style=>" max-width:700px;"} %h4 Original Format %br %h5 Binary -bin = "" -type = "" - params.to_a.each do |p| - if p[0].include? "section" - sect_id = p[0].gsub("section_","") - s = Section.find(sect_id) - c = Capture.find(p[1]) - d = c.unit.device - device = d // CHECK MODULATION - if d.could_be_pwm_7525? - type = "pwm7525" - b = c.pwm_decode_7525 - bin << b[s.start_pos..s.end_pos] - elsif d.could_be_pwm? - type = "pwm" - b = c.pwm_decode - bin << b[s.start_pos..s.end_pos] - elsif d.could_be_manchester? - type = "manchester" - b = c.manchester_decode - bin << b[s.start_pos..s.end_pos] - else - type = "ook" - b = c.original_binary - bin << b[s.start_pos..s.end_pos] %p{:style=>" max-width:500px; word-wrap:break-word;"}=bin %br %span="Size: " %span= bin.size %span="bits " %br %br .well.well-lg{:style=>" max-width:700px;"} %h4 OOK Format %br %h5 Binary - ook_bin = "" // CHECK MODULATION - if device.flip_pwm - if type == "pwm7525" -bin.scan(/./).each do |bit| - ook_bin << "1000" if bit.to_s == '1' - ook_bin << "1110" if bit.to_s == '0' - elsif type == "pwm" -bin.scan(/./).each do |bit| - ook_bin << "100" if bit.to_s == '1' - ook_bin << "110" if bit.to_s == '0' - elsif type == "manchester" -bin.scan(/./).each do |bit| - ook_bin << "01" if bit.to_s == '1' - ook_bin << "10" if bit.to_s == '0' - elsif type == "ook" -ook_bin << bin - else - if type == "pwm7525" -bin.scan(/./).each do |bit| - ook_bin << "1110" if bit.to_s == '1' - ook_bin << "1000" if bit.to_s == '0' - elsif type == "pwm" -bin.scan(/./).each do |bit| - ook_bin << "110" if bit.to_s == '1' - ook_bin << "100" if bit.to_s == '0' - elsif type == "manchester" -bin.scan(/./).each do |bit| - ook_bin << "10" if bit.to_s == '1' - ook_bin << "01" if bit.to_s == '0' - elsif type == "ook" -ook_bin << bin %p{:style=>" max-width:500px; word-wrap:break-word;"}= ook_bin %br %span="Size: " %span= ook_bin.size %span="bits " %br %br %hr %h5 RFCat =render "rfcat_config", device: device %p{:style=>" max-width:500px; word-wrap:break-word;"}= "d.RFxmit(\"#{Capture.to_hexcode ook_bin}\")" %br %p="# or if you need to repeat the packet:" %p{:style=>" max-width:500px; word-wrap:break-word;"}= "d.RFxmit(\"\\x00\\x00\\x00\\x00#{Capture.to_hexcode ook_bin}\" * 5)" %br -#Vertical text style for TH -#%th{:style => "color:grey;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg);-ms-transform: rotate(-90deg);-o-transform: rotate(-90deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);color: #FFF;text-transform: uppercase;"} 0 ================================================ FILE: app/views/sections/index.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h3 Reverse Engineering Worksheet: = @device.name %p A Reverse Engineering Worksheet is built around the concept of sections. A section if portion of the binary that you define to have a particular meaning. E.g. if bits 0-7 represent the "Device ID" then you can define a section to reflect that. The worksheet the binary generates below is based on the modulation and encoding type saved for the device. %br %div.col-lg-8 %table.table.table-bordered %tr %th.bg-primary{style:"width:15%;"} Name %td= @device.name %tr %th.bg-primary FCC ID %td= @device.fcc_id %tr %th.bg-primary Modulation %td = @device.modulation %tr %th.bg-primary Encoding %td= @device.encoding %tr %th.bg-primary Frequency %td = @device.frequency = ' Mhz' %tr %th.bg-primary Baudrate %td= @device.baudrate %tr %th.bg-primary Decoding Rules %td= @device.flip_pwm == true ? "Bits flipped after demodulation" : "Bits not flipped (Default State)" %tr %th.bg-primary Notes %td= @device.notes %div.col-lg-3 .well.well-lg %h5 Actions = link_to 'Go Back to Device View', @device, :style => "color:#2a9fd6;" %br = link_to 'Edit Device', edit_device_path(@device), :style => "color:#2a9fd6;" =render "sections", sections: @sections =render "no_sections", sections: @sections, device: @device =render "pwm_analysis", device: @device, without_baseline: @without_baseline =render "manchester_analysis", device: @device, without_baseline: @without_baseline =render "raw_analysis", device: @device, without_baseline: @without_baseline %div.col-lg-12 %hr %h4 Define new section %p Pick and choose which capture to use as a template for each section and generate the binary. Note for this to work as intended, each bit you want to send should be included in a section definition. %br = render 'form' %div.col-lg-12 %hr %h4 Generate Binary %p Pick and choose which captures to use as a template for each defined section and generate the binary for RFCat transmission. Note for this to work as intended, each bit in the table above should be included in a section definition or it won't be represented in the generated string. %br = form_tag(generate_path, method: "post") do - @sections.each_with_index do |section| .form-group %label.col-lg-6.control-label{:for => "colour"}= "#{section.name} from:" .col-lg-10 - captures = [] - @device.captures.each do |c| - captures << ["#{c.unit.name} - #{c.name}",c.id] - the_options = options_for_select(captures) = select_tag "section_#{section.id}", the_options, label: false, input_html: { class: 'form-control' } %br %hr .form-group .col-lg-10.col-lg-offset-0 %button.btn.btn-primary{:type => "submit"} Generate Binary %br %br =render "section_transformations", device: @device, captures: @device.units.map(&:captures).flatten, without_baseline: @without_baseline - unless @sections.blank? %div.col-lg-12.well.well-lg %h4 Share these sections as a template %p Reverse engineering something that doesn't exist in our template library? Please consider sharing your section template with us all once you've finished reverse engineering this device. = simple_form_for(SectionTemplate.new(:added_by => "anonymous")) do |f| = f.hidden_field :device_id, :value => @device.id /-#%button.btn.btn-default{:type => "reset"} Cancel %label.col-lg-10.control-label{:for => "name"} Template Name (please be descriptive, but concise. E.g. "Generic Remote SC226x") .col-lg-10 = f.input :name, label: false, input_html: { class: 'form-control' } %br %label.col-lg-10.control-label{:for => "added_by"} Your Name or Handle (or leave this field unchanged and submit anonymously) .col-lg-10 = f.input :added_by, label: false, input_html: { class: 'form-control' } %br .form-group .col-lg-10.col-lg-offset-0 %button.btn.btn-primary{:type => "submit"} Share as Template %br ================================================ FILE: app/views/sections/index.json.jbuilder ================================================ json.array!(@sections) do |section| json.extract! section, :id, :device_id, :name, :notes, :start_pos, :end_pos, :colour json.url section_url(section, format: :json) end ================================================ FILE: app/views/sections/new.html.haml ================================================ %h1 New section = render 'form' = link_to 'Back', sections_path ================================================ FILE: app/views/sections/show.html.haml ================================================ %p#notice= notice %p %b Device: = @section.device_id %p %b Name: = @section.name %p %b Notes: = @section.notes %p %b Start pos: = @section.start_pos %p %b End pos: = @section.end_pos %p %b Colour: = @section.colour = link_to 'Edit', edit_section_path(@section) \| = link_to 'Back', sections_path %div.container-fluid %div.row %div.col-lg-12 %h3 Device: = @device.name %p A device is effectively a category. It should have at least one unit. If you have multiple units of the same type (e.g. 3 identical garage door remotes), they are best represented as multiple units of the same device. %br %div.col-lg-8 %table.table.table-bordered %tr %th.bg-primary{style:"width:15%;"} Name %td= @device.name %tr %th.bg-primary FCC ID %td= @device.fcc_id %tr %th.bg-primary Modulation %td = @device.modulation %tr %th.bg-primary Encoding %td= @device.encoding %tr %th.bg-primary Frequency %td = @device.frequency = ' Mhz' %tr %th.bg-primary Baudrate %td= @device.baudrate %tr %th.bg-primary Notes %td= @device.notes %div.col-lg-3 .well.well-lg %h5 Actions -#= link_to 'Add New Unit', edit_device_path(@device), :style => "color:#2a9fd6;" -#%br =link_to 'Edit Device', edit_device_path(@device), :style => "color:#2a9fd6;" %br = link_to 'Back to Devices', devices_path, :style => "color:#2a9fd6;" =render "manchester_analysis", device: @device, without_baseline: @without_baseline / =render "manchester_analysis", unit: @unit =render "pwm_analysis", device: @device, without_baseline: @without_baseline / =render "raw_analysis", unit: @unit / # change raw so only shows if no encoding =render "raw_analysis", device: @device, without_baseline: @without_baseline / # replace with section add ?????? =render "add_unit", unit: @unit =render "show_units", device: @device %br -#Vertical text style for TH -#%th{:style => "color:grey;-webkit-transform: rotate(-90deg);-moz-transform: rotate(-90deg);-ms-transform: rotate(-90deg);-o-transform: rotate(-90deg);filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=3);color: #FFF;text-transform: uppercase;"} 0 ================================================ FILE: app/views/sections/show.json.jbuilder ================================================ json.extract! @section, :id, :device_id, :name, :notes, :start_pos, :end_pos, :colour, :created_at, :updated_at ================================================ FILE: app/views/units/_captures.html.haml ================================================ %h4 Captures %table.table.table-bordered.table.hover %thead %tr.bg-primary %th ID %th Name %th Raw Binary %th Actions %tbody - unit.captures.each do |u| %tr %td= u.id %td= u.name %td{:style=>"max-width:200px; word-wrap:break-word;"} / - u.original_binary.scan(/.{1,40}/).each do |s| / ="#{s}" / %br = u.original_binary %td{:style => "width:15%;"} = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' } %div.col-lg-12 ================================================ FILE: app/views/units/_form.html.haml ================================================ = simple_form_for(@unit) do |f| = f.error_notification = f.hidden_field :device_id .form-group %label.col-lg-2.control-label{:for => "inputEmail"} Name .col-lg-10 = f.input :name, label: false, input_html: { class: 'form-control' } %br .form-group .col-lg-10.col-lg-offset-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit"} Submit ================================================ FILE: app/views/units/_manchester_analysis.html.haml ================================================ - if unit.captures.present? - if unit.device.could_be_manchester? %div.col-lg-12 %hr %h4 Manchester Bit Position Analysis Tool %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = unit.captures.each - x = x1.sort_by {|y|y.manchester_decode.scan(/\w/).count} - baseline = x.last.manchester_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.manchester_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.manchester_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = barray.name - barray.manchester_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/units/_manchester_decoding.html.haml ================================================ %h5 Manchester Encoding - if manchester_format.blank? %span{:style => "float:right;"}= link_to "Switch to IEEE 802 Format", '?manchester_format=802', style:"color:#2a9fd6" %p Defaulting to Manchester format: "G. E. Thomas" - else %span{:style => "float:right;"}= link_to "Switch to G. E. Thomas Format", '?', style:"color:#2a9fd6" %p Showing as Manchester format: "IEE 802" %table.table.table-bordered.table.hover %thead %tr.bg-primary %th ID %th Name %th Valid? %th Manchester Binary %th Hex %th Ascii %th Actions %tbody - unit.captures.each do |u| %tr %td= u.id %td= u.name %td{:style=>"word-wrap:break-word;"} - if u.valid_manchester? %p{:style => "color:green;"}= "#{u.valid_manchester? human=true}" - else %p{:style => "color:red;"}= "#{u.valid_manchester? human=true}" %td - manchester = (manchester_format.blank? ? manchester = u.manchester_decode : u.flip(u.manchester_decode)) - manchester.scan(/.{1,40}/).each do |s| ="#{s}" %br %td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode manchester}" %td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(manchester)}" %td{:style => "width:15%;"} = link_to 'show', u \| = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' } ================================================ FILE: app/views/units/_pwm_analysis.html.haml ================================================ - if unit.captures.present? - if unit.device.could_be_pwm? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (66/33) %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = unit.captures.each - x = x1.sort_by {|y|y.pwm_decode.scan(/\w/).count} - baseline = x.last.pwm_decode.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = barray.name - barray.pwm_decode.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br - if unit.device.could_be_pwm_7525? %div.col-lg-12 %hr %h4 PWM Bit Position Analysis Tool (75/25) %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = unit.captures.each - x = x1.sort_by {|y|y.pwm_decode_7525.scan(/\w/).count} - baseline = x.last.pwm_decode_7525.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.pwm_decode_7525.scan(/\w/).count - if diff > 0 - diff.times do |i| - xx.binary = xx.pwm_decode_7525 << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = barray.name - barray.pwm_decode_7525.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/units/_pwm_decoding.html.haml ================================================ %h5 PWM Encoding - if pwm_format.blank? %span{:style => "float:right;"}= link_to "Flip bits", '?pwm_format=flipped', style:"color:#2a9fd6" %p Attempts to decode as PWM 66/33 Format (i.e. a 1 is 110, and a 0 is 100) - else %span{:style => "float:right;"}= link_to "Undo flip bits", '?', style:"color:#2a9fd6" %p Attempts to decode as PWM 66/33 Format, with bits flipped (i.e. a 1 is 100, and a 0 is 110) %table.table.table-bordered.table.hover %thead %tr.bg-primary %th ID %th Name %th Valid? %th PWM Binary %th Hex %th Ascii %th Actions %tbody - unit.captures.each do |u| %tr %td= u.id %td= u.name %td - if u.valid_pwm? %p{:style => "color:green;"}= "#{u.valid_pwm? human=true}" - else %p{:style => "color:red;"}= "#{u.valid_pwm? human=true}" %td{:style=>"word-wrap:break-word;"} - pwm = (pwm_format.blank? ? u.pwm_decode : u.flip(u.pwm_decode)) - pwm.scan(/.{1,40}/).each do |s| ="#{s}" %br %td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode pwm}" %td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(pwm)}" %td{:style => "width:15%;"} = link_to 'show', u \| = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' } / # 75/25 %h5 PWM Encoding - if pwm_format.blank? %span{:style => "float:right;"}= link_to "Flip bits", '?pwm_format=flipped', style:"color:#2a9fd6" %p Attempts to decode as PWM 75/25 Format (i.e. a 1 is 1110, and a 0 is 1000) - else %span{:style => "float:right;"}= link_to "Undo flip bits", '?', style:"color:#2a9fd6" %p Attempts to decode as PWM 75/25 Format, with bits flipped (i.e. a 1 is 1000, and a 0 is 1110) %table.table.table-bordered.table.hover %thead %tr.bg-primary %th ID %th Name %th Valid? %th PWM Binary %th Hex %th Ascii %th Actions %tbody - unit.captures.each do |u| %tr %td= u.id %td= u.name %td - if u.valid_pwm_7525? %p{:style => "color:green;"}= "#{u.valid_pwm_7525? human=true}" - else %p{:style => "color:red;"}= "#{u.valid_pwm_7525? human=true}" %td{:style=>"word-wrap:break-word;"} - pwm = (pwm_format.blank? ? u.pwm_decode_7525 : u.flip(u.pwm_decode_7525)) - pwm.scan(/.{1,40}/).each do |s| ="#{s}" %br %td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode pwm}" %td{:style=>"word-wrap:break-word;"}="#{u.bin_to_ascii(pwm)}" %td{:style => "width:15%;"} = link_to 'show', u \| = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' } ================================================ FILE: app/views/units/_raw_analysis.html.haml ================================================ - if unit.captures.present? %div.col-lg-12 %hr %h4 Raw Bit Position Analysis Tool %p The longest binary string is used as the comparison baseline (B) below %br / -`inspectrum` %table.table.table-hover.table-bordered{style:'background-color:black;'} - x1 = unit.captures.each - x = x1.sort_by {|y|y.original_binary.scan(/\w/).count} - baseline = x.last.original_binary.scan(/\w/) - x.each do |xx| - diff = baseline.count - xx.original_binary.scan(/\w/).count - xx.binary = xx.original_binary - if diff > 0 - diff.times do |i| - xx.binary = xx.binary << 'p' %thead %tr %th -baseline.flatten.each_with_index do |it,index| %th{:style => "color:grey;"}= index %tbody - x.each do |barray| %tr %td = barray.name - barray.binary.scan(/\w/).each_with_index do |b, index| - if b == baseline[index] - if b != 'p' %td.text-success= b - else %td -else - if b != 'p' %td.text-danger= b - else %td %td{style:"text-align:center;"} B -baseline.each do |b| - if b != 'p' %td.text-primary= b - else %td %br ================================================ FILE: app/views/units/_raw_decoding.html.haml ================================================ %h5 Raw (No special encoding) %table.table.table-bordered.table.hover %thead %tr.bg-primary %th ID %th Name %th Raw Binary To Hex %th Raw Binary To Ascii %th Actions %tbody - unit.captures.each do |u| %tr %td= u.id %td= u.name %td{:style=>"word-wrap:break-word;"}="#{u.to_hexcode }" %td{:style=>"word-wrap:break-word;"}="#{u.to_ascii(manchester=false)}" %td{:style => "width:15%;"} = link_to 'show', u \| = link_to 'Destroy', u, :method => :delete, :data => { :confirm => 'Are you sure?' } ================================================ FILE: app/views/units/edit.html.haml ================================================ %h1 Editing unit = render 'form' = link_to 'Show', @unit \| = link_to 'Back', units_path ================================================ FILE: app/views/units/index.html.haml ================================================ %h1 Listing units %table %thead %tr %th Device %th Name %th Notes %th %th %th %tbody - @units.each do |unit| %tr %td= unit.device_id %td= unit.name %td= unit.notes %td= link_to 'Show', unit %td= link_to 'Edit', edit_unit_path(unit) %td= link_to 'Destroy', unit, :method => :delete, :data => { :confirm => 'Are you sure?' } %br = link_to 'New Unit', new_unit_path ================================================ FILE: app/views/units/index.json.jbuilder ================================================ json.array!(@units) do |unit| json.extract! unit, :id, :device_id, :name, :notes json.url unit_url(unit, format: :json) end ================================================ FILE: app/views/units/new.html.haml ================================================ %h1 New unit = render 'form' = link_to 'Back', units_path ================================================ FILE: app/views/units/show.html.haml ================================================ %div.container-fluid %div.row %div.col-lg-12 %h3 Unit: = @unit.name %p This unit is a = link_to @unit.device.name, @unit.device, style:"color:#2a9fd6" %br %div.col-lg-8 %table.table.table-bordered %tr %th.bg-primary{style:"width:25%;"} Name %td= @unit.name %tr %th.bg-primary Device ID %td= @unit.device.id %tr %th.bg-primary Device Name %td = @unit.device.name %tr %th.bg-primary Notes %td= @unit.notes %div.col-lg-3 .well.well-lg %h5 Actions = link_to 'Add New Capture' , new_device_unit_capture_path(@unit.device.id, @unit.id), style:"color:#2a9fd6" %br = link_to 'Edit Unit', edit_unit_path(@unit), style:"color:#2a9fd6" %br = link_to 'View Device', @unit.device, style:"color:#2a9fd6" %div.col-lg-12 %hr =render "captures", unit: @unit %hr %h4 Automated Demodulation Attempts %br =render "raw_decoding", unit: @unit =render "manchester_decoding", unit: @unit, manchester_format: @manchester_format =render "pwm_decoding", unit: @unit, pwm_format: @pwm_format =render "manchester_analysis", unit: @unit =render "pwm_analysis", unit: @unit =render "raw_analysis", unit: @unit = simple_form_for(@unit) do |f| = f.error_notification .form-group %label.col-lg-2.control-label{:for => "notes"} Notes .col-lg-10 = f.input :notes, label: false, type: 'text-area', input_html: { class: 'form-control textArea', rows: 10 } %br .form-group .col-lg-10.col-lg-offset-2 /-#%button.btn.btn-default{:type => "reset"} Cancel %button.btn.btn-primary{:type => "submit"} Update ================================================ FILE: app/views/units/show.json.jbuilder ================================================ json.extract! @unit, :id, :device_id, :name, :notes, :created_at, :updated_at ================================================ FILE: bin/bundle ================================================ #!/usr/bin/env ruby ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) load Gem.bin_path('bundler', 'bundle') ================================================ FILE: bin/rails ================================================ #!/usr/bin/env ruby APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' ================================================ FILE: bin/rake ================================================ #!/usr/bin/env ruby require_relative '../config/boot' require 'rake' Rake.application.run ================================================ FILE: bin/setup ================================================ #!/usr/bin/env ruby require 'pathname' # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) Dir.chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file: puts "== Installing dependencies ==" system "gem install bundler --conservative" system "bundle check || bundle install" # puts "\n== Copying sample files ==" # unless File.exist?("config/database.yml") # system "cp config/database.yml.sample config/database.yml" # end puts "\n== Preparing database ==" system "bin/rake db:setup" puts "\n== Removing old logs and tempfiles ==" system "rm -f log/*" system "rm -rf tmp/cache" puts "\n== Restarting application server ==" system "touch tmp/restart.txt" end ================================================ FILE: config/application.rb ================================================ require File.expand_path('../boot', __FILE__) require 'rails/all' # Require the gems listed in Gemfile, including any gems # you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module DspectrumGUI class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here. # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. # config.time_zone = 'Central Time (US & Canada)' # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.default_locale = :de # Do not swallow errors in after_commit/after_rollback callbacks. config.active_record.raise_in_transactional_callbacks = true config.assets.paths << Rails.root.join('app', 'assets', 'fonts') end end ================================================ FILE: config/boot.rb ================================================ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) require 'bundler/setup' # Set up gems listed in the Gemfile. ================================================ FILE: config/database.yml ================================================ # SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: 5 timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default database: db/production.sqlite3 ================================================ FILE: config/environment.rb ================================================ # Load the Rails application. require File.expand_path('../application', __FILE__) # Initialize the Rails application. Rails.application.initialize! ================================================ FILE: config/environments/development.rb ================================================ Rails.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 the web server when you make code changes. config.cache_classes = false # Do not eager load code on boot. config.eager_load = false # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. config.assets.digest = true # Adds additional error checking when serving assets at runtime. # Checks for improperly declared sprockets dependencies. # Raises helpful error messages. config.assets.raise_runtime_errors = true # Raises error for missing translations # config.action_view.raise_on_missing_translations = true config.assets.paths << Rails.root.join('app', 'assets', 'fonts') end ================================================ FILE: config/environments/production.rb ================================================ Rails.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 # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Enable Rack::Cache to put a simple HTTP cache in front of your application # Add `rack-cache` to your Gemfile before enabling this. # For large-scale production use, consider using a caching reverse proxy like # NGINX, varnish or squid. # config.action_dispatch.rack_cache = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false # Asset digests allow you to set far-future HTTP expiration dates on all assets, # yet still be able to expire them through the digest params. config.assets.digest = true # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. # config.log_tags = [ :subdomain, :uuid ] # Use a different logger for distributed setups. # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # Use a different cache store in production. # config.cache_store = :mem_cache_store # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false config.assets.paths << Rails.root.join('app', 'assets', 'fonts') end ================================================ FILE: config/environments/test.rb ================================================ Rails.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 the test suite and is wiped # and recreated between test runs. Don't rely on the data there! config.cache_classes = true # Do not eager load code on boot. This avoids loading your whole application # just for the purpose of running a single test. If you are using a tool that # preloads Rails for running tests, you may have to set it to true. config.eager_load = false # Configure static file server for tests with Cache-Control for performance. config.serve_static_files = true config.static_cache_control = 'public, max-age=3600' # Show full error reports and disable caching. config.consider_all_requests_local = true config.action_controller.perform_caching = false # Raise exceptions instead of rendering exception templates. config.action_dispatch.show_exceptions = false # Disable request forgery protection in test environment. config.action_controller.allow_forgery_protection = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test # Randomize the order test cases are executed. config.active_support.test_order = :random # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr # Raises error for missing translations # config.action_view.raise_on_missing_translations = true end ================================================ FILE: config/favicon.json ================================================ { "master_picture": "public/adb.png", "favicon_design": { "ios": { "picture_aspect": "no_change" }, "desktop_browser": [ ], "windows": { "picture_aspect": "no_change", "background_color": "#da532c", "on_conflict": "override" }, "android_chrome": { "picture_aspect": "no_change", "theme_color": "#ffffff", "manifest": { "name": "AdvisoryDB", "display": "browser", "orientation": "not_set", "on_conflict": "override", "declared": true } }, "safari_pinned_tab": { "picture_aspect": "black_and_white", "threshold": 50, "theme_color": "#5bbad5" } }, "settings": { "scaling_algorithm": "Mitchell", "error_on_image_too_small": false } } ================================================ FILE: config/initializers/action_mailer.rb ================================================ # Be sure to restart your server when you modify this file. # /config/initializers/action_mailer.rb.. # ActionMailer email configuration ActionMailer::Base.delivery_method = :smtp ActionMailer::Base.smtp_settings = { :address => "smtp.zoho.com", #ENV['SMTP_ADDRESS'], :port => 465, # ENV['SMTP_PORT'], :domain => Rails.env == 'production' ? "advisorydb.com" : "localhost", # ENV['SMTP_DOMAIN'], :user_name => "do-not-reply@advisorydb.com", #ENV['SMTP_USERNAME'], :password => "ActionMailer!", #ENV['SMTP_PASSWORD'], :authentication => :login, :enable_starttls_auto => true, :ssl => true } ================================================ FILE: config/initializers/assets.rb ================================================ # Be sure to restart your server when you modify this file. # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional assets to the asset load path # Rails.application.config.assets.paths << Emoji.images_path # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. # Rails.application.config.assets.precompile += %w( search.js ) Rails.application.config.assets.precompile += %w( bootstrap.min.js ) Rails.application.config.assets.precompile += %w( favicon/.* ) ================================================ FILE: config/initializers/backtrace_silencers.rb ================================================ # 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 problem that might stem from framework code. # Rails.backtrace_cleaner.remove_silencers! ================================================ FILE: config/initializers/cookies_serializer.rb ================================================ # Be sure to restart your server when you modify this file. Rails.application.config.action_dispatch.cookies_serializer = :json ================================================ FILE: config/initializers/devise.rb ================================================ # 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| # The secret key used by Devise. Devise uses this key to generate # random tokens. Changing this key will render invalid all existing # confirmation, reset password and unlock tokens in the database. # Devise will use the `secret_key_base` on Rails 4+ applications as its `secret_key` # by default. You can change it below and use your own secret key. # config.secret_key = '27ff1e4ffa3ec01fac4d388cd37ea67780a1fbbd936d7e9ba30ba89f289f55ef8a6914dd77b4ef0e60c2b9365c89950f5ae6d45c058c25da2c7977d2d736d49f' # ==> Mailer Configuration # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. config.mailer_sender = 'do-not-reply@advisorydb.com' # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' # ==> ORM configuration # Load and configure the ORM. Supports :active_record (default) and # :mongoid (bson_ext recommended) by default. Other ORMs may be # available as additional gems. require 'devise/orm/active_record' # ==> Configuration for any authentication mechanism # Configure which keys are used when authenticating a user. The default is # just :email. You can configure it to use [:username, :subdomain], so for # authenticating a user, both parameters are required. Remember that those # parameters are used only when authenticating and not when retrieving from # session. If you need permissions, you should implement that in a before filter. # You can also supply a hash where the value is a boolean determining whether # or not authentication should be aborted when the value is not present. # config.authentication_keys = [:email] # Configure parameters from the request object used for authentication. Each entry # given should be a request method and it will automatically be passed to the # find_for_authentication method and considered in your model lookup. For instance, # if you set :request_keys to [:subdomain], :subdomain will be used on authentication. # The same considerations mentioned for authentication_keys also apply to request_keys. # config.request_keys = [] # Configure which authentication keys should be case-insensitive. # These keys will be downcased upon creating or modifying a user and when used # to authenticate or find a user. Default is :email. config.case_insensitive_keys = [:email] # Configure which authentication keys should have whitespace stripped. # These keys will have whitespace before and after removed upon creating or # modifying a user and when used to authenticate or find a user. Default is :email. config.strip_whitespace_keys = [:email] # Tell if authentication through request.params is enabled. True by default. # It can be set to an array that will enable params authentication only for the # given strategies, for example, `config.params_authenticatable = [:database]` will # enable it only for database (email + password) authentication. # config.params_authenticatable = true # Tell if authentication through HTTP Auth is enabled. False by default. # It can be set to an array that will enable http authentication only for the # given strategies, for example, `config.http_authenticatable = [:database]` will # enable it only for database authentication. The supported strategies are: # :database = Support basic authentication with authentication key + password # config.http_authenticatable = false # If 401 status code should be returned for AJAX requests. True by default. # config.http_authenticatable_on_xhr = true # The realm used in Http Basic Authentication. 'Application' by default. # config.http_authentication_realm = 'Application' # It will change confirmation, password recovery and other workflows # to behave the same regardless if the e-mail provided was right or wrong. # Does not affect registerable. # config.paranoid = true # By default Devise will store the user in session. You can skip storage for # particular strategies by setting this option. # Notice that if you are skipping storage for all authentication paths, you # may want to disable generating routes to Devise's sessions controller by # passing skip: :sessions to `devise_for` in your config/routes.rb config.skip_session_storage = [:http_auth] # By default, Devise cleans up the CSRF token on authentication to # avoid CSRF token fixation attacks. This means that, when using AJAX # requests for sign in and sign up, you need to get a new CSRF token # from the server. You can disable this option at your own risk. # config.clean_up_csrf_token_on_authentication = true # ==> Configuration for :database_authenticatable # For bcrypt, this is the cost for hashing the password and defaults to 10. If # using other encryptors, it sets how many times you want the password re-encrypted. # # Limiting the stretches to just one in testing will increase the performance of # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use # a value less than 10 in other environments. Note that, for bcrypt (the default # encryptor), the cost increases exponentially with the number of stretches (e.g. # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). config.stretches = Rails.env.test? ? 1 : 10 # Setup a pepper to generate the encrypted password. # config.pepper = '675698e6390c4de3dab1e89dda134d42b1b0a840702898ccd2a827db475d43bb91f76276a315c00c5765c1624e378f6e411bae12a3015db2747324323c6a1d2d' # Send a notification email when the user's password is changed # config.send_password_change_notification = false # ==> Configuration for :confirmable # A period that the user is allowed to access the website even without # confirming their account. For instance, if set to 2.days, the user will be # able to access the website for two days without confirming their account, # access will be blocked just in the third day. Default is 0.days, meaning # the user cannot access the website without confirming their account. # config.allow_unconfirmed_access_for = 2.days # A period that the user is allowed to confirm their account before their # token becomes invalid. For example, if set to 3.days, the user can confirm # their account within 3 days after the mail was sent, but on the fourth day # their account can't be confirmed with the token any more. # Default is nil, meaning there is no restriction on how long a user can take # before confirming their account. # config.confirm_within = 3.days # If true, requires any email changes to be confirmed (exactly the same way as # initial account confirmation) to be applied. Requires additional unconfirmed_email # db field (see migrations). Until confirmed, new email is stored in # unconfirmed_email column, and copied to email column on successful confirmation. config.reconfirmable = true # Defines which key will be used when confirming an account # config.confirmation_keys = [:email] # ==> Configuration for :rememberable # The time the user will be remembered without asking for credentials again. # config.remember_for = 2.weeks # Invalidates all the remember me tokens when the user signs out. config.expire_all_remember_me_on_sign_out = true # If true, extends the user's remember period when remembered via cookie. # config.extend_remember_period = false # Options to be passed to the created cookie. For instance, you can set # secure: true in order to force SSL only cookies. # config.rememberable_options = {} # ==> Configuration for :validatable # Range for password length. config.password_length = 8..72 # Email regex used to validate email formats. It simply asserts that # one (and only one) @ exists in the given string. This is mainly # to give user feedback and not to assert the e-mail validity. # config.email_regexp = /\A[^@]+@[^@]+\z/ # ==> Configuration for :timeoutable # The time you want to timeout the user session without activity. After this # time the user will be asked for credentials again. Default is 30 minutes. # config.timeout_in = 30.minutes # ==> Configuration for :lockable # Defines which strategy will be used to lock an account. # :failed_attempts = Locks an account after a number of failed attempts to sign in. # :none = No lock strategy. You should handle locking by yourself. # config.lock_strategy = :failed_attempts # Defines which key will be used when locking and unlocking an account # config.unlock_keys = [:email] # Defines which strategy will be used to unlock an account. # :email = Sends an unlock link to the user email # :time = Re-enables login after a certain amount of time (see :unlock_in below) # :both = Enables both strategies # :none = No unlock strategy. You should handle unlocking by yourself. # config.unlock_strategy = :both # Number of authentication tries before locking an account if lock_strategy # is failed attempts. # config.maximum_attempts = 20 # Time interval to unlock the account if :time is enabled as unlock_strategy. # config.unlock_in = 1.hour # Warn on the last attempt before the account is locked. # config.last_attempt_warning = true # ==> Configuration for :recoverable # # Defines which key will be used when recovering the password for an account # config.reset_password_keys = [:email] # Time interval you can reset your password with a reset password key. # Don't put a too small interval or your users won't have the time to # change their passwords. config.reset_password_within = 6.hours # When set to false, does not sign a user in automatically after their password is # reset. Defaults to true, so a user is signed in automatically after a reset. # config.sign_in_after_reset_password = true # ==> Configuration for :encryptable # Allow you to use another encryption algorithm besides bcrypt (default). You can use # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, # :authlogic_sha512 (then you should set stretches above to 20 for default behavior) # and :restful_authentication_sha1 (then you should set stretches to 10, and copy # REST_AUTH_SITE_KEY to pepper). # # Require the `devise-encryptable` gem when using anything other than bcrypt # config.encryptor = :sha512 # ==> Scopes configuration # Turn scoped views on. Before rendering "sessions/new", it will first check for # "users/sessions/new". It's turned off by default because it's slower if you # are using only default views. # config.scoped_views = false # Configure the default scope given to Warden. By default it's the first # devise role declared in your routes (usually :user). # config.default_scope = :user # Set this configuration to false if you want /users/sign_out to sign out # only the current scope. By default, Devise signs out all scopes. # config.sign_out_all_scopes = true # ==> Navigation configuration # Lists the formats that should be treated as navigational. Formats like # :html, should redirect to the sign in page when the user does not have # access, but formats like :xml or :json, should return 401. # # If you have any extra navigational formats, like :iphone or :mobile, you # should add them to the navigational formats lists. # # The "*/*" below is required to match Internet Explorer requests. # config.navigational_formats = ['*/*', :html] # The default HTTP method used to sign out a resource. Default is :delete. config.sign_out_via = :delete # ==> OmniAuth # Add a new OmniAuth provider. Check the wiki for more information on setting # up on your models and hooks. # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' # ==> Warden configuration # If you want to use other strategies, that are not supported by Devise, or # change the failure app, you can configure them inside the config.warden block. # # config.warden do |manager| # manager.intercept_401 = false # manager.default_strategies(scope: :user).unshift :some_external_strategy # end # ==> Mountable engine configurations # When using Devise inside an engine, let's call it `MyEngine`, and this engine # is mountable, there are some extra configurations to be taken into account. # The following options are available, assuming the engine is mounted as: # # mount MyEngine, at: '/my_engine' # # The router that invoked `devise_for`, in the example above, would be: # config.router_name = :my_engine # # When using OmniAuth, Devise cannot automatically set OmniAuth path, # so you need to do it manually. For the users scope, it would be: # config.omniauth_path_prefix = '/my_engine/users/auth' end ================================================ FILE: config/initializers/filter_parameter_logging.rb ================================================ # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [:password] ================================================ FILE: config/initializers/inflections.rb ================================================ # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end # These inflection rules are supported but not enabled by default: # ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end ================================================ FILE: config/initializers/kaminari.rb ================================================ # config/initializers/kaminari.rb Kaminari.configure do |config| config.page_method_name = :per_page_kaminari end ================================================ FILE: config/initializers/mime_types.rb ================================================ # 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 ================================================ FILE: config/initializers/session_store.rb ================================================ # Be sure to restart your server when you modify this file. Rails.application.config.session_store :cookie_store, key: '_advisorydb_session' ================================================ FILE: config/initializers/simple_form.rb ================================================ # Use this setup block to configure all options available in SimpleForm. SimpleForm.setup do |config| # Wrappers are used by the form builder to generate a # complete input. You can remove any component from the # wrapper, change the order or even add your own to the # stack. The options given below are used to wrap the # whole input. config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b| ## Extensions enabled by default # Any of these extensions can be disabled for a # given input by passing: `f.input EXTENSION_NAME => false`. # You can make any of these extensions optional by # renaming `b.use` to `b.optional`. # Determines whether to use HTML5 (:email, :url, ...) # and required attributes b.use :html5 # Calculates placeholders automatically from I18n # You can also pass a string as f.input placeholder: "Placeholder" b.use :placeholder ## Optional extensions # They are disabled unless you pass `f.input EXTENSION_NAME => true` # to the input. If so, they will retrieve the values from the model # if any exists. If you want to enable any of those # extensions by default, you can change `b.optional` to `b.use`. # Calculates maxlength from length validations for string inputs b.optional :maxlength # Calculates pattern from format validations for string inputs b.optional :pattern # Calculates min and max from length validations for numeric inputs b.optional :min_max # Calculates readonly automatically from readonly attributes b.optional :readonly ## Inputs b.use :label_input b.use :hint, wrap_with: { tag: :span, class: :hint } b.use :error, wrap_with: { tag: :span, class: :error } ## full_messages_for # If you want to display the full error message for the attribute, you can # use the component :full_error, like: # # b.use :full_error, wrap_with: { tag: :span, class: :error } end # The default wrapper to be used by the FormBuilder. config.default_wrapper = :default # Define the way to render check boxes / radio buttons with labels. # Defaults to :nested for bootstrap config. # inline: input + label # nested: label > input config.boolean_style = :nested # Default class for buttons config.button_class = 'btn' # Method used to tidy up errors. Specify any Rails Array method. # :first lists the first message for each field. # Use :to_sentence to list all errors for each field. # config.error_method = :first # Default tag used for error notification helper. config.error_notification_tag = :div # CSS class to add for error notification helper. config.error_notification_class = 'error_notification' # ID to add for error notification helper. # config.error_notification_id = nil # Series of attempts to detect a default label method for collection. # config.collection_label_methods = [ :to_label, :name, :title, :to_s ] # Series of attempts to detect a default value method for collection. # config.collection_value_methods = [ :id, :to_s ] # You can wrap a collection of radio/check boxes in a pre-defined tag, defaulting to none. # config.collection_wrapper_tag = nil # You can define the class to use on all collection wrappers. Defaulting to none. # config.collection_wrapper_class = nil # You can wrap each item in a collection of radio/check boxes with a tag, # defaulting to :span. # config.item_wrapper_tag = :span # You can define a class to use in all item wrappers. Defaulting to none. # config.item_wrapper_class = nil # How the label text should be generated altogether with the required text. # config.label_text = lambda { |label, required, explicit_label| "#{required} #{label}" } # You can define the class to use on all labels. Default is nil. # config.label_class = nil # You can define the default class to be used on forms. Can be overriden # with `html: { :class }`. Defaulting to none. # config.default_form_class = nil # You can define which elements should obtain additional classes # config.generate_additional_classes_for = [:wrapper, :label, :input] # Whether attributes are required by default (or not). Default is true. # config.required_by_default = true # Tell browsers whether to use the native HTML5 validations (novalidate form option). # These validations are enabled in SimpleForm's internal config but disabled by default # in this configuration, which is recommended due to some quirks from different browsers. # To stop SimpleForm from generating the novalidate option, enabling the HTML5 validations, # change this configuration to true. config.browser_validations = false # Collection of methods to detect if a file type was given. # config.file_methods = [ :mounted_as, :file?, :public_filename ] # Custom mappings for input types. This should be a hash containing a regexp # to match as key, and the input type that will be used when the field name # matches the regexp as value. # config.input_mappings = { /count/ => :integer } # Custom wrappers for input types. This should be a hash containing an input # type as key and the wrapper that will be used for all inputs with specified type. # config.wrapper_mappings = { string: :prepend } # Namespaces where SimpleForm should look for custom input classes that # override default inputs. # config.custom_inputs_namespaces << "CustomInputs" # Default priority for time_zone inputs. # config.time_zone_priority = nil # Default priority for country inputs. # config.country_priority = nil # When false, do not use translations for labels. # config.translate_labels = true # Automatically discover new inputs in Rails' autoload path. # config.inputs_discovery = true # Cache SimpleForm inputs discovery # config.cache_discovery = !Rails.env.development? # Default class for inputs # config.input_class = nil # Define the default class of the input wrapper of the boolean input. config.boolean_label_class = 'checkbox' # Defines if the default input wrapper class should be included in radio # collection wrappers. # config.include_default_input_wrapper_class = true # Defines which i18n scope will be used in Simple Form. # config.i18n_scope = 'simple_form' end ================================================ FILE: config/initializers/wrap_parameters.rb ================================================ # 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 format: [:json] if respond_to?(:wrap_parameters) end # To enable root element in JSON for ActiveRecord objects. # ActiveSupport.on_load(:active_record) do # self.include_root_in_json = true # end ================================================ FILE: config/locales/devise.en.yml ================================================ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n en: devise: confirmations: confirmed: "Your email address has been successfully confirmed." send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." failure: already_authenticated: "You are already signed in." inactive: "Your account is not activated yet." invalid: "Invalid %{authentication_keys} or password." locked: "Your account is locked." last_attempt: "You have one more attempt before your account is locked." not_found_in_database: "Invalid %{authentication_keys} or password." timeout: "Your session expired. Please sign in again to continue." unauthenticated: "You need to sign in or sign up before continuing." unconfirmed: "You have to confirm your email address before continuing." mailer: confirmation_instructions: subject: "Confirmation instructions" reset_password_instructions: subject: "Reset password instructions" unlock_instructions: subject: "Unlock instructions" password_change: subject: "Password Changed" omniauth_callbacks: failure: "Could not authenticate you from %{kind} because \"%{reason}\"." success: "Successfully authenticated from %{kind} account." passwords: no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." updated: "Your password has been changed successfully. You are now signed in." updated_not_active: "Your password has been changed successfully." registrations: destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." signed_up: "Welcome! You have signed up successfully." signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." updated: "Your account has been updated successfully." sessions: signed_in: "Signed in successfully." signed_out: "Signed out successfully." already_signed_out: "Signed out successfully." unlocks: send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." unlocked: "Your account has been unlocked successfully. Please sign in to continue." errors: messages: already_confirmed: "was already confirmed, please try signing in" confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" expired: "has expired, please request a new one" not_found: "not found" not_locked: "was not locked" not_saved: one: "1 error prohibited this %{resource} from being saved:" other: "%{count} errors prohibited this %{resource} from being saved:" ================================================ FILE: config/locales/en.yml ================================================ # Files in the config/locales directory are used for internationalization # and are automatically loaded by Rails. If you want to use locales other # than English, add the necessary files in this directory. # # To use the locales, use `I18n.t`: # # I18n.t 'hello' # # In views, this is aliased to just `t`: # # <%= t('hello') %> # # To use a different locale, set it with `I18n.locale`: # # I18n.locale = :es # # This would use the information in config/locales/es.yml. # # To learn more, please read the Rails Internationalization guide # available at http://guides.rubyonrails.org/i18n.html. en: hello: "Hello world" ================================================ FILE: config/locales/simple_form.en.yml ================================================ en: simple_form: "yes": 'Yes' "no": 'No' required: text: 'required' mark: '*' # You can uncomment the line below if you need to overwrite the whole required html. # When using html, text and mark won't be used. # html: '*' error_notification: default_message: "Please review the problems below:" # Examples # labels: # defaults: # password: 'Password' # user: # new: # email: 'E-mail to sign in.' # edit: # email: 'E-mail.' # hints: # defaults: # username: 'User name to sign in.' # password: 'No special characters, please.' # include_blanks: # defaults: # age: 'Rather not say' # prompts: # defaults: # age: 'Select your age' ================================================ FILE: config/locales/social_share_button.en.yml ================================================ en: social_share_button: share_to: Share to %{name} weibo: Sina Weibo twitter: Twitter facebook: Facebook douban: Douban qq: Qzone tqq: Tqq delicious: Delicious baidu: Baidu.com kaixin001: Kaixin001.com renren: Renren.com google_plus: Google+ google_bookmark: Google Bookmark tumblr: Tumblr plurk: Plurk pinterest: Pinterest email: Email ================================================ FILE: config/locales/social_share_button.zh-CN.yml ================================================ 'zh-CN': social_share_button: share_to: 分享到 %{name} weibo: 新浪微博 twitter: Twitter facebook: Facebook douban: 豆瓣 qq: QQ空间 tqq: 腾讯微博 delicious: Delicious baidu: 百度收藏 kaixin001: 开心网 renren: 人人网 google_plus: Google+ google_bookmark: Google 收藏 tumblr: Tumblr plurk: Plurk pinterest: Pinterest email: Email ================================================ FILE: config/locales/social_share_button.zh-TW.yml ================================================ 'zh-TW': social_share_button: share_to: 分享到 %{name} weibo: 新浪微博 twitter: Twitter facebook: Facebook douban: 豆瓣 qq: QQ空間 tqq: 腾讯微博 delicious: Delicious baidu: 百度收藏 kaixin001: 開心網 renren: 人人網 google_plus: Google+ google_bookmark: Google 收藏 tumblr: Tumblr plurk: 噗浪 pinterest: Pinterest email: Email ================================================ FILE: config/railscomposer.yml ================================================ # This application was generated with Rails Composer development: apps4: rails-devise-roles announcements: none dev_webserver: webrick prod_webserver: puma database: postgresql templates: haml tests: rspec continuous_testing: guard frontend: bootstrap3 email: gmail authentication: devise devise_modules: invitable omniauth_provider: authorization: roles form_builder: simple_form pages: about+users layouts: bare locale: none analytics: deployment: ban_spiders: github: local_env_file: false quiet_assets: true better_errors: true pry: false rvmrc: dashboard: upmin ================================================ FILE: config/routes.rb ================================================ Rails.application.routes.draw do resources :section_templates resources :sections resources :captures resources :devices resources :devices do post 'apply_template' => "devices#apply_template" resources :sections resources :units do resources :captures do post 'shift_left', to: 'captures#shift_left' post 'shift_right', to: 'captures#shift_right' end end end resources :units # resources :challenge_attempts, :except => [:edit, :update, :show, :destroy] # resources :challenges, :except => [:edit, :update, :destroy] # # resources :challenges, :except => [:edit, :update, :destroy] do # resources :challenge_attempts, :except => [:edit, :update, :show, :destroy] # end post 'generate', to: 'sections#generate' # get 'profiles', to: 'profile#index' get 'profile', to: 'profile#show' # get 'profile/:id', to: 'profile#show' get 'profile/edit' devise_for :users, :controllers => { registrations: 'registrations' } get '/about', to: 'dashboard#about' get '/temp', to: 'dashboard#temp' get '/contribute', to: 'dashboard#contribute' root 'devices#index' end ================================================ FILE: config/secrets.yml ================================================ # Be sure to restart your server when you modify this file. # Your secret key is used 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 attacks. # You can use `rake secret` to generate a secure secret key. # Make sure the secrets in this file are kept private # if you're sharing your code publicly. development: secret_key_base: c9e2ad75f8cd301df9c4c770ac47579464172d05d88ec7f0c5a050884b321adf843b2f33c3c0776689a8978cbf4f7963bd1d307870423be311ecedba4e191553 test: secret_key_base: 12759866d8d9b1206451b4f53c65b038140db7acbe1824bdb342ae83a02acdb3b377172e67eea09af9113bd2f9a7daf8634926d8317a6c9d3cb14cc5288919c8 # Do not keep production secrets in the repository, # instead read values from the environment. production: secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> ================================================ FILE: config.ru ================================================ # This file is used by Rack-based servers to start the application. require ::File.expand_path('../config/environment', __FILE__) run Rails.application ================================================ FILE: db/migrate/20160225071956_devise_create_users.rb ================================================ 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_token t.datetime :reset_password_sent_at ## Rememberable t.datetime :remember_created_at ## Trackable t.integer :sign_in_count, default: 0, null: false t.datetime :current_sign_in_at t.datetime :last_sign_in_at t.string :current_sign_in_ip t.string :last_sign_in_ip ## Confirmable # t.string :confirmation_token # t.datetime :confirmed_at # t.datetime :confirmation_sent_at # t.string :unconfirmed_email # Only if using reconfirmable ## Lockable # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts # t.string :unlock_token # Only if unlock strategy is :email or :both # t.datetime :locked_at t.timestamps null: false end add_index :users, :email, unique: true add_index :users, :reset_password_token, unique: true # add_index :users, :confirmation_token, unique: true # add_index :users, :unlock_token, unique: true end end ================================================ FILE: db/migrate/20160227015521_add_full_name_to_user.rb ================================================ class AddFullNameToUser < ActiveRecord::Migration def change add_column :users, :full_name, :string end end ================================================ FILE: db/migrate/20160918060423_create_devices.rb ================================================ class CreateDevices < ActiveRecord::Migration def change create_table :devices do |t| t.string :fcc_id t.string :baudrate t.float :frequency t.string :modulation t.string :encoding t.string :name t.text :notes t.timestamps null: false end end end ================================================ FILE: db/migrate/20160918060509_create_units.rb ================================================ class CreateUnits < ActiveRecord::Migration def change create_table :units do |t| t.integer :device_id t.string :name t.text :notes t.timestamps null: false end end end ================================================ FILE: db/migrate/20160918060631_create_captures.rb ================================================ class CreateCaptures < ActiveRecord::Migration def change create_table :captures do |t| t.integer :unit_id t.integer :device_id t.string :name t.text :notes t.text :binary t.text :original_binary t.timestamps null: false end end end ================================================ FILE: db/migrate/20170515023720_create_sections.rb ================================================ class CreateSections < ActiveRecord::Migration def change create_table :sections do |t| t.integer :device_id t.string :name t.string :notes t.integer :start_pos t.integer :end_pos t.string :colour t.timestamps null: false end end end ================================================ FILE: db/migrate/20170520033410_add_flip_pwm_to_devices.rb ================================================ class AddFlipPwmToDevices < ActiveRecord::Migration def change add_column :devices, :flip_pwm, :boolean end end ================================================ FILE: db/migrate/20170525084143_create_section_templates.rb ================================================ class CreateSectionTemplates < ActiveRecord::Migration def change create_table :section_templates do |t| t.string :name t.text :sections t.string :added_by t.timestamps null: false end end end ================================================ FILE: db/schema.rb ================================================ # encoding: UTF-8 # This file is auto-generated from the current state of the database. Instead # of editing this file, please use the migrations feature of Active Record to # incrementally modify your database, and then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your # database schema. If you need to create the application database on another # system, you should be using db:schema:load, not running all the migrations # from scratch. The latter is a flawed and unsustainable approach (the more migrations # you'll amass, the slower it'll run and the greater likelihood for issues). # # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 20170525084143) do create_table "captures", force: :cascade do |t| t.integer "unit_id" t.integer "device_id" t.string "name" t.text "notes" t.text "binary" t.text "original_binary" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "devices", force: :cascade do |t| t.string "fcc_id" t.string "baudrate" t.float "frequency" t.string "modulation" t.string "encoding" t.string "name" t.text "notes" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.boolean "flip_pwm" end create_table "section_templates", force: :cascade do |t| t.string "name" t.text "sections" t.string "added_by" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "sections", force: :cascade do |t| t.integer "device_id" t.string "name" t.string "notes" t.integer "start_pos" t.integer "end_pos" t.string "colour" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "units", force: :cascade do |t| t.integer "device_id" t.string "name" t.text "notes" t.datetime "created_at", null: false t.datetime "updated_at", null: false end create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "remember_created_at" t.integer "sign_in_count", default: 0, null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "full_name" end add_index "users", ["email"], name: "index_users_on_email", unique: true add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true end ================================================ FILE: db/seeds.rb ================================================ u = User.find_or_create_by(:email => "user@example.com") do |user| user.password = "password" user.password_confirmation = "password" user.full_name = "Nameless" end puts "Seeded user: #{u.full_name} (#{u.email})" puts "Seeding Section Template Library" Dir[File.join(Rails.root, 'db', 'template_seeds', '*.rb')].sort.each { |seed| load seed } puts "#{SectionTemplate.all.count} templates imported into library" ================================================ FILE: db/template_seeds/user_contributions.rb ================================================ SectionTemplate.find_or_create_by(:name => "Generic Wireless Alarm System") do |st| st.sections = "name,start_pos,end_pos,colour,notes Device ID,0,15,indigo,Changes between devices; static across functions. Must be device id. Recommend expressing this as an integer. Function Code,16,23,darkgreen,Static between devices as long as same button is pressed. Must be the button. Lets call it the function code. Recommend expressing this as an integer. Packet Terminator,24,24,gray,This bit is always 0 so far. We're just going to assume it's a packet terminator." st.added_by = 'nullwolf' end ================================================ FILE: lib/assets/.keep ================================================ ================================================ FILE: lib/tasks/.keep ================================================ ================================================ FILE: lib/tasks/account_seeds.rake ================================================ namespace :dspectrum do task :accounts => :environment do ##### # User #### puts "[!] Seeding user" u = User.create!(:email => "user@example.com", :full_name => "some guy", :password => "password", :password_confirmation => "password") end end ================================================ FILE: lib/tasks/custom_seed.rake ================================================ # lib/tasks/custom_seed.rake # rake db:custom_seed namespace :dspectrum do task :seed do puts puts puts "[*] Starting Seeds" puts puts "[*] Seeding Accounts" Rake::Task['dspectrum:accounts'].invoke puts end end ================================================ FILE: lib/templates/haml/scaffold/_form.html.haml ================================================ = simple_form_for(@<%= singular_table_name %>) do |f| = f.error_notification .form-inputs <%- attributes.each do |attribute| -%> = f.<%= attribute.reference? ? :association : :input %> :<%= attribute.name %> <%- end -%> .form-actions = f.button :submit ================================================ FILE: public/404.html ================================================ The page you were looking for doesn't exist (404)

The page you were looking for doesn't exist.

You may have mistyped the address or the page may have moved.

If you are the application owner check the logs for more information.

================================================ FILE: public/422.html ================================================ The change you wanted was rejected (422)

The change you wanted was rejected.

Maybe you tried to change something you didn't have access to.

If you are the application owner check the logs for more information.

================================================ FILE: public/500.html ================================================ We're sorry, but something went wrong (500)

We're sorry, but something went wrong.

If you are the application owner check the logs for more information.

================================================ FILE: public/robots.txt ================================================ # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file # # To ban all spiders from the entire site uncomment the next two lines: # User-agent: * # Disallow: / ================================================ FILE: spec/controllers/captures_controller_spec.rb ================================================ # require 'rails_helper' # # This spec was generated by rspec-rails when you ran the scaffold generator. # # It demonstrates how one might use RSpec to specify the controller code that # # was generated by Rails when you ran the scaffold generator. # # # # It assumes that the implementation code is generated by the rails scaffold # # generator. If you are using any extension libraries to generate different # # controller code, this generated spec may or may not pass. # # # # It only uses APIs available in rails and/or rspec-rails. There are a number # # of tools you can use to make these specs even more expressive, but we're # # sticking to rails and rspec-rails APIs to keep things simple and stable. # # # # Compared to earlier versions of this generator, there is very limited use of # # stubs and message expectations in this spec. Stubs are only used when there # # is no simpler way to get a handle on the object needed for the example. # # Message expectations are only used when there is no simpler way to specify # # that an instance is receiving a specific message. # RSpec.describe CapturesController, type: :controller do # # This should return the minimal set of attributes required to create a valid # # Capture. As you add validations to Capture, be sure to # # adjust the attributes here as well. # let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") # } # let(:invalid_attributes) { # skip("Add a hash of attributes invalid for your model") # } # # This should return the minimal set of values that should be in the session # # in order to pass any filters (e.g. authentication) defined in # # CapturesController. Be sure to keep this updated too. # let(:valid_session) { {} } # describe "GET #index" do # it "assigns all captures as @captures" do # capture = Capture.create! valid_attributes # get :index, {}, valid_session # expect(assigns(:captures)).to eq([capture]) # end # end # describe "GET #show" do # it "assigns the requested capture as @capture" do # capture = Capture.create! valid_attributes # get :show, {:id => capture.to_param}, valid_session # expect(assigns(:capture)).to eq(capture) # end # end # describe "GET #new" do # it "assigns a new capture as @capture" do # get :new, {}, valid_session # expect(assigns(:capture)).to be_a_new(Capture) # end # end # describe "GET #edit" do # it "assigns the requested capture as @capture" do # capture = Capture.create! valid_attributes # get :edit, {:id => capture.to_param}, valid_session # expect(assigns(:capture)).to eq(capture) # end # end # describe "POST #create" do # context "with valid params" do # it "creates a new Capture" do # expect { # post :create, {:capture => valid_attributes}, valid_session # }.to change(Capture, :count).by(1) # end # it "assigns a newly created capture as @capture" do # post :create, {:capture => valid_attributes}, valid_session # expect(assigns(:capture)).to be_a(Capture) # expect(assigns(:capture)).to be_persisted # end # it "redirects to the created capture" do # post :create, {:capture => valid_attributes}, valid_session # expect(response).to redirect_to(Capture.last) # end # end # context "with invalid params" do # it "assigns a newly created but unsaved capture as @capture" do # post :create, {:capture => invalid_attributes}, valid_session # expect(assigns(:capture)).to be_a_new(Capture) # end # it "re-renders the 'new' template" do # post :create, {:capture => invalid_attributes}, valid_session # expect(response).to render_template("new") # end # end # end # describe "PUT #update" do # context "with valid params" do # let(:new_attributes) { # skip("Add a hash of attributes valid for your model") # } # it "updates the requested capture" do # capture = Capture.create! valid_attributes # put :update, {:id => capture.to_param, :capture => new_attributes}, valid_session # capture.reload # skip("Add assertions for updated state") # end # it "assigns the requested capture as @capture" do # capture = Capture.create! valid_attributes # put :update, {:id => capture.to_param, :capture => valid_attributes}, valid_session # expect(assigns(:capture)).to eq(capture) # end # it "redirects to the capture" do # capture = Capture.create! valid_attributes # put :update, {:id => capture.to_param, :capture => valid_attributes}, valid_session # expect(response).to redirect_to(capture) # end # end # context "with invalid params" do # it "assigns the capture as @capture" do # capture = Capture.create! valid_attributes # put :update, {:id => capture.to_param, :capture => invalid_attributes}, valid_session # expect(assigns(:capture)).to eq(capture) # end # it "re-renders the 'edit' template" do # capture = Capture.create! valid_attributes # put :update, {:id => capture.to_param, :capture => invalid_attributes}, valid_session # expect(response).to render_template("edit") # end # end # end # describe "DELETE #destroy" do # it "destroys the requested capture" do # capture = Capture.create! valid_attributes # expect { # delete :destroy, {:id => capture.to_param}, valid_session # }.to change(Capture, :count).by(-1) # end # it "redirects to the captures list" do # capture = Capture.create! valid_attributes # delete :destroy, {:id => capture.to_param}, valid_session # expect(response).to redirect_to(captures_url) # end # end # end ================================================ FILE: spec/controllers/devices_controller_spec.rb ================================================ # require 'rails_helper' # # This spec was generated by rspec-rails when you ran the scaffold generator. # # It demonstrates how one might use RSpec to specify the controller code that # # was generated by Rails when you ran the scaffold generator. # # # # It assumes that the implementation code is generated by the rails scaffold # # generator. If you are using any extension libraries to generate different # # controller code, this generated spec may or may not pass. # # # # It only uses APIs available in rails and/or rspec-rails. There are a number # # of tools you can use to make these specs even more expressive, but we're # # sticking to rails and rspec-rails APIs to keep things simple and stable. # # # # Compared to earlier versions of this generator, there is very limited use of # # stubs and message expectations in this spec. Stubs are only used when there # # is no simpler way to get a handle on the object needed for the example. # # Message expectations are only used when there is no simpler way to specify # # that an instance is receiving a specific message. # RSpec.describe DevicesController, type: :controller do # # This should return the minimal set of attributes required to create a valid # # Device. As you add validations to Device, be sure to # # adjust the attributes here as well. # let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") # } # let(:invalid_attributes) { # skip("Add a hash of attributes invalid for your model") # } # # This should return the minimal set of values that should be in the session # # in order to pass any filters (e.g. authentication) defined in # # DevicesController. Be sure to keep this updated too. # let(:valid_session) { {} } # describe "GET #index" do # it "assigns all devices as @devices" do # device = Device.create! valid_attributes # get :index, {}, valid_session # expect(assigns(:devices)).to eq([device]) # end # end # describe "GET #show" do # it "assigns the requested device as @device" do # device = Device.create! valid_attributes # get :show, {:id => device.to_param}, valid_session # expect(assigns(:device)).to eq(device) # end # end # describe "GET #new" do # it "assigns a new device as @device" do # get :new, {}, valid_session # expect(assigns(:device)).to be_a_new(Device) # end # end # describe "GET #edit" do # it "assigns the requested device as @device" do # device = Device.create! valid_attributes # get :edit, {:id => device.to_param}, valid_session # expect(assigns(:device)).to eq(device) # end # end # describe "POST #create" do # context "with valid params" do # it "creates a new Device" do # expect { # post :create, {:device => valid_attributes}, valid_session # }.to change(Device, :count).by(1) # end # it "assigns a newly created device as @device" do # post :create, {:device => valid_attributes}, valid_session # expect(assigns(:device)).to be_a(Device) # expect(assigns(:device)).to be_persisted # end # it "redirects to the created device" do # post :create, {:device => valid_attributes}, valid_session # expect(response).to redirect_to(Device.last) # end # end # context "with invalid params" do # it "assigns a newly created but unsaved device as @device" do # post :create, {:device => invalid_attributes}, valid_session # expect(assigns(:device)).to be_a_new(Device) # end # it "re-renders the 'new' template" do # post :create, {:device => invalid_attributes}, valid_session # expect(response).to render_template("new") # end # end # end # describe "PUT #update" do # context "with valid params" do # let(:new_attributes) { # skip("Add a hash of attributes valid for your model") # } # it "updates the requested device" do # device = Device.create! valid_attributes # put :update, {:id => device.to_param, :device => new_attributes}, valid_session # device.reload # skip("Add assertions for updated state") # end # it "assigns the requested device as @device" do # device = Device.create! valid_attributes # put :update, {:id => device.to_param, :device => valid_attributes}, valid_session # expect(assigns(:device)).to eq(device) # end # it "redirects to the device" do # device = Device.create! valid_attributes # put :update, {:id => device.to_param, :device => valid_attributes}, valid_session # expect(response).to redirect_to(device) # end # end # context "with invalid params" do # it "assigns the device as @device" do # device = Device.create! valid_attributes # put :update, {:id => device.to_param, :device => invalid_attributes}, valid_session # expect(assigns(:device)).to eq(device) # end # it "re-renders the 'edit' template" do # device = Device.create! valid_attributes # put :update, {:id => device.to_param, :device => invalid_attributes}, valid_session # expect(response).to render_template("edit") # end # end # end # describe "DELETE #destroy" do # it "destroys the requested device" do # device = Device.create! valid_attributes # expect { # delete :destroy, {:id => device.to_param}, valid_session # }.to change(Device, :count).by(-1) # end # it "redirects to the devices list" do # device = Device.create! valid_attributes # delete :destroy, {:id => device.to_param}, valid_session # expect(response).to redirect_to(devices_url) # end # end # end ================================================ FILE: spec/controllers/section_templates_controller_spec.rb ================================================ # require 'rails_helper' # # This spec was generated by rspec-rails when you ran the scaffold generator. # # It demonstrates how one might use RSpec to specify the controller code that # # was generated by Rails when you ran the scaffold generator. # # # # It assumes that the implementation code is generated by the rails scaffold # # generator. If you are using any extension libraries to generate different # # controller code, this generated spec may or may not pass. # # # # It only uses APIs available in rails and/or rspec-rails. There are a number # # of tools you can use to make these specs even more expressive, but we're # # sticking to rails and rspec-rails APIs to keep things simple and stable. # # # # Compared to earlier versions of this generator, there is very limited use of # # stubs and message expectations in this spec. Stubs are only used when there # # is no simpler way to get a handle on the object needed for the example. # # Message expectations are only used when there is no simpler way to specify # # that an instance is receiving a specific message. # RSpec.describe SectionTemplatesController, type: :controller do # # This should return the minimal set of attributes required to create a valid # # SectionTemplate. As you add validations to SectionTemplate, be sure to # # adjust the attributes here as well. # let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") # } # let(:invalid_attributes) { # skip("Add a hash of attributes invalid for your model") # } # # This should return the minimal set of values that should be in the session # # in order to pass any filters (e.g. authentication) defined in # # SectionTemplatesController. Be sure to keep this updated too. # let(:valid_session) { {} } # describe "GET #index" do # it "assigns all section_templates as @section_templates" do # section_template = SectionTemplate.create! valid_attributes # get :index, {}, valid_session # expect(assigns(:section_templates)).to eq([section_template]) # end # end # describe "GET #show" do # it "assigns the requested section_template as @section_template" do # section_template = SectionTemplate.create! valid_attributes # get :show, {:id => section_template.to_param}, valid_session # expect(assigns(:section_template)).to eq(section_template) # end # end # describe "GET #new" do # it "assigns a new section_template as @section_template" do # get :new, {}, valid_session # expect(assigns(:section_template)).to be_a_new(SectionTemplate) # end # end # describe "GET #edit" do # it "assigns the requested section_template as @section_template" do # section_template = SectionTemplate.create! valid_attributes # get :edit, {:id => section_template.to_param}, valid_session # expect(assigns(:section_template)).to eq(section_template) # end # end # describe "POST #create" do # context "with valid params" do # it "creates a new SectionTemplate" do # expect { # post :create, {:section_template => valid_attributes}, valid_session # }.to change(SectionTemplate, :count).by(1) # end # it "assigns a newly created section_template as @section_template" do # post :create, {:section_template => valid_attributes}, valid_session # expect(assigns(:section_template)).to be_a(SectionTemplate) # expect(assigns(:section_template)).to be_persisted # end # it "redirects to the created section_template" do # post :create, {:section_template => valid_attributes}, valid_session # expect(response).to redirect_to(SectionTemplate.last) # end # end # context "with invalid params" do # it "assigns a newly created but unsaved section_template as @section_template" do # post :create, {:section_template => invalid_attributes}, valid_session # expect(assigns(:section_template)).to be_a_new(SectionTemplate) # end # it "re-renders the 'new' template" do # post :create, {:section_template => invalid_attributes}, valid_session # expect(response).to render_template("new") # end # end # end # describe "PUT #update" do # context "with valid params" do # let(:new_attributes) { # skip("Add a hash of attributes valid for your model") # } # it "updates the requested section_template" do # section_template = SectionTemplate.create! valid_attributes # put :update, {:id => section_template.to_param, :section_template => new_attributes}, valid_session # section_template.reload # skip("Add assertions for updated state") # end # it "assigns the requested section_template as @section_template" do # section_template = SectionTemplate.create! valid_attributes # put :update, {:id => section_template.to_param, :section_template => valid_attributes}, valid_session # expect(assigns(:section_template)).to eq(section_template) # end # it "redirects to the section_template" do # section_template = SectionTemplate.create! valid_attributes # put :update, {:id => section_template.to_param, :section_template => valid_attributes}, valid_session # expect(response).to redirect_to(section_template) # end # end # context "with invalid params" do # it "assigns the section_template as @section_template" do # section_template = SectionTemplate.create! valid_attributes # put :update, {:id => section_template.to_param, :section_template => invalid_attributes}, valid_session # expect(assigns(:section_template)).to eq(section_template) # end # it "re-renders the 'edit' template" do # section_template = SectionTemplate.create! valid_attributes # put :update, {:id => section_template.to_param, :section_template => invalid_attributes}, valid_session # expect(response).to render_template("edit") # end # end # end # describe "DELETE #destroy" do # it "destroys the requested section_template" do # section_template = SectionTemplate.create! valid_attributes # expect { # delete :destroy, {:id => section_template.to_param}, valid_session # }.to change(SectionTemplate, :count).by(-1) # end # it "redirects to the section_templates list" do # section_template = SectionTemplate.create! valid_attributes # delete :destroy, {:id => section_template.to_param}, valid_session # expect(response).to redirect_to(section_templates_url) # end # end # end ================================================ FILE: spec/controllers/sections_controller_spec.rb ================================================ # require 'rails_helper' # # This spec was generated by rspec-rails when you ran the scaffold generator. # # It demonstrates how one might use RSpec to specify the controller code that # # was generated by Rails when you ran the scaffold generator. # # # # It assumes that the implementation code is generated by the rails scaffold # # generator. If you are using any extension libraries to generate different # # controller code, this generated spec may or may not pass. # # # # It only uses APIs available in rails and/or rspec-rails. There are a number # # of tools you can use to make these specs even more expressive, but we're # # sticking to rails and rspec-rails APIs to keep things simple and stable. # # # # Compared to earlier versions of this generator, there is very limited use of # # stubs and message expectations in this spec. Stubs are only used when there # # is no simpler way to get a handle on the object needed for the example. # # Message expectations are only used when there is no simpler way to specify # # that an instance is receiving a specific message. # RSpec.describe SectionsController, type: :controller do # # This should return the minimal set of attributes required to create a valid # # Section. As you add validations to Section, be sure to # # adjust the attributes here as well. # let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") # } # let(:invalid_attributes) { # skip("Add a hash of attributes invalid for your model") # } # # This should return the minimal set of values that should be in the session # # in order to pass any filters (e.g. authentication) defined in # # SectionsController. Be sure to keep this updated too. # let(:valid_session) { {} } # describe "GET #index" do # it "assigns all sections as @sections" do # section = Section.create! valid_attributes # get :index, {}, valid_session # expect(assigns(:sections)).to eq([section]) # end # end # describe "GET #show" do # it "assigns the requested section as @section" do # section = Section.create! valid_attributes # get :show, {:id => section.to_param}, valid_session # expect(assigns(:section)).to eq(section) # end # end # describe "GET #new" do # it "assigns a new section as @section" do # get :new, {}, valid_session # expect(assigns(:section)).to be_a_new(Section) # end # end # describe "GET #edit" do # it "assigns the requested section as @section" do # section = Section.create! valid_attributes # get :edit, {:id => section.to_param}, valid_session # expect(assigns(:section)).to eq(section) # end # end # describe "POST #create" do # context "with valid params" do # it "creates a new Section" do # expect { # post :create, {:section => valid_attributes}, valid_session # }.to change(Section, :count).by(1) # end # it "assigns a newly created section as @section" do # post :create, {:section => valid_attributes}, valid_session # expect(assigns(:section)).to be_a(Section) # expect(assigns(:section)).to be_persisted # end # it "redirects to the created section" do # post :create, {:section => valid_attributes}, valid_session # expect(response).to redirect_to(Section.last) # end # end # context "with invalid params" do # it "assigns a newly created but unsaved section as @section" do # post :create, {:section => invalid_attributes}, valid_session # expect(assigns(:section)).to be_a_new(Section) # end # it "re-renders the 'new' template" do # post :create, {:section => invalid_attributes}, valid_session # expect(response).to render_template("new") # end # end # end # describe "PUT #update" do # context "with valid params" do # let(:new_attributes) { # skip("Add a hash of attributes valid for your model") # } # it "updates the requested section" do # section = Section.create! valid_attributes # put :update, {:id => section.to_param, :section => new_attributes}, valid_session # section.reload # skip("Add assertions for updated state") # end # it "assigns the requested section as @section" do # section = Section.create! valid_attributes # put :update, {:id => section.to_param, :section => valid_attributes}, valid_session # expect(assigns(:section)).to eq(section) # end # it "redirects to the section" do # section = Section.create! valid_attributes # put :update, {:id => section.to_param, :section => valid_attributes}, valid_session # expect(response).to redirect_to(section) # end # end # context "with invalid params" do # it "assigns the section as @section" do # section = Section.create! valid_attributes # put :update, {:id => section.to_param, :section => invalid_attributes}, valid_session # expect(assigns(:section)).to eq(section) # end # it "re-renders the 'edit' template" do # section = Section.create! valid_attributes # put :update, {:id => section.to_param, :section => invalid_attributes}, valid_session # expect(response).to render_template("edit") # end # end # end # describe "DELETE #destroy" do # it "destroys the requested section" do # section = Section.create! valid_attributes # expect { # delete :destroy, {:id => section.to_param}, valid_session # }.to change(Section, :count).by(-1) # end # it "redirects to the sections list" do # section = Section.create! valid_attributes # delete :destroy, {:id => section.to_param}, valid_session # expect(response).to redirect_to(sections_url) # end # end # end ================================================ FILE: spec/controllers/units_controller_spec.rb ================================================ # require 'rails_helper' # # This spec was generated by rspec-rails when you ran the scaffold generator. # # It demonstrates how one might use RSpec to specify the controller code that # # was generated by Rails when you ran the scaffold generator. # # # # It assumes that the implementation code is generated by the rails scaffold # # generator. If you are using any extension libraries to generate different # # controller code, this generated spec may or may not pass. # # # # It only uses APIs available in rails and/or rspec-rails. There are a number # # of tools you can use to make these specs even more expressive, but we're # # sticking to rails and rspec-rails APIs to keep things simple and stable. # # # # Compared to earlier versions of this generator, there is very limited use of # # stubs and message expectations in this spec. Stubs are only used when there # # is no simpler way to get a handle on the object needed for the example. # # Message expectations are only used when there is no simpler way to specify # # that an instance is receiving a specific message. # RSpec.describe UnitsController, type: :controller do # # This should return the minimal set of attributes required to create a valid # # Unit. As you add validations to Unit, be sure to # # adjust the attributes here as well. # let(:valid_attributes) { # skip("Add a hash of attributes valid for your model") # } # let(:invalid_attributes) { # skip("Add a hash of attributes invalid for your model") # } # # This should return the minimal set of values that should be in the session # # in order to pass any filters (e.g. authentication) defined in # # UnitsController. Be sure to keep this updated too. # let(:valid_session) { {} } # describe "GET #index" do # it "assigns all units as @units" do # unit = Unit.create! valid_attributes # get :index, {}, valid_session # expect(assigns(:units)).to eq([unit]) # end # end # describe "GET #show" do # it "assigns the requested unit as @unit" do # unit = Unit.create! valid_attributes # get :show, {:id => unit.to_param}, valid_session # expect(assigns(:unit)).to eq(unit) # end # end # describe "GET #new" do # it "assigns a new unit as @unit" do # get :new, {}, valid_session # expect(assigns(:unit)).to be_a_new(Unit) # end # end # describe "GET #edit" do # it "assigns the requested unit as @unit" do # unit = Unit.create! valid_attributes # get :edit, {:id => unit.to_param}, valid_session # expect(assigns(:unit)).to eq(unit) # end # end # describe "POST #create" do # context "with valid params" do # it "creates a new Unit" do # expect { # post :create, {:unit => valid_attributes}, valid_session # }.to change(Unit, :count).by(1) # end # it "assigns a newly created unit as @unit" do # post :create, {:unit => valid_attributes}, valid_session # expect(assigns(:unit)).to be_a(Unit) # expect(assigns(:unit)).to be_persisted # end # it "redirects to the created unit" do # post :create, {:unit => valid_attributes}, valid_session # expect(response).to redirect_to(Unit.last) # end # end # context "with invalid params" do # it "assigns a newly created but unsaved unit as @unit" do # post :create, {:unit => invalid_attributes}, valid_session # expect(assigns(:unit)).to be_a_new(Unit) # end # it "re-renders the 'new' template" do # post :create, {:unit => invalid_attributes}, valid_session # expect(response).to render_template("new") # end # end # end # describe "PUT #update" do # context "with valid params" do # let(:new_attributes) { # skip("Add a hash of attributes valid for your model") # } # it "updates the requested unit" do # unit = Unit.create! valid_attributes # put :update, {:id => unit.to_param, :unit => new_attributes}, valid_session # unit.reload # skip("Add assertions for updated state") # end # it "assigns the requested unit as @unit" do # unit = Unit.create! valid_attributes # put :update, {:id => unit.to_param, :unit => valid_attributes}, valid_session # expect(assigns(:unit)).to eq(unit) # end # it "redirects to the unit" do # unit = Unit.create! valid_attributes # put :update, {:id => unit.to_param, :unit => valid_attributes}, valid_session # expect(response).to redirect_to(unit) # end # end # context "with invalid params" do # it "assigns the unit as @unit" do # unit = Unit.create! valid_attributes # put :update, {:id => unit.to_param, :unit => invalid_attributes}, valid_session # expect(assigns(:unit)).to eq(unit) # end # it "re-renders the 'edit' template" do # unit = Unit.create! valid_attributes # put :update, {:id => unit.to_param, :unit => invalid_attributes}, valid_session # expect(response).to render_template("edit") # end # end # end # describe "DELETE #destroy" do # it "destroys the requested unit" do # unit = Unit.create! valid_attributes # expect { # delete :destroy, {:id => unit.to_param}, valid_session # }.to change(Unit, :count).by(-1) # end # it "redirects to the units list" do # unit = Unit.create! valid_attributes # delete :destroy, {:id => unit.to_param}, valid_session # expect(response).to redirect_to(units_url) # end # end # end ================================================ FILE: spec/factories/captures.rb ================================================ FactoryGirl.define do factory :capture do unit_id 1 device_id 1 name "MyString" notes "MyText" binary "MyText" original_binary "MyText" end end ================================================ FILE: spec/factories/devices.rb ================================================ FactoryGirl.define do factory :device do fcc_id "MyString" baudrate "MyString" frequency 1.5 modulation "MyString" encoding "MyString" name "MyString" notes "MyText" end end ================================================ FILE: spec/factories/section_templates.rb ================================================ FactoryGirl.define do factory :section_template do name "MyString" sections "MyText" added_by "MyString" end end ================================================ FILE: spec/factories/sections.rb ================================================ FactoryGirl.define do factory :section do device_id 1 name "MyString" notes "MyString" start_pos 1 end_pos 1 colour "MyString" end end ================================================ FILE: spec/factories/units.rb ================================================ FactoryGirl.define do factory :unit do device_id 1 name "MyString" notes "MyText" end end ================================================ FILE: spec/helpers/captures_helper_spec.rb ================================================ require 'rails_helper' # Specs in this file have access to a helper object that includes # the CapturesHelper. For example: # # describe CapturesHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe CapturesHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/helpers/devices_helper_spec.rb ================================================ require 'rails_helper' # Specs in this file have access to a helper object that includes # the DevicesHelper. For example: # # describe DevicesHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe DevicesHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/helpers/section_templates_helper_spec.rb ================================================ require 'rails_helper' # Specs in this file have access to a helper object that includes # the SectionTemplatesHelper. For example: # # describe SectionTemplatesHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe SectionTemplatesHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/helpers/sections_helper_spec.rb ================================================ require 'rails_helper' # Specs in this file have access to a helper object that includes # the SectionsHelper. For example: # # describe SectionsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe SectionsHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/helpers/units_helper_spec.rb ================================================ require 'rails_helper' # Specs in this file have access to a helper object that includes # the UnitsHelper. For example: # # describe UnitsHelper do # describe "string concat" do # it "concats two strings with spaces" do # expect(helper.concat_strings("this","that")).to eq("this that") # end # end # end RSpec.describe UnitsHelper, type: :helper do pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/models/capture_spec.rb ================================================ require 'rails_helper' RSpec.describe Capture, type: :model do subject { described_class.new } ###################### # General ###################### it "flips the binary" do expect(subject.flip("1111000011110000")).to eq("0000111100001111") end it "transforms binary to hexcode" it "transforms arbitrarily supplied binary to hexcode" it "transforms binary to ascii" it "transforms arbitrarily supplied binary to ascii" describe "Associations" do it { should belong_to(:device) } it { should belong_to(:unit) } end ###################### # PWM 6633 ###################### describe "Invalid PWM 66/33" do subject { described_class.new(binary: "1100100011001000",original_binary: "1100100011001000") } it "is reported as invalid" do expect(subject.valid_pwm?).to eq(false) end end describe "Valid PWM 66/33" do let(:device) { Device.create(name: "name") } let(:unit) { Unit.create(name: "name", device_id: device.id) } subject { described_class.new(binary: "110100110100",original_binary: "110100110100", device_id: device.id, unit_id: unit.id) } it "is reported as valid" do expect(subject.valid_pwm?).to eq(true) end it "decodes PWM 66/33" do expect(subject.pwm_decode).to eq("1010") end end describe "Incomplete PWM 66/33" do subject { described_class.new(binary: "1101001101",original_binary: "1101001101") } it "is padded with 0s and saved" do expect(subject.valid_pwm?).to eq(true) end end describe "Incomplete PWM 66/33" do subject { described_class.new(binary: "1101001101",original_binary: "1101001101") } it "is padded with 0s and saved with message for human on first reload" do expect(subject.valid_pwm?(true)).to eq("This was valid PWM but significant whitespace at the end was missed by you. I have added 0s to the end and saved the change.") end end describe "Incomplete PWM 66/33" do subject { described_class.new(binary: "1101001101",original_binary: "1101001101") } it "should return as valid on second reload" do subject.valid_pwm?(true) expect(subject.valid_pwm?(true)).to eq("Yes") end end describe "Shifted Dr Nick Edge case PWM 66/33" do subject { described_class.new(binary: "0110100110100",original_binary: "0110100110100") } it "should detect and correct shift" do expect(subject.valid_pwm?(true)).to eq("This is likely to be a PWM capture but there was an unexpected '0' at the beginning which suggests the last cell was also chopped off. It is STRONGLY recommended that you re-create this capture but this time start one cell later, and add an extra cell at the end even if it is empty. This is an edge-case that seems to occur rarely with rtl-sdr captures. We don't know why exactly.") end end ###################### # PWM 7725 ###################### describe "Invalid PWM 75/25" do subject { described_class.new(binary: "110100110100",original_binary: "110100110100") } it "is reported as invalid" do expect(subject.valid_pwm_7525?).to eq(false) end end describe "Valid PWM 75/25" do let(:device) { Device.create(name: "name") } let(:unit) { Unit.create(name: "name", device_id: device.id) } subject { described_class.new(binary: "1110100011101000",original_binary: "1110100011101000", device_id: device.id, unit_id: unit.id) } it "is reported as valid" do expect(subject.valid_pwm_7525?).to eq(true) end it "decodes PWM 75/25" do expect(subject.pwm_decode_7525).to eq("1010") end end describe "Incomplete PWM 75/25" do subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") } it "is padded with 0s and saved" do expect(subject.valid_pwm_7525?).to eq(true) end end describe "Incomplete PWM 75/25" do subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") } it "is padded with 0s and saved with message for human on first reload" do expect(subject.valid_pwm_7525?(true)).to eq("This was valid PWM but significant whitespace at the end was missed by you. I have added 0s to the end and saved the change.") end end describe "Incomplete PWM 75/25" do subject { described_class.new(binary: "11101000111010",original_binary: "11101000111010") } it "should return as valid on second reload" do subject.valid_pwm_7525?(true) expect(subject.valid_pwm_7525?(true)).to eq("Yes") end end describe "Shifted Dr Nick Edge case PWM 75/25" do subject { described_class.new(binary: "01000111010001110",original_binary: "01000111010001110") } it "should detect and correct shift" do expect(subject.valid_pwm_7525?(true)).to eq("This is likely to be a PWM capture but there was an unexpected '0' at the beginning which suggests the last cell was also chopped off. It is STRONGLY recommended that you re-create this capture but this time start one cell later, and add an extra cell at the end even if it is empty. This is an edge-case that seems to occur rarely with rtl-sdr captures. We don't know why exactly.") end end ###################### # Manchester ###################### describe "well-aligned, valid, manchester" do subject { described_class.new(binary: "1010010110100101",original_binary: "1010010110100101") } it "is reported as valid" do expect(subject.valid_manchester?).to eq(true) end end describe "off-by-one/poorly aligned, valid, manchester" do subject { described_class.new(binary: "101011001101001",original_binary: "101011001101001") } it "is reported as valid" do expect(subject.valid_manchester?(true)).to eq("\n If you add a 0 at the start it is... re-capture the signal with an empty cell at the beginning") end end describe "manchester" do subject { described_class.new(binary: "1010010110100101",original_binary: "1010010110100101") } it "is decoded" do expect(subject.manchester_decode).to eq("11001100") end end end ================================================ FILE: spec/models/device_spec.rb ================================================ require 'rails_helper' RSpec.describe Device, type: :model do ###################### # General ###################### describe "Associations" do it { should have_many(:units) } it { should have_many(:captures) } it { should have_many(:sections) } end describe "format frequency" do subject { described_class.create(name:'device name', frequency: 433.0) } it "correctly formats 433 mhz" do expect(subject.format_frequency).to eq("433000000") end end describe "format frequency" do subject { described_class.create(name:'device name', frequency: 1433.0) } it "correctly formats 1.433 ghz" do expect(subject.format_frequency).to eq("1433000000") end end describe "format frequency" do subject { described_class.create(name:'device name', frequency: 43.0) } it "correctly formats 43 mhz" do expect(subject.format_frequency).to eq("43000000") end end describe "sharing templates" do subject { described_class.create(name:'device name') } it "correctly exports sections as csv" do section = Section.create(name: "name", start_pos: 0, end_pos: 15, colour: 'blue', notes: 'none', device_id: subject.id) subject.sections_to_csv('template','nobody') expect(`cat #{Rails.root.join('mcs', 'contribution.md').to_s}`).to eq("```ruby\nSectionTemplate.find_or_create_by(:name => \"template\") do |st|\n st.sections = \"name,start_pos,end_pos,colour,notes\nname,0,15,blue,none\n\" \n st.added_by = 'nobody' \nend\n```\n") end end ###################### # Update Modulation ###################### describe "update modulation" do subject { described_class.create(name:'device name') } it "correctly updates as PWM 6633" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "110100100",original_binary: "110100100", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("PWM") expect(subject.encoding).to eq("66/33") end end describe "update modulation" do subject { described_class.create(name:'device name') } it "correctly updates as PWM 7525" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "1110100011101000",original_binary: "1110100011101000", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("PWM") expect(subject.encoding).to eq("75/25") end end describe "update modulation" do subject { described_class.create(name:'device name') } it "correctly updates as Manchester" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("OOK") expect(subject.encoding).to eq("Manchester") end end describe "update modulation" do subject { described_class.create(name:'device name') } it "correctly updates as OOK if nothing else" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "1111001010111",original_binary: "1111001010111", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("OOK") expect(subject.encoding).to eq("n/a") end end describe "update modulation" do subject { described_class.create(name:'device name', modulation: "OOK", encoding: "n/a") } it "is run if encoding and modulation match our OOK update" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("OOK") expect(subject.encoding).to eq("Manchester") end end describe "update modulation" do subject { described_class.create(name:'device name', modulation: "ASK", encoding: "Foobar") } it "should not run if encoding and modulation are custom" do unit = Unit.create(name: "name", device_id: subject.id) capture = Capture.create(binary: "10100101",original_binary: "10100101", name: "name", device_id: subject.id, unit_id: unit.id) subject.update_modulation expect(subject.modulation).to eq("ASK") expect(subject.encoding).to eq("Foobar") end end end ================================================ FILE: spec/models/section_spec.rb ================================================ require 'rails_helper' RSpec.describe Section, type: :model do describe "Associations" do it { should belong_to(:device) } end describe "section range" do subject { described_class.create(name:'section name', start_pos: 0, end_pos: 16) } it "correctly returns range object" do expect(subject.section_range).to eq(0..16) end end end ================================================ FILE: spec/models/section_template_spec.rb ================================================ require 'rails_helper' RSpec.describe SectionTemplate, type: :model do #pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/models/unit_spec.rb ================================================ require 'rails_helper' RSpec.describe Unit, type: :model do #pending "add some examples to (or delete) #{__FILE__}" end ================================================ FILE: spec/rails_helper.rb ================================================ # This file is copied to spec/ when you run 'rails generate rspec:install' ENV['RAILS_ENV'] ||= 'test' require File.expand_path('../../config/environment', __FILE__) # Prevent database truncation if the environment is production abort("The Rails environment is running in production mode!") if Rails.env.production? require 'spec_helper' require 'rspec/rails' # Add additional requires below this line. Rails is not loaded until this point! # Requires supporting ruby files with custom matchers and macros, etc, in # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are # run as spec files by default. This means that files in spec/support that end # in _spec.rb will both be required and run as specs, causing the specs to be # run twice. It is recommended that you do not name files matching this glob to # end with _spec.rb. You can configure this pattern with the --pattern # option on the command line or in ~/.rspec, .rspec or `.rspec-local`. # # The following line is provided for convenience purposes. It has the downside # of increasing the boot-up time by auto-requiring all files in the support # directory. Alternatively, in the individual `*_spec.rb` files, manually # require only the support files necessary. # # Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f } # Checks for pending migration and applies them before tests are run. # If you are not using ActiveRecord, you can remove this line. ActiveRecord::Migration.maintain_test_schema! RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" # If you're not using ActiveRecord, or you'd prefer not to run each of your # examples within a transaction, remove the following line or assign false # instead of true. config.use_transactional_fixtures = true # RSpec Rails can automatically mix in different behaviours to your tests # based on their file location, for example enabling you to call `get` and # `post` in specs under `spec/controllers`. # # You can disable this behaviour by removing the line below, and instead # explicitly tag your specs with their type, e.g.: # # RSpec.describe UsersController, :type => :controller do # # ... # end # # The different available types are documented in the features, such as in # https://relishapp.com/rspec/rspec-rails/docs config.infer_spec_type_from_file_location! # Filter lines from Rails gems in backtraces. config.filter_rails_from_backtrace! # arbitrary gems may also be filtered via: # config.filter_gems_from_backtrace("gem name") end ================================================ FILE: spec/requests/captures_spec.rb ================================================ require 'rails_helper' RSpec.describe "Captures", type: :request do describe "GET /captures without authenticating" do it "redirects the user" do get captures_path expect(response).to have_http_status(302) end end end ================================================ FILE: spec/requests/devices_spec.rb ================================================ require 'rails_helper' RSpec.describe "Devices", type: :request do describe "GET /devices without authenticating" do it "redirects the user" do get devices_path expect(response).to have_http_status(302) end end end ================================================ FILE: spec/requests/section_templates_spec.rb ================================================ require 'rails_helper' RSpec.describe "SectionTemplates", type: :request do describe "GET /section_templates without authenticating" do it "redirects the user" do get section_templates_path expect(response).to have_http_status(302) end end end ================================================ FILE: spec/requests/sections_spec.rb ================================================ require 'rails_helper' RSpec.describe "Sections", type: :request do describe "GET /sections without authenticating" do it "redirects the user" do get sections_path expect(response).to have_http_status(302) end end end ================================================ FILE: spec/requests/units_spec.rb ================================================ require 'rails_helper' RSpec.describe "Units", type: :request do describe "GET /units without authenticating" do it "redirects the user" do get units_path expect(response).to have_http_status(302) end end end ================================================ FILE: spec/routing/captures_routing_spec.rb ================================================ require "rails_helper" RSpec.describe CapturesController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/captures").to route_to("captures#index") end it "routes to #new" do expect(:get => "/captures/new").to route_to("captures#new") end it "routes to #show" do expect(:get => "/captures/1").to route_to("captures#show", :id => "1") end it "routes to #edit" do expect(:get => "/captures/1/edit").to route_to("captures#edit", :id => "1") end it "routes to #create" do expect(:post => "/captures").to route_to("captures#create") end it "routes to #update via PUT" do expect(:put => "/captures/1").to route_to("captures#update", :id => "1") end it "routes to #update via PATCH" do expect(:patch => "/captures/1").to route_to("captures#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/captures/1").to route_to("captures#destroy", :id => "1") end end end ================================================ FILE: spec/routing/devices_routing_spec.rb ================================================ require "rails_helper" RSpec.describe DevicesController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/devices").to route_to("devices#index") end it "routes to #new" do expect(:get => "/devices/new").to route_to("devices#new") end it "routes to #show" do expect(:get => "/devices/1").to route_to("devices#show", :id => "1") end it "routes to #edit" do expect(:get => "/devices/1/edit").to route_to("devices#edit", :id => "1") end it "routes to #create" do expect(:post => "/devices").to route_to("devices#create") end it "routes to #update via PUT" do expect(:put => "/devices/1").to route_to("devices#update", :id => "1") end it "routes to #update via PATCH" do expect(:patch => "/devices/1").to route_to("devices#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/devices/1").to route_to("devices#destroy", :id => "1") end end end ================================================ FILE: spec/routing/section_templates_routing_spec.rb ================================================ require "rails_helper" RSpec.describe SectionTemplatesController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/section_templates").to route_to("section_templates#index") end it "routes to #new" do expect(:get => "/section_templates/new").to route_to("section_templates#new") end it "routes to #show" do expect(:get => "/section_templates/1").to route_to("section_templates#show", :id => "1") end it "routes to #edit" do expect(:get => "/section_templates/1/edit").to route_to("section_templates#edit", :id => "1") end it "routes to #create" do expect(:post => "/section_templates").to route_to("section_templates#create") end it "routes to #update via PUT" do expect(:put => "/section_templates/1").to route_to("section_templates#update", :id => "1") end it "routes to #update via PATCH" do expect(:patch => "/section_templates/1").to route_to("section_templates#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/section_templates/1").to route_to("section_templates#destroy", :id => "1") end end end ================================================ FILE: spec/routing/sections_routing_spec.rb ================================================ require "rails_helper" RSpec.describe SectionsController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/sections").to route_to("sections#index") end it "routes to #new" do expect(:get => "/sections/new").to route_to("sections#new") end it "routes to #show" do expect(:get => "/sections/1").to route_to("sections#show", :id => "1") end it "routes to #edit" do expect(:get => "/sections/1/edit").to route_to("sections#edit", :id => "1") end it "routes to #create" do expect(:post => "/sections").to route_to("sections#create") end it "routes to #update via PUT" do expect(:put => "/sections/1").to route_to("sections#update", :id => "1") end it "routes to #update via PATCH" do expect(:patch => "/sections/1").to route_to("sections#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/sections/1").to route_to("sections#destroy", :id => "1") end end end ================================================ FILE: spec/routing/units_routing_spec.rb ================================================ require "rails_helper" RSpec.describe UnitsController, type: :routing do describe "routing" do it "routes to #index" do expect(:get => "/units").to route_to("units#index") end it "routes to #new" do expect(:get => "/units/new").to route_to("units#new") end it "routes to #show" do expect(:get => "/units/1").to route_to("units#show", :id => "1") end it "routes to #edit" do expect(:get => "/units/1/edit").to route_to("units#edit", :id => "1") end it "routes to #create" do expect(:post => "/units").to route_to("units#create") end it "routes to #update via PUT" do expect(:put => "/units/1").to route_to("units#update", :id => "1") end it "routes to #update via PATCH" do expect(:patch => "/units/1").to route_to("units#update", :id => "1") end it "routes to #destroy" do expect(:delete => "/units/1").to route_to("units#destroy", :id => "1") end end end ================================================ FILE: spec/spec_helper.rb ================================================ # This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require it in any # files. # # Given that it is always loaded, you are encouraged to keep this file as # light-weight as possible. Requiring heavyweight dependencies from this file # will add to the boot time of your test suite on EVERY test run, even for an # individual file that may not need all of that loaded. Instead, consider making # a separate helper file that requires the additional dependencies and performs # the additional setup, and require it from the spec files that actually need # it. # # The `.rspec` file also contains a few flags that are not defaults but that # users commonly want. # # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest # assertions if you prefer. config.expect_with :rspec do |expectations| # This option will default to `true` in RSpec 4. It makes the `description` # and `failure_message` of custom matchers include text for helper methods # defined using `chain`, e.g.: # be_bigger_than(2).and_smaller_than(4).description # # => "be bigger than 2 and smaller than 4" # ...rather than: # # => "be bigger than 2" expectations.include_chain_clauses_in_custom_matcher_descriptions = true end # rspec-mocks config goes here. You can use an alternate test double # library (such as bogus or mocha) by changing the `mock_with` option here. config.mock_with :rspec do |mocks| # Prevents you from mocking or stubbing a method that does not exist on # a real object. This is generally recommended, and will default to # `true` in RSpec 4. mocks.verify_partial_doubles = true end # The settings below are suggested to provide a good initial experience # with RSpec, but feel free to customize to your heart's content. =begin # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with # `:focus` metadata. When nothing is tagged with `:focus`, all examples # get run. config.filter_run :focus config.run_all_when_everything_filtered = true # Allows RSpec to persist some state between runs in order to support # the `--only-failures` and `--next-failure` CLI options. We recommend # you configure your source control system to ignore this file. config.example_status_persistence_file_path = "spec/examples.txt" # Limits the available syntax to the non-monkey patched syntax that is # recommended. For more details, see: # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode config.disable_monkey_patching! # Many RSpec users commonly either run the entire suite or an individual # file, and it's useful to allow more verbose output when running an # individual spec file. if config.files_to_run.one? # Use the documentation formatter for detailed output, # unless a formatter has already been configured # (e.g. via a command-line flag). config.default_formatter = 'doc' end # Print the 10 slowest examples and example groups at the # end of the spec run, to help surface which specs are running # particularly slow. config.profile_examples = 10 # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = :random # Seed global randomization in this process using the `--seed` CLI option. # Setting this allows you to use `--seed` to deterministically reproduce # test failures related to randomization by passing the same `--seed` value # as the one that triggered the failure. Kernel.srand config.seed =end end ================================================ FILE: spec/views/captures/edit.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "captures/edit", type: :view do end ================================================ FILE: spec/views/captures/index.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "captures/index", type: :view do end ================================================ FILE: spec/views/captures/new.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "captures/new", type: :view do end ================================================ FILE: spec/views/captures/show.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "captures/show", type: :view do end ================================================ FILE: spec/views/devices/edit.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "devices/edit", type: :view do before(:each) do @device = assign(:device, Device.create!( :fcc_id => "MyString", :baudrate => "MyString", :frequency => 1.5, :modulation => "MyString", :encoding => "MyString", :name => "MyString", :notes => "MyText" )) end it "renders the edit device form" do render assert_select "form[action=?][method=?]", device_path(@device), "post" do assert_select "input#device_fcc_id[name=?]", "device[fcc_id]" assert_select "input#device_baudrate[name=?]", "device[baudrate]" assert_select "input#device_frequency[name=?]", "device[frequency]" assert_select "input#device_modulation[name=?]", "device[modulation]" assert_select "input#device_encoding[name=?]", "device[encoding]" assert_select "input#device_name[name=?]", "device[name]" assert_select "textarea#device_notes[name=?]", "device[notes]" end end end ================================================ FILE: spec/views/devices/index.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "devices/index", type: :view do before(:each) do assign(:devices, [ Device.create!( :fcc_id => "Fcc", :baudrate => "Baudrate", :frequency => 1.5, :modulation => "Modulation", :encoding => "Encoding", :name => "Name", :notes => "MyText" ), Device.create!( :fcc_id => "Fcc", :baudrate => "Baudrate", :frequency => 1.5, :modulation => "Modulation", :encoding => "Encoding", :name => "Name", :notes => "MyText" ) ]) end it "renders a list of devices" do render assert_select "tr>td", :text => "Fcc".to_s, :count => 2 assert_select "tr>td", :text => "Baudrate".to_s, :count => 2 assert_select "tr>td", :text => 1.5.to_s, :count => 2 assert_select "tr>td", :text => "Modulation".to_s, :count => 2 assert_select "tr>td", :text => "Encoding".to_s, :count => 2 assert_select "tr>td", :text => "Name".to_s, :count => 2 assert_select "tr>td", :text => "MyText".to_s, :count => 2 end end ================================================ FILE: spec/views/devices/new.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "devices/new", type: :view do before(:each) do assign(:device, Device.new( :fcc_id => "MyString", :baudrate => "MyString", :frequency => 1.5, :modulation => "MyString", :encoding => "MyString", :name => "MyString", :notes => "MyText" )) end it "renders new device form" do render assert_select "form[action=?][method=?]", devices_path, "post" do assert_select "input#device_fcc_id[name=?]", "device[fcc_id]" assert_select "input#device_baudrate[name=?]", "device[baudrate]" assert_select "input#device_frequency[name=?]", "device[frequency]" assert_select "input#device_modulation[name=?]", "device[modulation]" assert_select "input#device_encoding[name=?]", "device[encoding]" assert_select "input#device_name[name=?]", "device[name]" assert_select "textarea#device_notes[name=?]", "device[notes]" end end end ================================================ FILE: spec/views/devices/show.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "devices/show", type: :view do end ================================================ FILE: spec/views/section_templates/edit.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "section_templates/edit", type: :view do end ================================================ FILE: spec/views/section_templates/index.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "section_templates/index", type: :view do before(:each) do assign(:section_templates, [ SectionTemplate.create!( :name => "Name", :sections => "MyText", :added_by => "Added By" ), SectionTemplate.create!( :name => "Name", :sections => "MyText", :added_by => "Added By" ) ]) end it "renders a list of section_templates" do render assert_select "tr>td", :text => "Name".to_s, :count => 2 assert_select "tr>td", :text => "MyText".to_s, :count => 2 assert_select "tr>td", :text => "Added By".to_s, :count => 2 end end ================================================ FILE: spec/views/section_templates/new.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "section_templates/new", type: :view do end ================================================ FILE: spec/views/section_templates/show.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "section_templates/show", type: :view do before(:each) do @section_template = assign(:section_template, SectionTemplate.create!( :name => "Name", :sections => "MyText", :added_by => "Added By" )) end it "renders attributes in

" do render expect(rendered).to match(/Name/) expect(rendered).to match(/MyText/) expect(rendered).to match(/Added By/) end end ================================================ FILE: spec/views/sections/edit.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "sections/edit", type: :view do end ================================================ FILE: spec/views/sections/index.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "sections/index", type: :view do end ================================================ FILE: spec/views/sections/new.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "sections/new", type: :view do end ================================================ FILE: spec/views/sections/show.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "sections/show", type: :view do end ================================================ FILE: spec/views/units/edit.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "units/edit", type: :view do end ================================================ FILE: spec/views/units/index.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "units/index", type: :view do end ================================================ FILE: spec/views/units/new.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "units/new", type: :view do end ================================================ FILE: spec/views/units/show.html.haml_spec.rb ================================================ require 'rails_helper' RSpec.describe "units/show", type: :view do end ================================================ FILE: test/controllers/.keep ================================================ ================================================ FILE: test/fixtures/.keep ================================================ ================================================ FILE: test/helpers/.keep ================================================ ================================================ FILE: test/integration/.keep ================================================ ================================================ FILE: test/mailers/.keep ================================================ ================================================ FILE: test/models/.keep ================================================ ================================================ FILE: test/test_helper.rb ================================================ 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 for all tests in alphabetical order. fixtures :all # Add more helper methods to be used by all tests here... end ================================================ FILE: vendor/assets/javascripts/.keep ================================================ ================================================ FILE: vendor/assets/stylesheets/.keep ================================================