Skip to content

Instantly share code, notes, and snippets.

View yzguy's full-sized avatar

Adam Smith yzguy

  • Akamai Technologies
  • Pennsylvania
View GitHub Profile

Introduction

Cyberengine is the combination of a Ruby on Rails web front-end and backend service checks. Cyberengine is designed to check and score common network services used in "blueteam-redteam-whiteteam" competitions and provide a web interface for teams about their servers and services.

Setup Overview

  • There are many Teams of type white, red, and blue
  • A team can have many Members
  • Teams have many Servers
class StaticController < ApplicationController
def welcome
end
def scoreboard
@teams = Array.new
@bargraph = Array.new
@scoreboard = Hash.new
@colors = ['#FF1493','#F08080','#DC143C','#FF4500','#FF0000','#FFD700','#008000','#32CD32','#40E0D0','#4169E1','#9370DB']
Team.blueteams.includes([services_for_scoring: :checks_for_scoring]).each do |team|
dm() {
case $1 in
ip )
docker-machine ip $DOCKER_MACHINE_NAME
;;
set )
eval $(docker-machine env $2)
;;
* )
docker-machine $@
@yzguy
yzguy / prompt
Last active October 25, 2015 02:15
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1='\[\e[33;34m\]\u\[\e[0;97m\]@\[\e[33;32m\]\h\[\e[33;31m\]$(parse_git_branch)\[\e[0m\] \[\e[0;97m\]\W \[\e[33;40m\]->\[\e[0m\] '
#!/usr/bin/env ruby
require 'sqlite3'
db = SQLite3::Database.new("locations.db")
def getAllLocations()
return db.execute("SELCT name FROM locations")
end
require 'erb'
module TemplateVariables
def self.construct(variables)
b = get_binding
variables.each do |key, value|
b.local_variable_set(key, value)
end
b
showmount -e nasserver
sudo mount -t nfs -o resvport,rw nasserver:/opt/storage ~/storage/
sudo umount -f ~/storage
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/[\1]/'
}
export PS1='\[\e[0;95m[\] \u\[\e[0;97m\]@\[\e[0;92m\]\h: $(parse_git_branch) \[\e[0;97m\]\W \[\e[0;95m\]] $\[\e[0m\] '
Oscar
https://github.com/adrienthebo/oscar
Puppet Debugging Kit
https://github.com/Sharpie/puppet-debugging-kit
Beaker
https://github.com/puppetlabs/beaker
Hiera
From this:
----------
csv_file = csv.DictReader(open(sys.argv[2], 'r'))
To This:
--------
with open(sys.argv[2], 'r') as csv_file:
csv_data = csv.DictReader(csv_file)
for row in csv_data:
...