每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,歡迎關注開源日報。交流QQ群:202790710;電報群 https://t.me/OpeningSourceOrg


今日推薦開源項目:《 Android APK 加殼

推薦理由:加殼,加殼的全稱應該是可執行程序資源壓縮,壓縮後的程序可以直接運行。一般來說加殼的目的是為了阻止外部程序或軟體對加殼程序本身的反彙編分析或者動態分析,以達到保護殼內原始程序以及軟體不被外部程序破壞,保證原始程序正常運行。這種技術也常用來保護軟體版權,防止軟體被破解。但對於病毒,加殼可以繞過一些殺毒軟體的掃描,從而實現它作為病毒的一些入侵或破壞的一些特性。

加殼的方式

其實是利用特殊的演算法,對可執行文件里的資源進行壓縮,這個壓縮之後的文件可以獨立運行,解壓過程完全隱蔽,都在內存中完成。它們附加在原程序上通過載入器載入內存後,先於原始程序執行,得到控制權,執行過程中對原始程序進行解密、還原,完成後再把控制權交還給原始程序,執行原來的代碼部分。這可以隱藏程序真正的入口點從而防止被破解。加上外殼後,原始程序代碼在磁碟文件中一般是以加密後的形式存在的,只在執行時在內存中還原,這樣就可以比較有效地防止破解者對程序文件的非法修改,同時也可以防止程序被靜態反編譯。

Apk 加殼原理

在 Android 中沒有經過加密的 Apk 給人的感覺就是在裸奔,通過apktool , dex2jar , AndroidKill 等各式各樣的反編譯工具就可以輕鬆的獲取其 smail 代碼,程序被反編譯以後,對於懂 smail 語法的逆向工程師來說就一覽無餘了。儘可能給自己的 Apk 多採取一些防護措施已經成為了一種必然。

Apk 加殼的步驟:

源 Apk:需要加殼的 Apk

加密的 Apk:源 Apk 經過加密演算法加密後的 Apk

加殼程序 Apk:是有解密源 Apk 和動態載入啟動源 Apk 的外殼

 

開源項目精選: Android APK 加殼

關於 Dex:

他是 Android 系統的可執行文件,包含應用程序的全部操作指令以及運行時數據。當 java 程序編譯成 class 後,還需要使用 dx 工具將所有的class 文件整合到一個 Dex 文件,目的是其中各個類能夠共享數據,在一定程度上降低了冗餘,同時也是文件結構更加緊湊。

文件結構:

開源項目精選: Android APK 加殼

Magic

Magic 數是為了方便虛擬機識別目標文件是否是合格的 Dex 文件,在 Dex文件中 magic 的值固定

checksum

文件校驗碼 ,使用 alder32 演算法校驗文件除去 maigc ,checksum 外餘下的所有文件區域 ,用於檢查文件錯誤

signature

使用 SHA-1 演算法 hash 除去 magic ,checksum 和 signature 外餘下的所有文件區域 ,用於唯一識別本文件 。

file_size

當前Dex 文件的大小 。

改動 Dex 文件實際上是改動它的頭部,即記錄整個 Dex 文件相關屬性的部分。改動其文件效驗碼 checksum 才能讓這個合併後的 Dex 文件是正確的,改動 file_size 來重新設定 Dex 文件的大小,最後在文件的末尾標註上加密後 Apk 的大小,這樣在脫殼時就能得到正確的 Apk 了。

將 Dex 與加密演算法加密後的 Apk 合併生成新的Dex 後需要修改新 Dex 文件的這三個值,為了方便從新 Dex 中獲得加密的 Apk,我們需要知道加密的 Apk 的大小,為了方便以後獲得,我們將其大小放置在新 Dex 的後面。新生成的 Dex 文件結構:

生成新 Dex 後,將加殼程序 Apk 的 Dex 文件替換,重新簽名後加殼的Apk 即完成了。


今日推薦英文原文:《Things You Should Know About Ubuntu 18.04》

原文鏈接:https://itsfoss.com/ubuntu-18-04-faq/ 作者:

推薦理由:關於 Ubuntu 18.04,你應該知道的那些事情,小編先透露的是,默認搭載的桌面環境是 GNOME 3.28 ,代號"Chongqing"!!!

Things You Should Know About Ubuntu 18.04

Ubuntu 18.04 release is just around the corner. I can see lots of questions from Ubuntu users in various Facebook groups and forums. I also organized Q&A sessions on Facebook and Instagram to know what Ubuntu users are wondering about Ubuntu 18.04.

I have tried to answer those frequently asked questions about Ubuntu 18.04 here. I hope it helps clear your doubts if you had any. And if you still have questions, feel free to ask in the comment section below.

What to expect in Ubuntu 18.04

Ubuntu 18.04 Frequently Asked Questions

Just for clarification, some of the answers here are influenced by my personal opinion. If you are an experienced/aware Ubuntu user, some of the questions may sound silly to you. If that』s case, just ignore those questions.

Can I install Unity on Ubuntu 18.04?

Yes, you can.

Canonical knows that there are people who simply loved Unity. This is why it has made Unity 7 available in the Universe repository. This is a community maintained edition and Ubuntu doesn』t develop it directly.

I advise using the default GNOME first and if you really cannot tolerate it, then go on installing Unity on Ubuntu 18.04.

What GNOME version does it have?

At the time of its release, Ubuntu 18.04 has GNOME 3.28.

Can I install vanilla GNOME on it?

Yes, you can.

Existing GNOME users might not like the Unity resembling, customized GNOME desktop in Ubuntu 18.04. There are some packages available in Ubuntu』s main and universe repositories that allows you to install vanilla GNOME on Ubuntu 18.04.

