at 7:30 PM

CTF Online EAsy Crypto 1 (EASY)

Text yang akan diencrypt adalah seperti ini

GCW ESFLST, HMLSJDSZ AFA:
QZSLQFN R LFSFX PFWJSF GFMFLNF IFS XJINM, 
NSIFM IFS LNLNM HNSYF PNYF IN IZSNF DFSL KFSF. 
SDFBFRZ IFS SDFBFPZ INOTITMPFS QFSLNY, 
IFS FSFP PNYF FPFS QFMNW IN HFPWFBFQF. 
FIF UZS RFYF PNYF FPFS YJWZX GJWYFYFUFS MNSLLF GJWFGFI-FGFI QFRFSDF.
OZBNYFPZ DFSL HFPFU RJXPNUZS YFSUF IFSIFSFS 
ZSYZPRZ MNIZUPZ YJWGZPF. 
BFWSF-BFWSF PJMNIZUFS GJWUJSIFW-UJSIFW RJSFPOZGPFS 
NXDFWFY-NXDFWFY LJYFWFS FOFNG RJSLLJWFPPFS UJSFPZ. 
YFSUF XJPJOFU UZS QZUZY IFWN PJSFSLFS UFIFRZ 
FPZ GJWLJWFP RJSZQNX UFRUQJY, RJRUJWYFMFSPFS PJMNIZUFS.

Clue pertamanya adalah julius, yang berarti ini menggunakan encryption jenis Caesar cipher (http://en.wikipedia.org/wiki/Caesar_cipher), enkripsi jenis ini menggeser karakter tertentu sejumlah x, dan x ini adalah kuncinya.

Untuk mendapatkan kuncinya saya pake sistem bruteforce, karena maksimum jumlah key adalah 26 sebanyak jumlah bilangan (A-Z).

Sebelumnya saya bikin enkriptor dengan python, berikut kodenya
# julius.py
from string import maketrans
def julius(text, shift):
    alpha = unicode('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
    enc = alpha[shift:] + alpha[:shift]

    table = maketrans(alpha, enc);

    return text.translate(table)

Untuk melakukan brute force tidak perlu menggunakan semua text yang akan didecrypt, dalam hal ini saya ambil HMLSJDSZ.

Terlihat Keynya adalah 8, sekarang decrypt semua textnya.
Ternyata masih ada text yang masih dienkripsi, kalo dari kalimat yang muncul "OKE MANTAB, PUTARLAH INI:" saya pikir semua text harus dibalik dulu ternyata tidak. Selanjutnya tinggal diulangi langkah-langkah sebelumnya.
Tinggal ambil beberapa kata dan disearch di google, akan terlihat kalo itu adalah petikan puisi "Aku Kangen" karangan WS Rendra.
Jadi tokoh yang dimaksud adalah WS Rendra (rendra)
at 9:21 PM

Get site ranking with python and beautifulsoup

To get information about site, we can use alexa.com but sometimes we just need some pieces of information like ranking of site global or local country.
In this case i just need that information, when i looking on alexa i found so many information about the target site.
I have some knowledge about python and beautifulsoup library and i try to grep that information with them.

First time i analyzing structure of page of alexa.com, find element of html tag which contains the data.


at 6:00 PM

Newbie using gnuchess

Hari ini tepatnya dini hari tadi, pas ketika lagi bete ngoding akhirnya browsing-browsing ga jelas vi Chromium tapi ternyata internet sangat lambat, karena koneksi IX dari kantor lagi kacau, buat ngebuka satu google.com aja lama banget, tapi yang aneh buka situs Indonesia juga lambat banget, yah.. tingkat keboringan jadi meningkat gara-gara ini

Akhirnya buat ngilangin bosen dari browsing ane main catur, pas nyari di Games ternyata belum ada tuh caturnya,, dengan berat hati (karena koneksi lagi kacau) akhir nginstall via apt-get meski agak lama akhirnya gnuchess sukses dengan gemilang terinstall.

Seperti biasa ketika jalanin aplikasi ane pencet ALT+F2 trus ketik gnuchess  dan dengan penuh semangat kelingking ane menekan Enter and... ga ada muncul apa-apa?? Trus coba lagi dengan metode yang sama, ternyata ga muncul apa-apa juga... Ok its time to googling.. ternyata gnuchess itu cuma engine nya doang, kalaupun ada tampilan ini juga sangat-sangat sederhana sekali.. like this screenshot
at 6:18 AM

php: array_key_exists or isset

I know array_key_exists is a function and isset is a keyword, later, i think array_key_exists and isset in PHP is a same or array_key_exists is shortcut for isset. But when i read  on php manual, there is no document that explains that it is the same or related, so i try to look in php source code, and i got the same answers.
In my mind, array_key_exists is like that :)
boolean array_key_exists (key, arrayName) {
    return isset(arrayName[key]);
}

at 4:31 PM

Default value for return

A few days ago, i try to create a code with PHP, with a function i do a return in function with some values and then i got a mystery about default value for return keyword, to get absolutelly value with this keyword i create a function to test it, like this.

<?php
function defaultValueForReturn(){
   return;
}// now i test it
var_dump (defaultValueForReturn());  ?>

And this is result:


What about with other programming language such as Python, Javascript, etc.
Check this!
at 8:08 PM

Using keyword as method in PHP

As we know, we can't use keyword like if, while in common language programming as function, method or variables, neither does in PHP Programming. Last time, i agree with this condition, but when i learn about Object Oriented Programming i found a way how to make this is possible, i've got a trick how to make keyword as a method or function (as a variable we can do that easily) in PHP Programming.

How to do that?
In PHP Programming there a feature in OOP, as known as with magic method, with this feature we can do a "magic" in PHP. For completed information about it you can click that link.


Keyword as Function.
at 12:00 AM

PHP: Menghitung lama eksekusi sebuah skrip

Untuk apa menghitung lama eksekusi sebuah skrip? Alasan utama adalah performance dari skrip yang dibuat, hal ini bertujuan untuk membandingkan fungsi yang akan digunakan sehingga losstime bisa dikurangi. Dalam pemrograman PHP bisa dilakukan dengan mengambil nilai fungsi microtime(), tentu saja ditambahkan parameter boolean bernilai true agar nilai yang dikembalikan adalah float, karena jika tidak ada parameter yang diberikan maka nilai return dari fungsi ini adalah string.