Skip to content

Instantly share code, notes, and snippets.

@ptantiku
ptantiku / emolist.js
Created March 31, 2014 16:02
Javascript to print out all emoticons on Facebook. Usage: open javascript console on the browser (e.x. ctrl+shift+j) then paste the code in.
var emolist=[
{"chars" : " :) ", "class" : "emoticon_smile", "name" : "Smiley"},
{"chars" : " :( ", "class" : "emoticon_frown", "name" : "Frown"},
{"chars" : " :P ", "class" : "emoticon_tongue", "name" : "Tongue"},
{"chars" : " :D ", "class" : "emoticon_grin", "name" : "Grin"},
{"chars" : " :o ", "class" : "emoticon_gasp", "name" : "Gasp"},
{"chars" : " ;) ", "class" : "emoticon_wink", "name" : "Wink"},
{"chars" : " :v ", "class" : "emoticon_pacman", "name" : "Pacman"},
{"chars" : " >:( ", "class" : "emoticon_grumpy", "name" : "Gruñón"},
{"chars" : " :/ ", "class" : "emoticon_unsure", "name" : "Unsure"},
@ptantiku
ptantiku / gist:3ef85b4bae7431e77f72
Created May 2, 2014 07:32
counting down time in minutes & seconds to a specific time (ex. 16:00)
watch -n 1 'diff=$(( $(date +%s -d "16:00") - $(date +%s) )); echo $(( $diff / 60 ))":"$(( $diff % 60 ))'
for i in {1..36}
do
curl -s http://www.etda.or.th/etda_website/category/publications.html/page:$i | \
grep -P 'content.*class="news"' | \
sed -re 's/ +//g' -e 's/^.*href="([^"]+)".*>(.*)<\/a>.*/\2\thttp:\/\/www.etda.or.th\1/'
done | tee out.txt
@ptantiku
ptantiku / caesar_solve.rb
Created July 14, 2014 17:26
Caesar Cipher
def shift(str, n)
before = [*'a'..'z'].join
after = [*'a'..'z'].rotate(n).join
str = str.tr(before, after).tr(before.upcase, after.upcase)
return str
end
str = 'Myxqbkdevkdsyxc, iye wkno sd!!'
26.times{|i|
puts "#{i}: #{shift(str,i)}"
@ptantiku
ptantiku / conv_bin2str.s
Last active August 29, 2015 14:15
Convert bit stream into ASCII string
#####################################################################
# converting bit stream into ascii string #
# author: ptantiku #
# #
# compile: gcc conv_bin2str.s -o conv_bin2str #
# usage: conv_bin2str <binary string> #
# example: conv_bin2str 0110100001100101011011000110110001101111 #
#####################################################################
.data
@ptantiku
ptantiku / helloworld.s
Created February 22, 2015 14:41
Hello World in GNU Assembly
.data [5/1908]
hellostr:
.string "Hello World"
.text
.global main
main:
pushq %rbp
movq %rsp, %rbp
@ptantiku
ptantiku / bintree
Created February 25, 2015 16:56
an implementation of binary tree in python
#!/usr/bin/env python3
# binary tree in array
#
# author: ptantiku
#
class Node:
id = 0
data = ""
@ptantiku
ptantiku / mitm_setup
Created April 14, 2015 01:48
MITM setup
# flush all iptables
iptables -F
iptables -t nat -F
# enable port forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward
# set NAT: intranet --> eth1 --> MITM --> eth0 --> internet
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
@ptantiku
ptantiku / chrome_addr_spoof_poc
Last active July 5, 2016 02:46
Google Chrome Address Spoofing
Original: http://seclists.org/fulldisclosure/2015/Jun/108
Modified by: ptantiku
------------------------------------------------------------------------------------
content.html
------------------------------------------------------------------------------------
<html>
<body>
This is not facebook.com! This is EVIL!
<script>
@ptantiku
ptantiku / iconv_bruteforce.rb
Created July 3, 2015 09:57
Convert input.txt to all encoding available in iconv
#!/usr/bin/env ruby
list=`iconv -l`.gsub(/[ \n]/,'').split('//')
list.each do |encode|
out = `iconv input.txt -f #{encode} -c -t UTF-8`
puts "#{encode}\t#{out}"
end