Skip to content

Instantly share code, notes, and snippets.

View kylestev's full-sized avatar

Kyle Stevenson kylestev

  • Portland, Oregon
View GitHub Profile
@kylestev
kylestev / Netflix Blocker
Created May 23, 2012 03:37
Fiddler Netflix blocker using HostList class
import Fiddler;
class Handlers {
static var nopeGif = "<img src=\"http://i.imgur.com/OLRXz.gif\" />";
static var blocked = "<html><head><title>Blocked</title></head><body><h2>Blocked</h2><p>Stop using all my bandwidth!!</p><br />" + nopeGif + "</body></html>";
static var hostList = new HostList("*.netflix.com,*.nflximg.com");
static function OnBeforeRequest(oSession: Session) {
if (hostList.ContainsHost(oSession.hostname)) {
oSession["ui-bold"] = "true";
@kylestev
kylestev / JavaScript Injection
Created May 23, 2012 03:50
JavaScript injection into HTML documents using Fiddler
import Fiddler;
class Handlers {
static var injectJs = "<script>alert('I see you enjoy YouTube.')</script>";
static var hostList = new HostList("*.youtube.com");
static function OnBeforeResponse(oSession : Session) {
// Filter to only HTML documents and on the domains we want
if (hostList.ContainsHost(oSession.hostname) && oSession.oResponse.headers.ExistsAndContains("Content-Type", "text/html")) {
oSession.utilDecodeResponse();
@kylestev
kylestev / HTTPS redirection
Created May 28, 2012 02:08
HTTP to HTTPS redirection in PHP
<?php
if ($_SERVER['SERVER_PORT'] != 443) {
header(sprintf('Location: https://%s%s', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']));
}
?>
@kylestev
kylestev / Robot C Maze Logic
Created May 30, 2012 17:00
Program used for my high school team's robot
#pragma config(Hubs, S4, HTMotor, none, none, none)
#pragma config(Sensor, S2, sonar, sensorSONAR)
#pragma config(Sensor, S3, touch, sensorTouch)
#pragma config(Motor, mtr_S4_C1_1, motorD, tmotorNormal, openLoop)
#pragma config(Motor, mtr_S4_C1_2, motorE, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
void move(int motorDPower, int motorEPower, int millis) {
motor[motorD] = motorDPower;
motor[motorE] = motorEPower;
@kylestev
kylestev / remove.py
Last active October 5, 2015 19:08
Wrote this to get rid of an extortion virus. Might expand it more in the future. https://www.virustotal.com/file/7dcf381565eeb4b7ac6b20fd3911a44580aa9e1a0b9b6d078e2d7819ac837e2b/analysis/
import os
import datetime
appdata = os.environ['APPDATA']
log_dir = appdata + '\\dclogs\\'
local_dir = appdata + '\\..\\Local\\'
exes = [local_dir + 'Java.exe', local_dir + 'wmpnet32.exe', local_dir + 'Microsoft\\Windows\\Start Menu\\Programs\\Startup\\WinUpdate.exe']
found = false
print startup
@kylestev
kylestev / pandora.js
Created November 16, 2012 20:31
Pandora functions
function clickButton(className, index) {
var buttons = document.getElementsByClassName(className);
console.log(buttons);
if (index < buttons.length) {
buttons[index].click();
}
}
function getCurrentTrack() {
@kylestev
kylestev / gist:4191441
Created December 2, 2012 22:53
This is for acquiring the "OrderedFriends" list that is rumored to tell you who visits your profile the most. This is more likely fiction than fact, though.
function getScriptIndex() {
for (var i = 0; i < scripts.length; i++) {
if (scripts[i].innerText.indexOf("OrderedFriends") > -1) {
return i;
}
}
return -1;
}
@kylestev
kylestev / compare.py
Created February 18, 2013 19:38
Checks your Facebook friends and records the people that have removed you as a friend since the last check. Technically this is against the API's Terms of Service, so let's just call this a proof of concept.
import sys
import json
def fbquery(token, query):
from urllib import urlencode
from urllib2 import urlopen
from re import sub
query = sub('\ {2,}', ' ', query)
url = 'https://api.facebook.com/method/fql.query?' + urlencode({'query': query, 'access_token': token, 'format': 'json'})
@kylestev
kylestev / redmine_issues.py
Created February 26, 2013 22:04
Shows all the issues currently assigned to a specified user in Redmine.
import json
import sys
from urllib2 import urlopen
REDMINE_URL = 'https://code.osuosl.org/issues.json?assigned_to_id=%s'
def main():
if len(sys.argv) != 2:
return 'Please add your Redmine user id'
@kylestev
kylestev / Capture.java
Created March 12, 2013 03:03
Just a small script for checking the current light level using a webcam. This is similar to what is running on my Raspberry PI in my safe that will send me a text message when the safe is opened.
package com.kylestev.lightlevel;
import com.smaxe.uv.media.core.VideoFrame;
import com.smaxe.uv.na.WebcamFactory;
import com.smaxe.uv.na.webcam.IWebcam;
import java.util.List;
/**
* User: Kyle Stevenson