Skip to content

Instantly share code, notes, and snippets.

@Techbrunch
Techbrunch / blind_sqli_time_based.rb
Created October 6, 2014 12:47
Small script for Time Based Blind SQL Injection in Ruby
require 'net/http'
require 'uri'
uri = URI.parse('http://www.test.com/index.php')
http = Net::HTTP.new(uri.host, uri.port)
hex = (('a'..'f').to_a + ('0'..'9').to_a).sort.map { |x| x.ord }
ascii = (32..127).to_a
tables = ''
@Techbrunch
Techbrunch / keepass_to_1password.rb
Created November 18, 2014 22:35
Small script to convert Keepass XML file to CVS that can be imported by 1Password
require 'nokogiri'
require 'base64'
require 'csv'
file = File.new("1password.csv", "w")
f = File.open(ARGV[0])
doc = Nokogiri::XML(f)
f.close
import httplib
import urllib
import re
password = ""
md5 = ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
cpt = 0
i = 1
@Techbrunch
Techbrunch / cwl-cake-errors.config
Last active February 26, 2020 19:32
Monitoring CakePHP logs with CloudWatch & Elastic Beanstalk
Mappings:
CWLogs:
CakeErrorLogGroup:
LogFile: "/var/www/html/project/tmp/logs/error.log"
TimestampFormat: "%m-%d-%Y %H:%M:%S"
FilterPatterns:
AllCakeErrorsFilter: "[timestamp, type = *Error*, ...]"
Outputs:
import os, re, requests
rootdir = '_posts'
for subdir, dirs, files in os.walk(rootdir):
for file in files:
filename = os.path.join(subdir, file)
print filename
f = open(filename, "r")
<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet type='text/xsl' href='http://timesofindia.feedsportal.com/xsl/eng/rss.xsl'?>
<rss xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0"><channel><atom:link href="http://timesofindia.indiatimes.com/rssfeeds/1221656.cms" rel="self" type="application/rss+xml" /><title>Top Headlines - The Times of India</title><link>http://timesofindia.indiatimes.com/articlelist/1221656.cms</link><description>Times of India brings the Latest &amp; Top Breaking News on Politics and Current Affairs in India &amp; around the World, Cricket, Sports, Business, Bollywood News and Entertainment, Science, Technology, Health &amp; Fitness news &amp; opinions from leading columnists.</description><language>en-gb</language><copyright>Copyright:(C) 2016 Bennett Coleman &amp; Co
@Techbrunch
Techbrunch / scrape.rb
Created June 8, 2016 09:57
Scrape stackshare.io to get a list of host
require 'http'
require 'nokogiri'
File.open('urls.txt', 'r') do |file_handle|
file_handle.each_line do |line|
begin
html = HTTP.get(line).to_s
doc = Nokogiri::HTML(html)
href = doc.xpath('//*[@id="stp-sidebar"]/div/div[1]/div[1]/a/@href')
if href.to_s == ''
@Techbrunch
Techbrunch / github-list-org-repo.rb
Created June 26, 2016 21:15
List repositories of a Github organization
require 'octokit'
Octokit.auto_paginate = true
Octokit.org_repositories('github').each do | repo |
puts repo.name
end
@Techbrunch
Techbrunch / install-redis.sh
Last active August 3, 2016 08:30 — forked from four43/install-redis.sh
Install Redis
#!/bin/bash
# from here: http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# and here: https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
###############################################
# To use:
# wget https://gist.githubusercontent.com/Techbrunch/909796994aadd92b5f2be66c488d6eb6/raw/install-redis.sh
# chmod 777 install-redis.sh
# ./install-redis.sh
###############################################
echo "*****************************************"
@Techbrunch
Techbrunch / redis-server
Created August 3, 2016 08:29 — forked from four43/redis-server
Redis Server - Init Script
#!/bin/sh
# From - http://www.codingsteps.com/install-redis-2-6-on-amazon-ec2-linux-ami-or-centos/
# - https://github.com/saxenap/install-redis-amazon-linux-centos/blob/master/redis-server
#
# redis - this script starts and stops the redis-server daemon
# Originally from - https://raw.github.com/gist/257849/9f1e627e0b7dbe68882fa2b7bdb1b2b263522004/redis-server
#
# chkconfig: - 85 15
# description: Redis is a persistent key-value database
# processname: redis-server