Skip to content

Instantly share code, notes, and snippets.

@yohanes
yohanes / rsa.diff
Created April 15, 2014 03:24
diff against http://cseweb.ucsd.edu/~hovav/papers/hs09.html for recreating private key from corrupted file. note you must fix the modulus from public key (openssl pkey -pubin -in public.pub -text -noout). See http://rentjong-team.blogspot.com/ for more info.
diff -ruN rsabits-orig/rsa.C rsabits/rsa.C
--- rsabits-orig/rsa.C 2014-04-15 10:09:53.406244277 +0700
+++ rsabits/rsa.C 2014-04-15 10:15:55.666047590 +0700
@@ -40,6 +40,8 @@
// C:
#include <sys/types.h>
+#include <stdio.h>
+#include <string.h>
#include <unistd.h>
@yohanes
yohanes / corrupted.pem
Created April 15, 2014 03:38
Example corrupted rsa key.
Private-Key: (1024 bit)
modulus :
00:db:fa:bd:b1:49:5d:32:76:e7:62:6b:84:79:6e:
9f:c2:0f:a1:3c:17:44:f1:0c:8c:3f:3e:3c:2c:60:
40:c2:e7:f3:13:df:a3:d1:fe:10:d1:ae:57:7c:fe:
ab:74:52:aa:53:10:2e:ef:7b:e0:09:9c:02:25:60:
e5:7a:5c:30:d5:09:40:64:2d:1b:09:7d:d2:10:9a:
e0:2f:2d:cf:f8:19:8c:d5:a3:95:fc:ac:42:66:10:
78:48:b9:dd:63:c3:87:d2:53:8e:50:41:53:43:04:
20:33:ea:09:c0:84:15:5e:65:2b:0f:06:23:40:d5:
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#define UPDC32(octet, crc) (crc_32_tab[((crc >> 24 ) ^ (octet)) & 0xff] ^ ((crc) << 8))
static uint32_t crc_32_tab[] = { /* CRC polynomial 0xedb88320 */
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9,
@yohanes
yohanes / guess-hitb2014c3.py
Created October 26, 2014 11:45
Guess challenge 3 HITB2014
import socket
import re
import time
def recv_until(st):
ret = ""
while st not in ret:
ret += s.recv(8192)
return ret
@yohanes
yohanes / pcap-hitb2014c2.py
Created October 26, 2014 11:46
Extract data from pcap Challenge 2 HITB2014
f = open("c2.pcap", "r")
lines = f.readlines()
for l in lines:
if ("G01" in l):
print l[l.index("G01"):]
@yohanes
yohanes / multisock.py
Created October 26, 2014 11:48
Daemon 2 HITB2014
#!/usr/bin/python
import select
import socket
import struct
import sys
ports_list=[]
for i in range(5000, 64000/4):
@yohanes
yohanes / s4.c
Created October 26, 2014 11:50
Daemon 4 .so HITB2014
#define _GNU_SOURCE /* See feature_test_macros(7) */
#define _XOPEN_SOURCE /* See feature_test_macros(7) */
#include <time.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
time_t time(time_t *t)
{
@yohanes
yohanes / brute4.py
Created October 26, 2014 11:50
Daemon 4 .so HITB2014
import socket
import sys
import time
def recv_until(st):
ret = ""
while st not in ret:
ret += s.recv(8192)
return ret
@yohanes
yohanes / d4.py
Created October 26, 2014 11:51
Daemon 4 attacker HITB2014
import socket
import sys
def recv_until(st):
ret = ""
while st not in ret:
ret += s.recv(8192)
return ret
a = open("timemap.txt", "r")
@yohanes
yohanes / dalton.js
Created October 26, 2014 11:54
Dalton's Corporate Security Safe for Business
<script>var a=c.getContext('2d');
var e=a.createLinearGradient(0,0,c.width,0);
var s=(3).toString(36);
e.addColorStop('0','#c53ec9');e.addColorStop('1.0','#b3baf3');
a.fillStyle=e;a.font='bold 12px verdana';a.fillText(s,22,19);
var s=(9).toString(36);var v=a.createLinearGradient(0,0,c.width,0);
v.addColorStop('0','#884431');v.addColorStop('1.0','#c33861');
a.fillStyle=v;a.font=' 12px Gerogia';a.fillText(s,70,15);
var e=a.createLinearGradient(0,0,c.width,0);e.addColorStop('0','#c4ec8c');
var n=/b/.source;e.addColorStop('1.0','#825952');a.fillStyle=e;