Uzun süre .net ortamında uygulama geliştirenler gerek assembly yapısı gerek metadata yapısı gerekse de IL ile azçok ilgilenecekleri olaylarla karşılaşmışlardır. Bundan önceki bazı blog girdilerinde bu amaca yönelik çeşitli çözüm yolları ve araçlardan (Reflector, Fox , CFF Explorer gibi) bahsetmiştik. Yine benzer bir araç ile var olan exe ya da dll leri (biz kısaca kaynak kodu bizde olmayan assembly ler diyelim) açıp kendi kaynak kodlarımızı ekledikten sonra (bir nevi patched işlemi diyebiliriz) değişiklikleri assembly üzerine kaydedip kullanmaya devam edebiliriz.

Eminim herkesin anlayacağı bir örnek ile ne anlatmaya çalıştığımı kısaca özetleyeyim. Bir arkadaşımız bir uygulama yazmış, size göndermiş kullanmanız için. Ama ne hikmetse uygulama başlamadan önce şifre , serial, activation key vs ... istiyor.Siz de birazdan bahsedeceğim yol ile bu assemblyyi açıp şifre soran kod kısmını istediğiniz gibi değiştirip kaydettiğinizde artık aynı uygulamayı şifresini bilmeden de kullanabilirsiniz ;)

Örnek uygulamamızın ekran görüntüsü aşağıdaki gibidir. Program, textbox'a istenilen değeri girdikden sonra buton'a basıldığında eğer girilen değer doğru ise sihirli sayıyı göstermekte, yanlış ise hata mesajı vermektedir. Biz de şu işe bakın ki textbox'a ne yazacağımızı bilmiyoruz ;)

Koddan da görebileceğimiz gibi basit bir string karşılaştırma işlemi yapılmaktadır. O zaman bu kısmı değiştirdiğimizde sorunumuz hallolacaktır. Ha bu arada kodlar bizde değildi nasıl gördük ki kodları diyorsanız Fox Decompiler ve Reflector uygulamaları hakkında bilgi edinmeniz gerekecektir.

Şimdi kolları sıvadıktan sonra reflector uygulamamıza assembly'yi resmen bir text dosyasıymış gibi editleten bir plug-in kuracağız ve bu da Reflexil sayesinde gereçekleştirebiliriz. Reflexil'i şurdaki adresten indirdikten sonra zipli dosya içerisindeki reflexil.dll'i Reflector uygulamasına  plug'in olarak kurabiliyoruz.

Plug-ini ekledikten sonra Reflector ile uygulamamızı açıp, CheckKey() metodunu disassemble ediyoruz. Reflector'un Tools menüsünden az önce exlediğimiz Reflex'il plug-in nin çıktığı göreceğiz.Buna tıkladığımızda ise hemen alt kısımda ilgili kodun IL'ini görebiliriz.Bu kısıma sağ tıkladığınızda gelen menüden editleme, silme ve kod ekeleme işlemlerinin yapıladığı menülerden yapacağımız işleme göre hareket edebiliriz.

Aslında burda editleme işlemi için iyi bir IL bilgisi gerektiğini görmekteyiz. Ama context menüdeki "Replace all with code" menüsü tüm bu sorunları ortadan kaldırıyor. Reflector'ün ürettiği kodun sadece metodun içindeki kodu kopyaladıkdan sonra Replace all with code menüsünü tıklayalım.Aşağıdaki gibi kopyaladığımız kodu metodun içine kopyaladıkdan sonra istediğimiz değişiklik ve eklemeleri yapalım.Sol alt kısımdakı "Preview IL" butonuna tıkladıkdan sonra Sağ alt kısımdakı Ok butonu aktifleşecektir. Ok dedikten sonra Reflexil yeni kodlarimizi artık injecte etmiştir.

Görüldüğü gibi uygulamaya yeni bir satır eklendi ve metod da eğer "huh!" girilirse false "huh!" dışında bir değer girildiğinde ise true değeri üretecektir :) umarim şifreyi doğru tahmin edecek kadar şanslı değilsinizdir :)

Soldaki ağaçtan assembly mizi seçtiğimizde Reflexil bize uygulamayı kaydetme imkanını verecektir.

Düzenlediğimiz exe'yi kaydedip çalıştırdiğimizda ise aşağıdaki gibi bir sonuç alabiliriz.

 

      

Umarım faydalı amaçlara hitap edecek çalışmalar için sizlere kolaylık sağlayacaktır bu yazı ;)

 Örnek uygulama :

blog_codeinjection.rar (33.98 KB)
 
