Skip to content

Instantly share code, notes, and snippets.

View lokori's full-sized avatar

Antti Virtanen lokori

View GitHub Profile
@lokori
lokori / ring-request-wrapper
Created November 27, 2013 11:29
Example of logging a Ring request with Ring. (I'm aware there are some existing alternatives for doing this.)
(ns aitu.infra.print-wrapper
(:require [clojure.tools.logging :as log]))
(def ^:private requestid (atom 1))
(defn http-method->str [keyword-or-str]
(clojure.string/upper-case (name keyword-or-str)))
(defn log-request-wrapper [ring-handler]
"Logging wrapper. Basic info + duration and additional unique id per request to enable performance analysis"
@lokori
lokori / compojure-enterprise-auth
Created December 4, 2013 11:32
PoC on how to combine REST api with context sensitive authorization with Clojure. Using Compojure here, but that's not really interesting. Hairy macro magic. Too hairy, but brazilian waxing in progress.
(ns aitu.compojure-util
(:require [compojure.core :as c]
[aitu.toimiala.kayttajaoikeudet :as auth-map]
[clojure.tools.logging :as log]))
(def http-compojure {
:get 'compojure.core/GET
:post 'compojure.core/POST
:delete 'compojure.core/DELETE
:update 'compojure.core/UPDATE})
@lokori
lokori / reflector.clj
Created December 16, 2015 08:02
clojure function arity reflector
(defn no-args?
"Returns true if f is a sym/var of a function with no arguments. False otherwise."
[f]
(cond (and
(seq? f)
(= 'fn* (first f)))
(empty? (second f))
(symbol? f)
(= '([]) (:arglists (meta (resolve f))))
@lokori
lokori / partial-export.sql
Last active April 27, 2016 10:45
Exporting partial dataset from PostgreSQL
-- 1. Select the proper subset of data and create a new table.
-- Data types automatically inferred by PostgreSQL. Foreign keys and some other constraints are lost.
create table k_ryhma as
select * from kysymysryhma where valtakunnallinen = true;
-- Select referenced data using .. in (select ..)
create table k_kys as
select * from kysymys where kysymysryhmaid in (select kysymysryhmaid from k_ryhma);
-- PostgreSQL does not have merge (insert if not exists). A pattern to easily insert multiple rows of data.
CREATE TABLE rahoitusmuoto_tmp
(
rahoitusmuotoid INT NOT NULL ,
rahoitusmuoto VARCHAR(80) NOT NULL
);
insert into rahoitusmuoto_tmp (rahoitusmuotoid, rahoitusmuoto) values (1, 'valtionosuus');
insert into rahoitusmuoto_tmp (rahoitusmuotoid, rahoitusmuoto) values (2, 'oppisopimus');
@lokori
lokori / 00readme.md
Created June 6, 2016 08:32 — forked from indrora/00readme.md
DeadUpdate: Kickin' it bigtime.

... my first disclosure. Man, it feels weird doing this.

From the vendor that brought you a
                        vulnerable cloud storage platform comes
                        
           ___              ____  __        __     __ 
          / _ \___ ___ ____/ / / / /__  ___/ /__ _/ /____ 
         / // / -_) _ `/ _  / /_/ / _ \/ _  / _ `/ __/ -_)

//_/_,/_,/_/ ./_,/_,/_/_/

@lokori
lokori / docjure.clj
Last active August 30, 2016 19:26
set-or-create-cell! for docjure
(defn set-or-create-cell!
([sheet n val type]
(let [cellref (org.apache.poi.ss.util.CellReference. n)
r (.getRow cellref)
col (int (.getCol cellref))
row (or (.getRow sheet r) (.createRow sheet r))
cell (or (select-cell n sheet) (.createCell row col type))]
(set-cell! cell val)))
([sheet n val]
(set-or-create-cell! sheet n val org.apache.poi.ss.usermodel.Cell/CELL_TYPE_STRING)))
@lokori
lokori / yle-dl-batch.sh
Created September 13, 2016 12:24
yle-dl Docker batch download script
#!/bin/bash
# Lataa tiedostossa yle-dl.txt olevat urlit yksi kerrallaan. Tämän voi laittaa taustalle pyörimään..
#docker run --rm -ti -v `pwd`:/out taskinen/yle-dl yle-dl [YLE-URL-TO-DOWNLOAD]
# 10 = file descriptor, jos loop-body voi lukea standard inputista - tässä tapauksessa ehkä tarpeetonta kikkailua :)
while read -u 10 url; do
docker run --rm -ti -v `pwd`:/out taskinen/yle-dl yle-dl $url
done 10<yle-dl.txt
@lokori
lokori / MailinatorAliases
Created January 4, 2017 19:44 — forked from nocturnalgeek/MailinatorAliases
A list of alternate domains that point to @mailinator.com
@binkmail.com
@bobmail.info
@chammy.info
@devnullmail.com
@letthemeatspam.com
@mailinater.com
@mailinator.net
@mailinator2.com
@notmailinator.com
@reallymymail.com

How to pass the OSCP

  1. Recon
  2. Find vuln
  3. Exploit
  4. Document it

Recon

Unicornscans in cli, nmap in msfconsole to help store loot in database.