Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Challenge Completed #10

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# 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'

# Ignore bundler config.
/.bundle

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp

.DS_Store
31 changes: 31 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'sqlite3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'

gem "haml-rails", "~> 0.9"
gem 'bootstrap-glyphicons' # required for file-input
gem 'bootstrap-sass', '~> 3.3.6'
gem 'sass-rails', '>= 3.2'
gem 'font-kit-rails', '~> 1.2.0'

gem 'chartkick', '~> 1.2.4'

# sortable tables
gem 'momentjs-rails'
gem 'rails_bootstrap_sortable'

group :development, :test do
gem 'byebug'
gem 'awesome_print'
end

group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end

196 changes: 196 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.6)
actionview (= 4.2.6)
activesupport (= 4.2.6)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.6)
activesupport (= 4.2.6)
globalid (>= 0.3.0)
activemodel (4.2.6)
activesupport (= 4.2.6)
builder (~> 3.1)
activerecord (4.2.6)
activemodel (= 4.2.6)
activesupport (= 4.2.6)
arel (~> 6.0)
activesupport (4.2.6)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
arel (6.0.3)
autoprefixer-rails (6.3.6.2)
execjs
awesome_print (1.7.0)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-glyphicons (0.0.1)
railties (>= 3.0)
sass (>= 3.2)
bootstrap-sass (3.3.6)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
byebug (9.0.5)
chartkick (1.2.5)
coffee-rails (4.1.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
debug_inspector (0.0.2)
erubis (2.7.0)
execjs (2.7.0)
font-kit-rails (1.2.0)
rails
globalid (0.3.6)
activesupport (>= 4.1.0)
haml (4.0.7)
tilt
haml-rails (0.9.0)
actionpack (>= 4.0.1)
activesupport (>= 4.0.1)
haml (>= 4.0.6, < 5.0)
html2haml (>= 1.0.1)
railties (>= 4.0.1)
html2haml (2.0.0)
erubis (~> 2.7.0)
haml (~> 4.0.0)
nokogiri (~> 1.6.0)
ruby_parser (~> 3.5)
i18n (0.7.0)
jbuilder (2.5.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
loofah (2.0.3)
nokogiri (>= 1.5.9)
mail (2.6.4)
mime-types (>= 1.16, < 4)
mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mini_portile2 (2.1.0)
minitest (5.9.0)
momentjs-rails (2.11.1)
railties (>= 3.1)
multi_json (1.12.1)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
pkg-config (1.1.7)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rails (4.2.6)
actionmailer (= 4.2.6)
actionpack (= 4.2.6)
actionview (= 4.2.6)
activejob (= 4.2.6)
activemodel (= 4.2.6)
activerecord (= 4.2.6)
activesupport (= 4.2.6)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.6)
sprockets-rails
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
rails_bootstrap_sortable (2.0.0)
momentjs-rails (~> 2, >= 2.8.3)
railties (4.2.6)
actionpack (= 4.2.6)
activesupport (= 4.2.6)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.2.2)
ruby_parser (3.8.2)
sexp_processor (~> 4.1)
sass (3.4.22)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sexp_processor (4.7.0)
spring (1.7.1)
sprockets (3.6.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.4)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (2.5.3)
coffee-rails
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.0)
execjs (>= 0.3.0, < 3)
web-console (2.3.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)

PLATFORMS
ruby

DEPENDENCIES
awesome_print
bootstrap-glyphicons
bootstrap-sass (~> 3.3.6)
byebug
chartkick (~> 1.2.4)
coffee-rails (~> 4.1.0)
font-kit-rails (~> 1.2.0)
haml-rails (~> 0.9)
jbuilder (~> 2.0)
jquery-rails
momentjs-rails
rails (= 4.2.6)
rails_bootstrap_sortable
sass-rails (>= 3.2)
spring
sqlite3
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)

BUNDLED WITH
1.12.5
30 changes: 30 additions & 0 deletions README-challenge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Intel Security Programming Challenge
Please complete the following programming challenge. It is used to better assess a candidate's software development skills. You have as much time as you'd like (though we ask that you not spend more than a few hours) and may use any programming language or framework you'd like. Feel free to contact the original sender if you have any questions.

## Submission Instructions
1. First, fork this project on github. You will need to create an account if you don't already have one.
1. Next, complete the project as described below within your fork.
1. Finally, push all of your changes to your fork on github and submit a pull request.

## Project Description
Imagine that Intel Security has just acquired a new security company. Unfortunately, the company has never stored their data in a database and instead uses plain text files. We need to create a way for the new subsidiary to import their malware data into a database. Your task is to create a web interface that accepts file uploads, normalizes the data, and then stores it in a relational database - design is up to you.

Here's what your web-based application must do:

1. Your app must accept (via a form) a CSV file with the following columns: MD5, ClassificationName, ClassificationType, Size, FileType. You can assume the columns will always be in that order, that there will always be data in each column, that there will always be a header line, and that there will never be a duplicate MD5. An example input file named example_input.csv is included in this repo.
1. Your app must parse the given file, normalize the data, and store the information in a relational database.
1. After each upload, your application should display the total amount of each different ClassificationType in the database.

