Skip to content

Instantly share code, notes, and snippets.

View mluis's full-sized avatar
🖖
SYN ACK

Miguel Luís mluis

🖖
SYN ACK
View GitHub Profile
#!/usr/bin/env python
import multiprocessing
import imp
import urllib2
import urlparse
urllib = imp.new_module('urllib')
urllib.error = urllib2
urllib.parse = urlparse
urllib.request = urllib2
@mluis
mluis / careers.hotjar.com.js
Created May 8, 2017 17:58
You have an array of objects in JS, each containing a name, age and gender. Write a function which returns all males between 30 and 40 years old.
let f = (...args) => args[0].filter(p => p.gender == "male" && p.age > 30 && p.age < 40)
/*
Example:
const ppl = [ {"name":"Dr David Darmanin","age": 31, "gender": "male"},
{"name":"Diana De Jesus","age": 32, "gender": "female"},
{"name":"Marc von Brockdorff ","age": 33, "gender": "male"},
{"name":"Christian Nussbaumer ","age": 29, "gender": "male"},
{"name":"Erik Näslund","age": 35, "gender": "male"},
{"name":"Shira Harash","age": 41, "gender": "female"},
@mluis
mluis / README.md
Created August 10, 2017 02:37
Wrapper that simplifies SSH tunnels

ssh-from

ssh-from simplifies common usage of SSH tunnels, and makes double (or triple) tunnels a piece of cake.
Here is an example, where I SSH to a computer that is behind two NATs, tunneling through each router:

Double tunnel example

Details coming to the blog soon.

Installation

@mluis
mluis / README.md
Created August 10, 2017 02:37 — forked from mildsunrise/README.md
Helper program to add HTTP/SOCKS proxy support to SSH

ssh-proxy-dialer

This program adds proxy support to ssh. Once installed, ssh will obey the ssh_proxy environment variable (or all_proxy as a fallback) and will try to connect to the server through that proxy. Example:

export ssh_proxy="socks5://10.139.2.1:8066"
ssh example.com  # will connect through SOCKS5 proxy
@mluis
mluis / gifjs.asm
Created August 10, 2017 02:42 — forked from ajinabraham/gifjs.asm
A Valid GIF and JS file
; a hand-made GIF containing valid JavaScript code
; abusing header to start a JavaScript comment
; inspired by Saumil Shah's Deadly Pixels presentation
; Ange Albertini, BSD Licence 2013
; yamal gifjs.asm -o img.gif
WIDTH equ 10799 ; equivalent to 2f2a, which is '/*' in ASCII, thus starting an opening comment
@mluis
mluis / osx-for-pentesting.sh
Created September 23, 2017 13:35 — forked from gabemarshall/osx-for-pentesting.sh
A fork of osx-for-hackers for my personal pentesting setup preferences
# OSX for Pentesting (Mavericks/Yosemite)
#
# A fork of OSX for Hackers (Original Source: https://gist.github.com/brandonb927/3195465)
#!/bin/sh
# Ask for the administrator password upfront
echo "Have you read through the script prior to running this? (y or n)"
read bcareful
@mluis
mluis / Dockerfile-recovery.sh
Created October 5, 2017 13:52
Script to recover Dockerfile from Docker image
#!/usr/bin/env sh
# (run)$ ./Dockerfile-recovery.sh <IMAGE ID>
docker history --no-trunc "$1" | sed -n -e 's,.*/bin/sh -c #(nop) \(MAINTAINER .*[^ ]\) *0 B,\1,p' | head -1
docker inspect --format='{{range $e := .Config.Env}}
ENV {{$e}}
{{end}}{{range $e,$v := .Config.ExposedPorts}}
EXPOSE {{$e}}
@mluis
mluis / share-screen-osx-docker.sh
Last active October 5, 2017 18:55
Share screen between OSX and Docker
#!/usr/bin/env bash
brew install socat xquartz && open -a XQuartz
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\" &
display_number=`ps -ef | grep "Xquartz :\d" | grep -v xinit | awk '{ print $9; }'`
ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
# eg. docker ... -e DISPLAY=$ip$display_number -it <container> bash
@mluis
mluis / share-osx-xquartz.sh
Created October 5, 2017 18:47
share osx XQuartz
brew cask install xquartz
open -a XQuartz
# In the XQuartz preferences, go to the “Security” tab and make sure you’ve got “Allow connections from network clients”
iface="en1" #Wifi
ip=$(ifconfig $iface | grep inet | awk '$1=="inet" {print $2}')
xhost + $ip
docker run -d --name firefox -e DISPLAY=$ip:0 -v /tmp/.X11-unix:/tmp/.X11-unix jess/firefox
@mluis
mluis / GifJS.asm
Created November 9, 2017 14:11 — forked from cmbaughman/GifJS.asm
How to execute JavaScript from a GIF!
; a hand-made GIF containing valid JavaScript code
; abusing header to start a JavaScript comment
; inspired by Saumil Shah's Deadly Pixels presentation
; Ange Albertini, BSD Licence 2013
; yamal gifjs.asm -o img.gif
WIDTH equ 10799 ; equivalent to 2f2a, which is '/*' in ASCII, thus starting an opening comment