亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb

首頁 > 學院 > 開發設計 > 正文

轉:Cracking Sublime Text 3

2019-11-14 12:00:04
字體:
來源:轉載
供稿:網友

Auther: Fernando Domínguez Delgado

OS X native software is written in Objective-C, a superset of C which is not very hard to hack away. In this post I will try to demonstrate the basics of reverse engineering in said platform.

The goal

Our goal will be to stop the annoying Sublime Text pop-up from reminding you to buy a license each now and then (but you totally should if you are going to use it). I will be using Sublime Textlatest build in the time of writting, 3114, for OS X 64-bit.

For the disassembling + patching I will be using Hopper, a disassembler for Mach0 and ELFexecutables which also PRovides handy C-like pseudo-code.

Requisites

Basic software development experienceBasic assembly knowledgeBasic C knowledge

Getting started

First time you open a disassembled binary it looks scary. There is a ton of code and it is not very readable, so we need some references to get started. Strings are a good starting point as they are coded as clear text ASCII in the binary itself.

In this case it is a particularly good idea as what we are trying to do is stop a string from showing. So, to begin with, we'll be searching for the string contained on the pop-up with Hopper's built in string search.

 

 The string is found on 0x0000000100480a36 and it is only referenced by 0x0000000100072ad0. If you hop to that address you will find yourself in an asm procedure. This procedure can only be the one that shows the pop-up, as it is the only reference to the string shown in the pop-up. Nevertheless, to gain a better understanding of what this procedure does let's use the asm to pseudo-code functionality built on Hopper.

int maybe_show_nag_screen()() {      if (*(int8_t *)_g_valid_license == 0x0) {            rax = time_now_milliseconds();            rbx = rax;            rax = rax - *maybe_show_nag_screen()::last_show_time;            if (rax >= 0xa4cb80) {                    *(int32_t *)maybe_show_nag_screen()::count_since_last_nag = *(int32_t *)maybe_show_nag_screen()::count_since_last_nag + 0x1;                    rax = rand();                    rax = (rax & 0xf) == 0x0 ? 0x1 : 0x0;                    rdx = *(int32_t *)maybe_show_nag_screen()::count_since_last_nag;                    rcx = rdx <= 0x2 ? 0x1 : 0x0;                    if (rdx <= 0x8) {                            rax = rax & rcx;                            COND = rax == 0x0;                            if (!COND) {                                    *(int32_t *)maybe_show_nag_screen()::count_since_last_nag = 0x0;                                    *maybe_show_nag_screen()::last_show_time = rbx;                                    rax = px_show_message_ok_cancel(0x0, "Hello! Thanks for trying out Sublime Text./n/nThis is an unregistered evaluation version, and although the trial is untimed, a license must be purchased for continued use./n/nWould you like to purchase a license now?", "This is an unregistered copy", "Purchase");                                    if (rax != 0x0) {                                            rax = px_open_url("https://www.sublimetext.com/buy");                                    }                            }                    }                    else {                            *(int32_t *)maybe_show_nag_screen()::count_since_last_nag = 0x0;                            *maybe_show_nag_screen()::last_show_time = rbx;                            rax = px_show_message_ok_cancel(0x0, "Hello! Thanks for trying out Sublime Text./n/nThis is an unregistered evaluation version, and although the trial is untimed, a license must be purchased for continued use./n/nWould you like to purchase a license now?", "This is an unregistered copy", "Purchase");                            if (rax != 0x0) {                                    rax = px_open_url("https://www.sublimetext.com/buy");                            }                    }            }    }    return rax;}The code is pretty self explanatory. If _g_valid_license is 0x0, i.e: FALSE and the pop-up has not been shown for a while, show it. Now, to the asm.

If we take into account that a C if is encoded as a cmp and some sort of jump statement we can clearly see that the if statement is contained in the following statements:

cmp byte [ds:_g_valid_license], 0x0  jne 0x100072b0  