Your application does not need to:

1. be written with any particular language or framework
1. be aesthetically pleasing (bonus points if it does, extra bonus points for using Bootstrap)

Your application should be easy to set up and should run on Linux. It also should not require any for-pay software.

## Evaluation
Evaluation of your submission will be based on the following criteria:

1. Did your application fulfill the basic requirements?
1. Did you document the method for setting up and running your application?
1. Did you follow the instructions for submission?
64 changes: 43 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
# Intel Security Programming Challenge
Please complete the following programming challenge. It is used to better assess a candidate's software development skills. You have as much time as you'd like (though we ask that you not spend more than a few hours) and may use any programming language or framework you'd like. Feel free to contact the original sender if you have any questions.
# Overview
This application was designed for demonstration purproses only. A production application should utilize a more robust solution such as the latest stable version of [ruby (2.3.1)](https://www.ruby-lang.org/en/downloads/), [nginx](https://www.nginx.com), and [passenger](https://www.phusionpassenger.com/).

## Submission Instructions
1. First, fork this project on github. You will need to create an account if you don't already have one.
1. Next, complete the project as described below within your fork.
1. Finally, push all of your changes to your fork on github and submit a pull request.
## Setup
Tested with the following configuration

## Project Description
Imagine that Intel Security has just acquired a new security company. Unfortunately, the company has never stored their data in a database and instead uses plain text files. We need to create a way for the new subsidiary to import their malware data into a database. Your task is to create a web interface that accepts file uploads, normalizes the data, and then stores it in a relational database - design is up to you.
* CentOS 7.2.1511

Here's what your web-based application must do:
### Install Prerequisite Packages
* `yum install -y git`
* Checkout Repo: `git clone https://github.com/sstovall/apg_challenge.git`
* `cd apg_challenge && ./setup-centos7.sh`

1. Your app must accept (via a form) a CSV file with the following columns: MD5, ClassificationName, ClassificationType, Size, FileType. You can assume the columns will always be in that order, that there will always be data in each column, that there will always be a header line, and that there will never be a duplicate MD5. An example input file named example_input.csv is included in this repo.
1. Your app must parse the given file, normalize the data, and store the information in a relational database.
1. After each upload, your application should display the total amount of each different ClassificationType in the database.
### Start WebApp
* `bin/rails s -b 0.0.0.0`

Your application does not need to:
* (optional) `sudo bin/'rails -s -b 0.0.0.0 -p 80`
* root privilege required to bind to tcp/80

1. be written with any particular language or framework
1. be aesthetically pleasing (bonus points if it does, extra bonus points for using Bootstrap)
### Access via Web Browser
* Access via web browser `http://<server_ip>:3000/`

Your application should be easy to set up and should run on Linux. It also should not require any for-pay software.
# Threat Intelligence WebApp

## Evaluation
Evaluation of your submission will be based on the following criteria:
## Reset Database
* stop server
* `bin/rake db:drop`
* `bin/rake db:setup`
* start server

1. Did your application fulfill the basic requirements?
1. Did you document the method for setting up and running your application?
1. Did you follow the instructions for submission?

Features
--------
### Import Malware Data

[![import csv](https://github.com/sstovall/apg_challenge/raw/master/screenshots/import-malware-data.png)](https://github.com/sstovall/apg_challenge/raw/master/screenshots/import-malware-data.png)

### Attach File to Import

[![import csv](https://github.com/sstovall/apg_challenge/raw/master/screenshots/attach-file-to-import.png)](https://github.com/sstovall/apg_challenge/raw/master/screenshots/attach-file-to-import.png)

### Threats by Classification Type

[![import csv](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threats-by-classification-type.png)](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threats-by-classification-type.png)

### Threat Database

[![import csv](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threat-database.png)](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threat-database.png)

### Threat Statistics

[![import csv](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threat-statistics.png)](https://github.com/sstovall/apg_challenge/raw/master/screenshots/threat-statistics.png)
6 changes: 6 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# 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
Empty file added app/assets/images/.keep
Empty file.
Binary file added app/assets/images/favicon.ico
Binary file not shown.
Binary file added app/assets/images/loading-sm.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/loading.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/assets/images/logo-intel-security-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions app/assets/javascripts/app.fileinput.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# app/assets/javascripts/app.fileinput.coffee

class App.FileInput
constructor: (@el) ->
# intialize some stuff

render: ->
# do some stuff

$(document).on "page:change", ->
# Initialize: fileinput
$('#input-1').fileinput
uploadUrl: '/threats/import'
uploadAsync: false
maxFileCount: 1
browseOnZoneClick: true
allowedFileExtensions: [ 'csv' ]

# Event: fileuploaded
$('#input-1').on 'fileuploaded', ->
uploadComplete()

# Event: filebatchuploadcomplete
$('#input-1').on 'filebatchuploadcomplete', ->
uploadComplete()


uploadComplete = ->
console.log 'uploadComplete!'
# "location.reload()",
Turbolinks.visit location.toString()

Loading