Skip to content

Instantly share code, notes, and snippets.

@otms61
otms61 / Yubico.py
Last active December 30, 2016 03:43
from Crypto.Cipher import AES
from binascii import hexlify, unhexlify
d = {'b': '1', 'c': '0', 'd': '2', 'e': '3', 'f': '4', 'g': '5', 'h': '6', 'i': '7', 'j': '8', 'k': '9', 'l': 'a', 'n': 'b', 'r': 'c', 't': 'd', 'u': 'e', 'v': 'f'}
rd = {'0': 'c', '1': 'b', '2': 'd', '3': 'e', '4': 'f', '5': 'g', '6': 'h', '7': 'i', '8': 'j', '9': 'k', 'a': 'l', 'b': 'n', 'c': 'r', 'd': 't', 'e': 'u', 'f': 'v'}
def modhex2hex(x):
return ''.join([d[i] for i in x])
@otms61
otms61 / r.py
Created December 11, 2016 01:30
#!/usr/bin/python
# -*- coding: utf-8 -*-
import struct
import binascii
def p(a):
return struct.pack("<Q", a)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import struct
import telnetlib
def sock(remoteip, remoteport):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((remoteip, remoteport))
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import struct
import telnetlib
from time import sleep
def sock(remoteip, remoteport):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import struct
import telnetlib
def sock(remoteip, remoteport):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((remoteip, remoteport))
@otms61
otms61 / modhex.py
Created November 15, 2016 15:24
yubico modhex
d = {
'b': '1',
'c': '0',
'd': '2',
'e': '3',
'f': '4',
'g': '5',
'h': '6',
'i': '7',
'j': '8',
@otms61
otms61 / hotp.py
Last active September 3, 2018 05:55
A command-line tool for google authenticator verify code.
import hashlib
import hmac
import time
import struct
import base64
def compute_code(key):
t = int(time.time())
ts = t / 30
@otms61
otms61 / Dockerfile
Created October 30, 2016 03:56
centos6 google authenticator sshd
FROM centos:centos6
RUN yum update -y
RUN yum install -y epel-release
RUN sed -i 's/\#baseurl/baseurl/g' /etc/yum.repos.d/epel.repo
RUN sed -i 's/mirrorlist/\#mirrorlist/g' /etc/yum.repos.d/epel.repo
# setup sshd and pam
RUN yum install -y openssh-server google-authenticator
RUN sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/g' /etc/ssh/sshd_config
@otms61
otms61 / flagen.py
Last active March 18, 2016 09:41
0ctf 2015 flagen pwn script
#!/usr/bin/python
# -*- coding: utf-8 -*-
import socket
import struct
import telnetlib
def sock(remoteip, remoteport):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((remoteip, remoteport))
@otms61
otms61 / Makefile
Last active March 15, 2016 09:23
Inspect process_vm_readv behavior
ALL: sandbox permtest
sandbox:
gcc -m32 -o sandbox sandbox.c
permtest:
gcc -m32 -o permtest permtest.c
clean:
rm sandbox permtest