Skip to content

Instantly share code, notes, and snippets.

View kf0jvt's full-sized avatar

Kevin Thompson kf0jvt

View GitHub Profile
@kf0jvt
kf0jvt / prc_fix.py
Created September 24, 2013 04:11
Script I wrote to fix a problem that we found in VCDB where a few of the incidents did not have a valid confidentiality attribute. We created new json files, but we couldn't overwrite the old ones because other changes would have been lost. This script maps the reference field to the filename so we can replace just the confidentiality section of…
import os
import json
vcdb_path = 'Documents/development/python/VCDB/incidents'
prc_fix_path = 'Downloads/prc-fix'
mapping = {}
for filename in os.listdir(vcdb_path):
if filename.endswith('.json'):
i = json.loads(open(os.path.join(vcdb_path,filename)).read())
@kf0jvt
kf0jvt / date_convert.js
Created September 18, 2013 12:47
After importing json into mongo some date fields may be interpreted as text. This script will go through and convert those fields to dates in mongo.
/usr/bin/mongo yourdbname --eval "db.yourcollectionname.find().forEach(function(doc){doc.yourdatefield = new ISODate(doc.yourdatefield);db.yourcollectionname.save(doc)});"
<!DOCTYPE html>
<script src="http://mbostock.github.com/d3/d3.v2.js?2.8.1"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style>
body {
font: 10px sans-serif;
}
rect {
@kf0jvt
kf0jvt / gist:6470693
Last active December 22, 2015 12:09
Top Ten largest data breaches in the VCDB by record count. #vcdb #javascript
foo = db.vcdb.aggregate([
{ $unwind : "$victim" },
{ $project : { _id : 0,
data_total : "$attribute.confidentiality.data_total",
incident : "$timeline.incident",
victim_id : "$victim.victim_id" } },
{ $sort : { "data_total" : -1 } },
{ $limit : 10 }
]);
@kf0jvt
kf0jvt / deface-activisty.py
Created September 4, 2013 15:10
Python script that takes a csv file and turns it into a set of .json files which are VERIS 1.2 schema compliant. This script is for incidents where an external activist has defaced a website. #hacking #defacement #veris
import json
import uuid
import copy
import csv
import datetime
infile = csv.DictReader(open('list.csv','rU'))
template = {u'impact': {u'overall_rating': u'Unknown'}, u'incident_id': '', u'reference': '', u'attribute': {u'integrity': {u'notes': u'', u'variety': [u'Modify data', u'Misappropriation']}}, u'notes': u'', u'schema_version': u'1.2', u'summary': '', u'action': {u'hacking': {u'notes': u'', u'vector': [u'Web application'], u'variety': ['Unknown']}}, u'security_incident': u'Confirmed', u'plus': {u'f500': u'N', u'master_id': u'osint523', u'timeline': {u'notification': {}}}, u'actor': {u'external': {u'motive': ['Ideology'], u'country': [u'Unknown'], u'variety': ['Activist']}}, u'victim': [{u'victim_id': '', u'country': '', u'notes': u'', u'industry': ''}], u'timeline': {u'incident': {u'year': 2012}}, u'source_id': u'osint', u'discovery_method': u'Ext - actor disclosure', u'asset': {u'assets': [{u'variety': u'S - Web application'}]}}
for row in infile:
@kf0jvt
kf0jvt / gist:6428581
Last active December 22, 2015 06:08
Simple script to count the number of issues closed by each person in a git repo
import urllib
import json
import operator
# Only going to grab 300 issues. May need to change this line
filehandle = urllib.urlopen('https://api.github.com/repos/vz-risk/VCDB/issues?state=closed&per_page=300')
usercount = {}
issues = json.loads(filehandle.read())
@kf0jvt
kf0jvt / gist:6427704
Last active December 22, 2015 05:58
We noticed a problem with the VERIS Community Database where incidents that involved loss or theft were not being coded up with the availability attribute set. This script fixes that for all those incidents. #VCDB
import json
import os
def FixAttribute(inDict,filename):
if 'availability' not in inDict['attribute'].keys():
print filename + " is messed up."
inDict['attribute']['availability'] = {}
inDict['attribute']['availability']['variety'] = ['Loss']
return inDict
@kf0jvt
kf0jvt / gist:6419155
Last active February 8, 2023 01:31
Professors: Stop Assigning Group Projects!

This week is the start of grad school. Since I'm also working full time I decided to take it easy and only registered for two classes. I know that is a small sample size, but I'm pretty disappointed to learn that both of the classes have a lot of group projects involved in them. And I remember from my time as an undergrad student that (almost) every professor was assigning group projects too. Ugh group projects suck! I had hoped that I would be done with group projets when I left undergrad behind. Collaborative learning: the go-to pedagogy for lazy professors when service learning isn't available for some reason.

First, a distinction

I draw a distinction between group projects and group work. To me, a group project is a larger deliverable where the intent is that students will work together over a longer period of time. Group work, on the other hand, is what I call it when you have students break into smaller groups within the class period to discuss something amongst themselves and possibly produce a sho

@kf0jvt
kf0jvt / legal-stuff
Last active December 22, 2015 03:18
Legal Stuff and Ethics. #class
@kf0jvt
kf0jvt / CLASS_administrative_controls
Last active December 22, 2015 03:09
Administrative controls. Policies, Procedures, Standards, and Guidelines. #class
## IT Controls Matrix
| | Preventative | Detective | Corrective |
| ------------- |:-------------:|:----------:| -----------|
| Administrative| Policy | Audit | |
| Technical | | | |
| Physical | | | |
## Definitions of Administrative Controls
+ Policy - Broad statement of management intent. **Example:** IT is responsible for secure configuration of endpoints.