Skip to content

Instantly share code, notes, and snippets.

@ayosec
ayosec / Debian Repository.md
Created August 20, 2019 15:44
Debian Repository

Debian Repository

Create a foobar repository:

apt-get install reprepro

OUTPUT=$(mktemp -d)
mkdir -p $OUTPUT/conf
@ayosec
ayosec / docker-hub-images-info.rb
Last active July 11, 2019 16:11
Script to see image sizes in Docker Hub
#!/usr/bin/env ruby
require "json"
case ARGV.size
when 1
image = ARGV[0]
limit = 20
when 2
image = ARGV[0]
@ayosec
ayosec / flatten-code.jq
Last active June 21, 2019 02:47
jq: flatten JSON document
paths(scalars) as $p
| [ ( [ $p[] | tostring ] | join(".") )
, ( getpath($p) | tojson )
]
| join(" = ")

Dump WebSocket traffic

From pcap file:

$ tshark -Tfields -Y websocket.payload -E occurrence=l -e tcp.srcport -e text -r websocket.pcap

Capture:

$ tshark -Tfields -Y websocket.payload -E occurrence=l -e tcp.srcport -e text -i lo port 12345

Debug HTTPS Connections

  1. Set SSLKEYLOGFILE to a path where private keys will be stored:

    $ export SSLKEYLOGFILE=/some/path/keylog
    $ firefox
  2. Capture HTTPS traffic:

extern crate gtk;
extern crate gdk;
use gtk::prelude::*;
use gdk::Atom;
use gtk::*;
use std::sync::atomic::{AtomicUsize, Ordering};
fn main() {
if gtk::init().is_err() {
FROM golang:1.10-alpine
COPY . /go/src/pathtocode
WORKDIR /go/src/pathtocode/
RUN go build main.go
FROM alpine:3.7
RUN apk add --no-cache ca-certificates
COPY --from=0 /go/src/pathtocode/main .
CMD ["./main"]
@ayosec
ayosec / fix-medium-iframes.js
Created April 7, 2018 15:08
Fix medium iframes
// Replace iframes to load their real content
// Intended to be used in Scratchpad (Firefox)
(function() {
let sf = $(".js-stickyFooter");
if(sf !== null) { sf.remove(); }
document.querySelectorAll("figure iframe").forEach(iframe => {
let src = iframe.dataset["src"];
let newIframe = document.createElement("iframe");
Disable "heads up" notifications in Android 7
$ adb shell settings set global heads_up_notifications_enabled 0