Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hacking away

Robin Wood digininja

💭
Hacking away
View GitHub Profile
View alert.js
alert("Gist XSS");
@digininja
digininja / part2.rb
Created December 2, 2021 09:29
advent of code day two part two
View part2.rb
aim=0
depth=0
forward=0
File.readlines('input.txt').each do |line|
if /([^ ]*) ([0-9]*)/ =~ line
puts "direction: " + $1 + " value " + $2 + "\n"
value = $2.to_i
movement = $1
if movement == "forward"
forward = forward + value
@digininja
digininja / part1.rb
Created December 2, 2021 09:28
advent of code day two part one
View part1.rb
depth=0
forward=0
File.readlines('input.txt').each do |line|
if /([^ ]*) ([0-9]*)/ =~ line
puts "direction: " + $1 + " value " + $2 + "\n"
value = $2.to_i
movement = $1
if movement == "forward"
forward = forward + value
else
@digininja
digininja / day1_part2.rb
Created December 1, 2021 18:30
Solution to day 1 part 2 of advent of code challenge
View day1_part2.rb
count = 0
previous = 999999999999999
current = 0
block1=0
block2=0
block3=0
pos=0
File.readlines('input').each do |line|
num = line.to_i
@digininja
digininja / gist:d11e71184fed5db468eb68fc89afed39
Created October 15, 2020 09:18
Reset a git fork to its upstream master
View gist:d11e71184fed5db468eb68fc89afed39
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
@digininja
digininja / dvwa_db_connection_test.php
Created August 8, 2018 15:06
Check for DVWA database connection issues
View dvwa_db_connection_test.php
<?php
/*
Put this file in the root of the DVWA installation then access it through a browser.
*/
require_once "config/config.inc.php";
function var_dump_pre ($data) {
print "<pre>";
var_dump ($data);
@digininja
digininja / macro.php
Created January 24, 2018 20:49
Sample code to go with the Burp Macro blog post at https://digi.ninja/blog/burp_macros.php
View macro.php
<?php
session_start();
$message = "";
if ($_SERVER['REQUEST_METHOD'] == "POST") {
if (array_key_exists ("token", $_POST) && array_key_exists ("token", $_SESSION)) {
if (array_key_exists ("token", $_SESSION)) {
if ($_POST['token'] == $_SESSION['token']) {
$message = "Success";
@digininja
digininja / gist:d68f3c272778ec9a3299
Last active January 11, 2016 09:25
redis threaded pool queue
View gist:d68f3c272778ec9a3299
#!/usr/bin/env ruby
require "redis"
require "concurrent"
redis = Redis.new
redis.flushdb
pool = Concurrent::FixedThreadPool.new(
Concurrent.processor_count,
@digininja
digininja / gist:e5e16b285232ebf0c1df
Last active January 5, 2016 21:41
Redis increase and dump
View gist:e5e16b285232ebf0c1df
require "redis"
redis = Redis.new
redis.flushdb
redis.zincrby("colours", 1, "red")
redis.sadd("colours:base:red", "thread")
redis.zincrby("colours", 1, "red")
redis.sadd("colours:base:red", "red box")
redis.zincrby("colours", 1, "green")