Skip to content

Instantly share code, notes, and snippets.

View shinh's full-sized avatar

Shinichiro Hamaji shinh

  • Preferred Networks
  • Tokyo, Japan
View GitHub Profile
@shinh
shinh / qoo.rb
Last active May 5, 2021 04:45
DEF CON CTF 2021 Qual back-to-qoo
#!/usr/bin/env ruby
# qoo_run.rb の結果を ruby qoo.rb log として食べさせると secret を出すやつ
c1s = []
c2s = []
p1s = []
wins = []
msgs = []
no_changes = []
@shinh
shinh / forge_dwarf.rb
Last active May 5, 2021 04:27
DEF CON CTF 2021 Qual exploit-for-dummies
#!/usr/bin/env ruby
# Need gold or lld, probably
def File.read(filename)
File.open(filename, 'r:binary') do |f|
f.read
end
end
@shinh
shinh / export
Created December 13, 2021 07:55
export command
pp=$(gdb -q -p $PPID -batch -ex "p (int)getppid()" -ex "quit" | awk '/^\$1 = / {print $3}')
gdb -q -p $pp -batch -ex "p (int)putenv(\"$1\")" -ex "quit"
[0.912186, 2.09844, 2.97607, 4.14946, 5.37743, 6.29846, 6.73902, 7.49435, 8.36626, 8.65255, 8.93503, 9.17226, 9.60044, 10.0415, 10.4127, 10.9737]
[0.913203, 2.14546, 2.93329, 4.15793, 5.37541, 6.29056, 6.72585, 7.49473, 8.36669, 8.65173, 8.92966, 9.18283, 9.59602, 10.0444, 10.4158, 10.9762]
[0.915957, 2.11986, 3.03985, 4.09351, 5.2462, 6.54203, 6.71142, 7.92987, 8.40744, 8.92736, 9.17984, 9.39551, 9.5926, 10.0081, 10.4185, 11]
[0.924493, 2.1302, 2.94256, 4.15317, 5.25912, 6.46091, 6.67396, 7.71306, 8.37245, 8.80263, 9.03436, 9.20792, 9.59715, 9.89134, 10.208, 10.8579]
[0.924812, 2.14028, 2.96557, 4.15362, 5.3745, 6.29662, 6.73848, 7.49589, 8.3685, 8.64838, 8.93194, 9.17155, 9.59795, 10.0437, 10.4161, 10.9813]
[0.927185, 2.1439, 2.93144, 4.14637, 5.37417, 6.3002, 6.72389, 7.49844, 8.37279, 8.6494, 8.93341, 9.17312, 9.59938, 10.0432, 10.4113, 10.9802]
[0.927547, 2.14155, 2.94826, 4.16001, 5.25621, 6.4628, 6.67752, 7.72232, 8.37654, 8.81443, 9.05387, 9.1988, 9.59758, 9.89667, 10.1768, 10.8536]
[0.92812, 2.12867,
@shinh
shinh / README.md
Last active February 26, 2024 09:56
MN-Core2 vsm ゴルフ

https://projects.preferred.jp/mn-core/ で MN-Core2 のエミュレータとアセンブラが公開されたということで、喜び勇んでゴルフ場に足そうと準備してたのですが、ゴルフ場 32bit やんけ!と気付いて悲しくなりました

まぁせっかく標準入出力をつなぐスクリプトを書いたので、 caddy というの経由でゴルフ場の問題を楽しめる手順を説明する gist です。環境は x86-64 の Linux を使ってください

caddy を取ってきます

$ git clone https://github.com/shinh/caddy.git
$ cd caddy
# http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html
require_relative 'binformat'
class FieldrefInfo < Binformat
endian :big
short :class_index
short :name_and_type_index
end
@shinh
shinh / fault.js
Created June 22, 2025 07:23
fault tolerance ierae ctf 2025
fffFunction=lllccc=cccconsole=zz=zzz=tring=Sring=Sting=Strng=Strig=Strin=ccclog=unction=Fnction=Fuction=Funtion=Funcion=Functon=Functin=Functio=onsole=cnsole=cosole=conole=consle=consoe=consol=atob=+00;;
cc=ccc=ccc=ccc=console||console||console;;
ll=lll=lll=lll=ccc.log||ccc.log||ccc.log;;
eee=ggg=ddd=qq=qqq=qqq=qqq=ff=fff=fff=fffff=fff=Function||Function||Function;;
gg=ggg=gggggg=ggg=ggg=`qq=qqq=qqq&&lll('hello');`;;///`;;
dd=ddd=ddd=ddd=`qq=qqq=qqq&&lll('hello');`;;///`;;
ee=eee=eee=eee=`qq=qqq=qqq&&lll('hello');`;;///`;;