Sunday, May 24, 2009 7:51:03 AM (GTB Daylight Time, UTC+03:00)
Good afternoon. I have come to the conclusion that politics are too serious a matter to be left to the politicians. Help me! I find sites on the topic: Turbo Tax. I found only this - <a href="http://turbo-tax.biz">turbo tax</a>. California drug rehabilitation treatment center call located in california drug rehab center, substance abuse and alcohol treatment center in. Offers programs to treat drug and alcohol addiction, eating disorders, depression, and more. With love :-), Jaime from Macedonia.
Friday, October 16, 2009 5:47:07 AM (GTB Daylight Time, UTC+03:00)
<h2 align="center">Costs For Uggs--What It Costs?</h2>
<p>--&gt;Are you lusting after a few (or even more) <a href="http://www.goodugg.co.uk/ugg-classic-cardy-c-161.html">Ugg boots</a> and if so, you're in good company, as girls and women of all ages, especially with the simple, slipper-like design of these sheepskin <a href="http://www.goodugg.co.uk/grey-ugg-boots-5819-classic-cardy-p-23458.html">ugg boots sale </a>, which are relatively easy and very comfortable to wear. And they appear to be affected. Some men are also jumping on the trend and luxury UGGs? Australia, the brand also offers a range of contemporary styles for them.</p>
<p>--&gt;Could you mind giving everyone loves from <a href="http://www.goodugg.co.uk/ugg-classic-tall-c-162.html">ugg classic </a>? There are so many types of uggs, <a href="http://www.goodugg.co.uk/ugg-bailey-button-c-178.html?zenid=847c0f495b87cb43928dcc19d09f4019">ugg bailey button</a>,ugg <a href="http://www.goodugg.co.uk/ugg-classic-tall-c-162.html">classic tall</a>, ugg <a href="http://www.goodugg.co.uk/ugg-classic-short-c-160.html">classic short</a>, ugg <a href="http://www.goodugg.co.uk/ugg-classic-cardy-c-161.html">classic cardy</a>. How to choose your favorite? Or do you really want to one uggs regardless its style? Despite their design is awkward and slipper-lile, <a href="http://www.goodugg.co.uk/">Uggs</a> is one of the few stations that are of general interest, have argued that cross generational lines.</p>
<p>--&gt;Young people, students and young mothers and the Middle Ages, the original Black <a href="http://www.goodugg.co.uk/ugg-ultra-tall-c-167.html">Ultra Tall UGG Boots</a>, seem pulled the fleecy-lined boots that are manufactured in Australia, with the best materials. Are you sure that your feet warm in winter without socks, and cool in summer so that is more versatile too? If no, hurry up to take one <strong>ugg boots </strong>on <a href="http://www.goodugg.co.uk/ugg-classic-tall-c-162.html">uggs on sale</a> ! That's why we see people wear them in schools, supermarkets, on the slopes and even in the most popular beaches in the United States and abroad. Many surfers also use uggs to keep their feet warm.</p>
<p>--&gt;What do you really care about? Is its price or quality, or you just following the general trend? You know what are you thinking in your heart!</p>
Saturday, October 24, 2009 3:03:05 PM (GTB Daylight Time, UTC+03:00)
why the ugg bailey<strong> <a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge sale</a> </strong>button boot is so popular? as we known,<strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge boots</a></strong> have morphed together their two most popular styles. they started with the ever-popular <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge sand</a></strong> and then added a wooden <strong><a href="http://www.linkboots.com/ugg-classic-cardy-5819-c-26.html">classic cardy uggs grey</a></strong> from their best-selling, as seen on oprah, uggcardy. they are one pop-fusion<strong> <a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge black</a></strong>. when the new fall step into our life this year, <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge on sale</a></strong> are beginning search for an footwear going together with their jeans. now you are reaching to the every <strong><a href="http://www.linkboots.com/ugg-classic-cardy-5819-c-26.html">classic cardy ugg australia</a></strong> for the latest fashion trend. in past two or<A href="http://www.thegoodboots.com/specials.html" target="_blank"><strong> </strong></A>three years, the <strong><a href="http://www.linkboots.com/ugg-classic-cardy-5819-c-26.html">classic cardy uggs on sale</a></strong> kept women, men and kids <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge boot</a></strong> salewarm and cozy under its super-popular fashion. <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge chestnu</a></strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">t</a> the new fall in 2009, we get<strong> <a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge uk</a></strong>. the <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">knightsbridge uggs</a></strong> become the first choice for ugg follower<strong> <a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge ugg boots</a> </strong>and getting hotter and hotter. the <strong><a href="http://www.linkboots.com/ugg-womens-knightsbridge-c-50.html">ugg knightsbridge uggs on sale</a> </strong>style c the bailey button has become a must have this winter. now<strong> <a href="http://www.linkboots.com/ugg-bailey-button-5803-c-30.html">ugg australia bailey button</a> </strong>there are 5 colors available in 5 colors including black, chestnut, grey, chocolate and sand on<strong> <a href="http://www.linkboots.com/ugg-bailey-button-5803-c-30.html">ugg australia bailey button boot</a></strong>. we provide enough stock for this fall and winter. you <A href="http://www.thegoodboots.com/ugg-classic-cardy-c-2.html" target="_blank"><strong>ugg shoes </strong></A>wil enjoy shopping anytime before this <strong><a href="http://www.linkboots.com/ugg-bailey-button-5803-c-30.html">ugg boots bailey button</a></strong>. anyway, the popular classic styles including <strong><a href="http://www.linkboots.com/ugg-bailey-button-5803-c-30.html">bailey button grey uggs</a></strong>, ugg boot short (5825) and<a href="http://www.linkboots.com/ugg-classic-cardy-5819-c-26.html"> <strong>classic cardy ugg boots</strong></a><strong></strong> are all your choices. tags ?
Saturday, October 31, 2009 2:58:27 AM (GTB Standard Time, UTC+02:00)
Accidentally come here , I am incomparable to enjoy myself when i appreciate your beautiful article from my deep heart
Sunday, November 01, 2009 2:53:58 AM (GTB Standard Time, UTC+02:00)
Thanks for article. Everytime like to read you.<br /><p><a href="http://www.topugg.com/ugg-classic-tall-boots-c-3.html">UGG Classic Tall</a></p>
Thanks for article. Everytime like to read you.<br /><p><a href="http://www.topugg.com/ugg-bailey-button-boots-c-14.html">Ugg Bailey Button </a></p>