Has the memory leak in GNOME fixed?

Yes. The infamous memory leak in GNOME 3.28 has been fixed and Ubuntu is already testing the fix.

Just to clarify, the memory leak was not caused by Ubuntu. It was/is impacting all Linux distributions that use GNOME 3.28. A new patch was released under GNOME 3.28.1 to fix this memory leak.

How long will Ubuntu 18.04 be supported?

It is a long-term support (LTS) release and like any LTS release, it will be supported for five years. Which means that Ubuntu 18.04 will get security and maintenance updates until April 2023.

When will Ubuntu 18.04 be released?

Ubuntu 18.04 LTS will be released on 26th April. All the participating flavors like Kubuntu, Lubuntu, Xubuntu, Budgie, MATE etc will have their 18.04 release available on the same day.

It seems Ubuntu Studio will not have 18.04 as LTS release.

Is it possible to upgrade to Ubuntu 18.04 from 16.04/17.10? Can I upgrade from Ubuntu 16.04 with Unity to Ubuntu 18.04 with GNOME?

Yes, absolutely. Once Ubuntu 18.04 LTS is released, you can easily upgrade to the new version.

If you are using Ubuntu 17.10, make sure that in Software & Updates -> Updates, the 『Notify me of a new Ubuntu version』 is set to 『For any new version』.

Get notified for a new version in Ubuntu

If you are using Ubuntu 16.04, make sure that in Software & Updates -> Updates, the 『Notify me of a new Ubuntu version』 is set to 『For long-term support versions』.

Ubuntu 18.04 upgrade from Ubuntu 16.04

You should get system notification about the availability of the new versions. After that, upgrading to Ubuntu 18.04 is a matter of clicks.

Even if Ubuntu 16.04 was Unity, you can still upgrade to Ubuntu 18.04 GNOME.

When will I get to upgrade to Ubuntu 18.04?

If you are using Ubuntu 17.10 and have correct update settings in place (as mentioned in the previous section), you should be notified for upgrading to Ubuntu 18.04 within a few days of Ubuntu 18.04 release. Since Ubuntu servers encounter heavy load on the release day, not everyone gets the upgrade the same day.

For Ubuntu 16.04 users, it may take some weeks before they are officially notified of the availability of Ubuntu 18.04. Usually, this will happen after the first point release Ubuntu 18.04.1. This point release fixes the newly discovered bugs in 18.04.

If I upgrade to Ubuntu 18.04 can I downgrade to 17.10 or 16.04?

No, you cannot. While upgrading to the newer version is easy, there is no option to downgrade.  If you want to go back to Ubuntu 16.04, you』ll have to do a fresh install.

Can I use Ubuntu 18.04 on 32-bit systems?

Yes and no.

If you are already using the 32-bit version of Ubuntu 16.04 or 17.10, you may still get to upgrade to Ubuntu 18.04. However, you won』t find Ubuntu 18.04 bit ISO in 32-bit format anymore. In other words, you cannot do a fresh install of the 32-bit version of Ubuntu 18.04 GNOME.

The good news here is that other official flavors like Ubuntu MATE, Lubuntu etc still have the 32-bit ISO of their new versions.

In any case, if you have a 32-bit system, chances are that your system is weak on hardware. You』ll be better off using lightweight Ubuntu MATE or Lubuntu on such system.

Where can I download Ubuntu 18.04?

Once 18.04 is released, you can get the ISO image of Ubuntu 18.04 from its website. You have both direct download and torrent options. Other official flavors will be available on their official websites.

Should I do a fresh install of Ubuntu 18.04 or upgrade to it from 16.04/17.10?

If you have a choice, make a backup of your data and do a fresh install of Ubuntu 18.04.

Upgrading to 18.04 from an existing version is a convenient option. However, in my opinion, it still keeps some traces/packages of the older version. A fresh install is always cleaner.

For a fresh install, should I install Ubuntu 16.04 or Ubuntu 18.04?

If you are going to install Ubuntu on a system, go for Ubuntu 18.04 instead of 16.04.

Both of them are long-term support release and will be supported for a long time. Ubuntu 16.04 will get maintenance and security updates until 2021 and 18.04 until 2023.

However, I would suggest that you use Ubuntu 18.04. Any LTS release gets hardware updates for a limited time (two and a half years I think). After that, it only gets maintenance updates. If you have newer hardware, you』ll get better support in 18.04.

Also, many application developers will start focusing on Ubuntu 18.04 soon. Newly created PPAs might only support 18.04 in a few months. Using 18.04 has its advantages over 16.04.

Will it be easier to install printer-scanner drivers instead of using the CLI?

I am not an expert when it comes to printers so my opinion is based on my limited knowledge in this field. Most of the new printers support IPP protocol and thus they should be well supported in Ubuntu 18.04. I cannot say the same about older printers.

Does Ubuntu 18.04 have better support for Realtek and other WiFi adapters?

No specific information on this part.

What are the system requirements for Ubuntu 18.04?

For the default GNOME version, you should have 4 GB of RAM for a comfortable use. A processor released in last 8 years will work as well. Anything older than that should use a lightweight Linux distribution such as Lubuntu.

Any other questions about Ubuntu 18.04?

If you have any other doubts regarding Ubuntu 18.04, please feel free to leave a comment below. If you think some other information should be added to the list, please let me know.


每天推薦一個 GitHub 優質開源項目和一篇精選英文科技或編程文章原文,歡迎關注開源日報。交流QQ群:202790710;電報群 https://t.me/OpeningSourceOrg