as cmp byte [ds:_g_valid_license], 0x0 compares _g_valid_license to 0x0 and jne 0x100072b0jumps to the specified address if the comparison 'returned' not equal, i.e: the license is valid, efectively skipping the part of the procedure that shows the pop-up.

So in order not to launch the pop-up ever again we can simply change the jne statement for an unconditional jump statement, jmp, to the same address.

We can do that from Hopper itself pressing ?A on the jne line. Once you modify this line Hooper will lose track of what kind of data this is, thus the sections will be highlighted in white instead of the light yellow we had before. To solve this you can click on the first line and tag it as "P(rocedure)" on the top bar icon. Once you tag the procedure again Hooper will show the part we skipped in white to signal that it is no longer reachable. Furthermore, if you switch to pseudo-code again it will show this:

int maybe_show_nag_screen()() {      CMP(*(int8_t *)_g_valid_license, 0x0);    return rax;}

Aand that's pretty much it, the license pop-up will not bother you again. But that does not feel like we achieved much, does it? Although we achieved our goal we didn't register the product, we didn't fiddle with the licensing methods nor we generated a keygen.

Moving further

Licensing

We are following the same approach for this part. We know that if we introduce an invalid license the following shows up.

And that looks like a string we could use as an initial reference. If we jump to the procedure that references the string we come up with the following:

int license_window::on_ok_clicked()() {      r15 = rdi;    TextBuffer::str();    toUtf8(var_30);    if ((var_48 & 0x1) != 0x0) {            Operator delete(var_38);    }    *(int8_t *)_g_valid_license = 0x0;    if ((*(int8_t *)_g_license_name & 0x1) == 0x0) {            *(int8_t *)0x100677959 = 0x0;            *(int8_t *)_g_license_name = 0x0;    }    else {            *(int8_t *)*0x100677968 = 0x0;            *0x100677960 = 0x0;    }    *(int32_t *)_g_license_seats = 0x0;    rax = var_30 & 0xff;    if ((rax & 0x1) == 0x0) {            rax = rax >> 0x1;    }    else {            rax = var_28;    }    if (rax != 0x0) {            rax = check_license(var_30, _g_license_name, _g_license_seats, var_4C);            *(int8_t *)_g_valid_license = COND_BYTE_SET(E);            if (rax == 0x1) {                    encode_decode_license(var_30);                    get_license_path();                    if ((var_68 & 0x1) == 0x0) {                            rdi = var_67;                    }                    else {                            rdi = var_58;                    }                    rdx = var_30 & 0xff;                    if ((rdx & 0x1) == 0x0) {                            rsi = var_2F;                            rdx = rdx >> 0x1;                    }                    else {                            rdx = var_28;                            rsi = var_20;                    }                    rbx = write_file(rdi, rsi, rdx, 0x1);                    std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(var_68);                    if (rbx == 0x0) {                            r14 = control::get_px_window();                            get_license_path();                            rax = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::insert(var_98, 0x0, "Unable to write license file: ");                            var_70 = *(rax + 0x10);                            rcx = *rax;                            var_80 = rcx;                            *(rax + 0x10) = 0x0;                            *(rax + 0x8) = 0x0;                            *rax = 0x0;                            if ((var_80 & 0x1) == 0x0) {                                    rsi = var_7F;                            }                            else {                                    rsi = var_70;                            }                            px_show_message(r14, rsi);                            std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(var_80);                            std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(var_98);                    }                    create_thread(notify_license_entered_thread(void*), sign_extend_64(var_4C));                    rax = var_4C;                    if ((rax > 0xcf20b) && (rax > 0xab247)) {                            rax = control::get_px_window();                            px_show_message(rax, "Thanks for purchasing!");                    }                    else {                            rax = control::get_px_window();                            px_show_message(rax, "Thanks for trying out Sublime Text 3!/n/nSublime Text 3 is a paid upgrade from Sublime Text 2, and an upgrade will be required for use when 3.0 is released./n/nUntil then, please enjoy Sublime Text 3 Beta.");                    }            }            else {                    if (rax != 0x4) {                            if (rax == 0x3) {                                    rax = control::get_px_window();                                    px_show_error(rax, "That license key is no longer valid.");                            }                            else {                                    if (rax == 0x2) {                                            rax = control::get_px_window();                                            px_show_error(rax, "That license key doesn't appear to be valid./n/nPlease check that you have entered all lines from the license key, including the BEGIN LICENSE and END LICENSE lines.");                                    }                            }                    }                    else {                            rax = control::get_px_window();                            px_show_error(rax, "That license key has been invalidated, due to being shared./n/nPlease email sales@sublimetext.com to get your license key reissued.");                    }            }    }    else {            get_license_path();            if ((var_B0 & 0x1) == 0x0) {                    rdi = var_AF;            }            else {                    rdi = var_A0;            }            delete_file(rdi);            std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(var_B0);    }    if (*(r15 + 0x150) != 0x0) {            std::__1::function<void (r15 + 0x130);    }    rdi = *(r15 + 0x28);    rax = *rdi;    rax = *(rax + 0x88);    (rax)(rdi);    rax = std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string(var_30);    return rax;}Now, if we have a closer look at the top lines we can see that the license checking is taking place in these lines:

rax = check_license(var_30, _g_license_name, _g_license_seats, var_4C);              *(int8_t *)_g_valid_license = COND_BYTE_SET(E);

And depending on the value of rax one action or another will take place. Judging by the strings contained on the if blocks these are the possible outcomes of check_license by return value:

0x1: License is valid, as the message Thanks for purchasing will show.0x2: License is invalid, as the message That license key doesn't appear to be valid./n/nPlease check that you have entered all lines from the license key, including the BEGIN LICENSE and END LICENSE lines.is printed.0x3: The license is no longer valid.0x4: The license has been invalidated due to piracy.

So, if we change the if comparison from 0x1 to 0x2 we will have our random string registered.

Going back to the asm code is pretty obvious that this comparison is taking place in these lines:

As the check_license subroutine is being called and the outcome (rax) is being compared to 1. Now, let's change that 1 to a 2.

And.

Tada!


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
亚洲香蕉成人av网站在线观看_欧美精品成人91久久久久久久_久久久久久久久久久亚洲_热久久视久久精品18亚洲精品_国产精自产拍久久久久久_亚洲色图国产精品_91精品国产网站_中文字幕欧美日韩精品_国产精品久久久久久亚洲调教_国产精品久久一区_性夜试看影院91社区_97在线观看视频国产_68精品久久久久久欧美_欧美精品在线观看_国产精品一区二区久久精品_欧美老女人bb
亚洲风情亚aⅴ在线发布| 中文字幕免费精品一区| 久热国产精品视频| 欧美成人免费一级人片100| 欧美日韩国产色视频| 国产精品国产三级国产aⅴ9色| 91在线视频成人| 久久久精品免费| 亚洲天堂av网| 亚洲国产成人在线视频| 日韩欧美国产网站| 亚洲第一精品自拍| 亚洲欧美综合精品久久成人| 亚洲精品视频免费在线观看| 亚洲性日韩精品一区二区| 欧美日韩国产综合新一区| 国产精品久久综合av爱欲tv| 色婷婷**av毛片一区| 国产欧美精品久久久| 中文字幕亚洲一区二区三区五十路| 伊人男人综合视频网| 欧美在线视频网| 久久不射热爱视频精品| 91久久精品在线| 欧美大片第1页| 日韩中文在线不卡| 日本久久久久久久久| 2019中文字幕在线| 在线免费看av不卡| 久久高清视频免费| 性欧美激情精品| 欧美激情精品久久久久久蜜臀| 成人午夜高潮视频| 91久久精品日日躁夜夜躁国产| 亚洲aⅴ男人的天堂在线观看| 亚洲欧美精品中文字幕在线| 国产精品美女www| 成人免费视频网址| 色噜噜狠狠狠综合曰曰曰| 国产精品网红福利| 久久人91精品久久久久久不卡| 欧美日本在线视频中文字字幕| 日本高清不卡在线| 久久久久久尹人网香蕉| 亚洲欧美综合精品久久成人| 国产亚洲欧美日韩美女| 性色av一区二区三区| 欧美天堂在线观看| 日韩精品中文字幕在线| 精品国产欧美成人夜夜嗨| 久久精品免费播放| 久久视频免费在线播放| 91精品国产一区| 日韩有码在线视频| 91成人天堂久久成人| 日韩欧美精品在线观看| 国产亚洲精品久久久优势| 欧洲美女7788成人免费视频| 亚洲人成在线观看网站高清| 国产91精品久久久久久| 国产精品自产拍在线观| 日韩欧美在线国产| 欧美亚洲一级片| 久久成人av网站| 欧美极品少妇xxxxx| 日韩女在线观看| 国产精品第七十二页| 7m精品福利视频导航| 亚洲精品日产aⅴ| 国产亚洲成精品久久| 久久九九亚洲综合| 欧美老妇交乱视频| 亚洲人精品午夜在线观看| 国产日韩在线免费| 国产热re99久久6国产精品| 日韩av中文字幕在线播放| 大量国产精品视频| 69国产精品成人在线播放| 日韩三级成人av网| 91精品国产网站| 欧美巨乳在线观看| 奇米一区二区三区四区久久| 亚洲欧美激情四射在线日| 国产精品一区专区欧美日韩| 国产欧美精品一区二区| 亚洲第一级黄色片| 久久国产精品偷| 影音先锋欧美精品| 欧美激情videos| 欧美一级电影在线| 日韩欧美成人精品| 国产精品入口夜色视频大尺度| 欧美大片在线看| 日本亚洲欧洲色| 欧美黑人性生活视频| 不用播放器成人网| 亚洲成人xxx| 一区二区成人精品| 日本19禁啪啪免费观看www| 久久久国产一区二区| 中文字幕精品视频| 成人www视频在线观看| 日韩av一区在线观看| 日韩欧美在线网址| 国产精品伦子伦免费视频| 久久精视频免费在线久久完整在线看| 91色精品视频在线| 亚洲影视中文字幕| 国产精品美乳一区二区免费| 亚洲va久久久噜噜噜| 亚洲人成免费电影| 狠狠躁夜夜躁人人爽天天天天97| 亚洲欧洲在线免费| 日韩电影大全免费观看2023年上| 久久免费视频在线| 91探花福利精品国产自产在线| 成人高h视频在线| 亚洲www永久成人夜色| 国产99久久久欧美黑人| 亚洲综合日韩中文字幕v在线| 亚洲老头老太hd| 欧美性猛交xxxx乱大交3| 国产视频自拍一区| 国产亚洲a∨片在线观看| 亚洲综合中文字幕在线观看| 国产精品第一页在线| 久久影视电视剧免费网站| 国产欧美一区二区白浆黑人| 欧美午夜影院在线视频| 91久久精品美女| 亚洲免费视频在线观看| 欧美精品在线视频观看| 久久久伊人日本| 国产视频一区在线| 亚洲电影天堂av| 91久久在线播放| 国产精品视频久久久| 色综合久久精品亚洲国产| 狠狠色噜噜狠狠狠狠97| 亚洲欧美日韩国产成人| 国产婷婷97碰碰久久人人蜜臀| 欧美日韩国产91| 国产精品白嫩初高中害羞小美女| 91av在线播放视频| 国产视频精品一区二区三区| 91精品国产乱码久久久久久蜜臀| 欧美日韩爱爱视频| 亚洲激情在线观看| 欧美精品国产精品日韩精品| 欧美国产在线视频| 国产精品吴梦梦| 国产91精品久| 欧美激情在线观看视频| 国产精品一区二区女厕厕| 色一区av在线| 亚洲精品丝袜日韩| 一区二区成人av| 亚洲情综合五月天| 亚洲四色影视在线观看| 国产精品入口夜色视频大尺度| 欧美日韩国产综合视频在线观看中文| 成人免费淫片视频软件| 成人性教育视频在线观看| 亚洲影院色在线观看免费|