just another foolish blog

25.10.12

Even Tree problem & my solution

5:54 PM Posted by Eren Yağdıran No comments

You are given a tree (a simple connected graph with no cycles).You have to remove as many edges from the tree as possible to obtain a forest with the condition that : Each connected component of the forest contains even number of vertices
Your task is to calculate the number of removed edges in such a forest.

Input:
The first line of input contains two integers N and M. N is the number of vertices and M is the number of edges. 2 <= N <= 100.
Next M lines contains two integers ui and vi which specifies an edge of the tree. (1-based index)

Output:
Print a single integer which is the answer
Sample Input 
10 9
2 1
3 1
4 3
5 2
6 1
7 2
8 6
9 8
10 8
 
Sample Output :
2
 
Explanation : On removing the edges (1, 3) and (1, 6), we can get the desired result.
Original tree:


Decomposed tree:

Note: The tree in the input will be such that it can always be decomposed into components containing even number of nodes. 


My solution is on pastebin - clickhere

18.10.12

Lets scape Google

8:34 AM Posted by Eren Yağdıran No comments
i just need to have couple of urls in google results

so instead of writing a pure http client for spoofing google , i write some junk of js files to fetch urls from google , without getting banned :)

I used firefox and greasemonkey plugin.

Basically , what this script does that ;


  1. Wait until google ajax request is loaded
  2. parse the body content to obtaion urls by using regular expressions
  3. after those expressions are evaluaded , i send those url to external website by using GET request
  4. After sending is completed , script generates a fake next click event that is for fetching next page.
  5. And again to step 1 until all results are finished
  6. lastly , modify the gonder function in order to adapt your needs


Check out my script here

3.10.12

Mdk CrackME Çözümü & Keygen Yazımı

6:19 AM Posted by Eren Yağdıran , , , , , , , , , , No comments
http://mdkgroup.com/forum/viewtopic.php?p=4455

adresinde yayınlandığı üzere , mdk forumlarına giriş için bir crackme kırılmasını istemektedir.

Şimdi crackme 'yi indirelim ve olly debug adlı programda crackme'yi açalım.



OllyDebug adlı programda göreceğimiz üzere , 00401568 bizim entry pointimiz.

Şimdi Run edelim , user ve seriali sallayalım
0040132A 'ya bir break point koyalım ve calıştıralım



0x0040132A 'ya bir bakalım , burdaki kod username'imiz olan m00dy'yi PUSH layıp call stack'e atıyor ve CALL 00401050 'deki fonksiyona parametre olarak göndermiş oluyor.

şimdi 2 kez f8'e basalım ve eax registerindeki deger => 0xf26DA640

bu kullanıcı adımızı kullanarak olusturan bir değer ve büyük ihtimalle serial' algoritmasında kullanılcagını düşünüyoruz :)

şimdi biraz daha alta iniyoruz ve 004010d0 adresinde baska bir fonksiyon var

0040133E adresine bakarsanız orda TEST EAX,EAX oldugunu goreceksiniz yani uzerindeki fonksiyondan donen degere gore "Invalid Serial" yada "Welcome to Deck  ;) " yazacak :)

şimdi 0040133E adresinin içine bakalım ve algoritmayı cozelim

0x00401255 bir breakpoint koyalım 



Dolayısı ile şifremiz 
CPU Stack  Address   Value      ASCII Comments
0012F9F4  0012F9FD   ASCII "9D2F7F20-9D4AD6B8"

sağ alttan bakıcak olursak , şifremiz neymiş 9D2F7F20-9D4AD6B8 :) nice


şimdi keygen kodlarını ekleyip blogpostuma , bu yazıyı da bitireyim

Keygen Download ( C++ MFC 'de yazıldı , redistribution libraryleri yuklemeniz gerekebilir)











İlk yazdıgım keygenimin ekran görüntüsü :)