Friday, November 06, 2009 3:49:54 AM (GTB Standard Time, UTC+02:00)
Do you want to buy some sheepskin boots, please come to www.findugg.com.Full range of UGG boots for Men and Women to buy online. Fast and free shipping to worldwide, competitive price, high quality, and efficient service.

Read more:http://www.findugg.com
Friday, November 27, 2009 5:23:37 AM (GTB Standard Time, UTC+02:00)
The Ugg Australia Brand by the American company Deckers is a popular maker of Ugg Boots and fashion footwear. As we specialize in Australian made Ugg Boots we do not sell Ugg Australia brand boots on this site but due to popular demand we can offer Ugg Australia Brand at our affiliated site: www.e-uggs.com ;UGG Boots Promise:

* 100% authentic sheepskin for unrivalled comfort
* Durable double stitched construction
* Zero cost exchange
* No additional duties or import fees
* Worldwide trackable shipping with full-cover insurance
* Lushiously thick inner fleece for extreme toastiness
* All ugg boots on www.gouggs.com are free shipping 7 days delivery!
Friday, November 27, 2009 5:24:04 AM (GTB Standard Time, UTC+02:00)
The Ugg Australia Brand by the American company Deckers is a popular maker of Ugg Boots and fashion footwear. As we specialize in Australian made Ugg Boots we do not sell Ugg Australia brand boots on this site but due to popular demand we can offer Ugg Australia Brand at our affiliated site: www.e-uggs.com ;UGG Boots Promise:

* 100% authentic sheepskin for unrivalled comfort
* Durable double stitched construction
* Zero cost exchange
* No additional duties or import fees
* Worldwide trackable shipping with full-cover insurance
* Lushiously thick inner fleece for extreme toastiness
* All ugg boots on www.gouggs.com are free shipping 7 days delivery!
Tuesday, December 22, 2009 3:24:37 AM (GTB Standard Time, UTC+02:00)
20091222c1ygy I wear <a href="http://www.boonoutlet.com/ugg-genuine-womens-nightfall-boots-black-p-1251.html">UGG Nightfall Boots on sale</a>is considered a kind of a fashion trend, this trend has affected the whole world. If you have not tried, then it is regrettable. With the advent of winter, <a href="http://www.boonoutlet.com/ugg-new-arrival-suede-boots-5230-black-p-1279.html">UGG New Arrival Suede Boots </a>online become popular up a lot of people can not wait to experience the feeling of wearing ugg prices ugg some people appear to be high, ugg boots online above ugg style good, <a href="http://www.boonoutlet.com/ugg-boots-gray-carved-in-pattern-on-hot-sale-p-1226.html">UGG Gray classic tall</a> are always welcome to many people as it is high quality and fashion design.For myself,i like this
<a href="http://www.boonoutlet.com/ugg-authority-classic-mini-boot-black-for-women-p-1014.html">UGG Classic Mini Boot </a> very much,you can have it and show yourself now,it is not let you downUgg Napoule Sandal,the price is not expensive. To meet your needs, make haste to experience the feeling of the trend.


Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview