Code Monkey home page Code Monkey logo

unnpk's Introduction

unnpk

解包网易neox游戏npk包

Build

Depend

  • MacOS

      brew install libmagic
    
  • CentOS

      sudo yum install file-libs file-devel
    

Clone and make

git clone https://github.com/YJBeetle/unnpk
cd unnpk
make

Run

./unnpk npk_file unnpk_direcory

如何解开阴阳师的script.npk

以下将会大致讲解如何解开阴阳师的script.npk

这里将会使用 MacOS ,其他建议使用 FreeBSD & Linux,相关命令也自行理解替换为你的操作系统使用的命令,不建议使用 Windows 太折腾了.

如果您有任何希望补充的欢迎pr

准备工作

按照前文所示编译好unnpk

安装Python2.7

brew install python2

pip安装以下需要的一些依赖

pip install rotor

安装uncompyle2

git clone https://github.com/wibiti/uncompyle2.git
cd uncompyle2
python setup.py install

开始解包

./unnpk script.npk script

取出一个解开后的文件,比如这里将会使用 0A0D60DC 这个文件作为案例

首先进行解密, tools/script_redirect.py 这个文件是根据通过逆向阴阳师得到的 redirect.py 改写而来

./tools/script_redirect.py 0A0D60DC > 0A0D60DC.out

纠正 opcode(这里的pyc_decryptor.py感谢fate0的文章: fate0的博客(已删除) | 备份1 | 备份2

./tools/pyc_decryptor.py 0A0D60DC.out 0A0D60DC.pyc

反编译

uncompyle2 -o 0A0D60DC.py 0A0D60DC.pyc

至此反编译完毕

注意⚠️

这里只是演示了解开阴阳师的方法,至于网易其他的游戏,redirect.py中的asdf_dn、asdf_dt、asdf_df可能不同(也有可能相同)

这里顺便再说一下如何获取具体的redirect.py的方法吧,在 @fate0 的文章中,他使用动态调试的方法获取到了redirect.pyc,那么问题是redirect.pyc储存在哪里呢,事实上redirect.pyc就储存在script.npk里,以阴阳师2018-03-27更新的3.0.3(1)版本为例,redirect.pyc就是用本工具解开的FB54F059这个文件(文件名用npk中的偏移量命名),这里为各位解包其他游戏提供思路,具体是如何找到这个文件,方法很多,各位可自行去分析特征。

unnpk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unnpk's Issues

UnboundLocalError: local variable 'n' referenced before assignment

Hi @YJBeetle, I m trying to reverse another NetEase NeoX Game, Eve Echoes. Your unnpk make a great job unpacking script.npk. I think all the files were unpacked, but when I try to decrypt, some of them failed like this:
https://www.mediafire.com/file/6hiff3ypxne31ct/0B103ACD.out/file

$ ./unnpk/tools/pyc_decryptor.py ./script/application/octet-stream/0B103ACD.out ./0B103ACD.pyc
...
./unnpk/tools/pymarshal.py", line 241, in _transform_opcode
    opcode[c] = n
UnboundLocalError: local variable 'n' referenced before assignment

As you stated, looks like file FB54F059 is the redirect.pyc, but I fails decrypting, or decompyling it:
https://www.mediafire.com/file/rs7gxahpoe34r9s/FB54F059/file
Maybe it will help to decrypt all the files, but I dont know how to handle it.

At this point I´m stuck.

I got a lot of source files and resources, but what I really want to grab is the game's staticdata. The problem is that the py missing files contains the key methods to read .sd files I need.

Any help would be greatly apreciated.

mac os 下编译出错

gcc unnpk.c -o unnpk -lz -lmagic -std=gnu99
unnpk.c:8:10: fatal error: 'magic.h' file not found
#include <magic.h>
^~~~~~~~~
1 error generated.

阴阳师桌面版是个怎样的程序?

我想了解一下这个桌面版的阴阳师,它有别于其他安卓模拟器,是怎样运作的?
了解到的是它使用OpenGL绘制3D,但是夜神模拟器也有使用OpenGL的选项。

解包 npk 文件时提示`Data is not zlib`

尝试解 ios 网易的哈利波特,解包的时候提示

W: Uncompress failed!
Z_DATA_ERROR: Data is not zlib, The raw data will be output

image

十六进制看了下 npk 文件的"索引表":

image

(箭头指的是索引表开始的位置)不知道分隔符是02 00 10 00是不是正常:

image

解出来的文件头部大都是:
image


不知道上面解包出来的文件是否能用,然后是不是需要去取得 asdf_dn、asdf_dt、asdf_df 和 opcode map 等东西?能有其他方法获得吗,不太会用 IDA


另外想问一下获取游戏的资源文件(音频模型等是否就能直接用 script 里解出来的 asdf_dn、asdf_dt、asdf_df 和 opcode map 等?

Mistake or intentional?

unnpk.c:8:10: fatal error: 'magic.h' file not found
Is this a mistake? Did you forget to add a file or is it intentional?

FB54F059自身是不是不能被还原成.out?(输出0字节)

纯小白一只(甚至不懂Linux和Python),本来想着研究下百鬼修改,一步步靠着谷哥度娘成功跑起来了,想分享下根据fz和楼主两位大佬的步伐的研究成果
通过c32发现script.npk中,从索引表开始(索引表位置记录在0x14处,例如楼主大大的版本入口在00D476C4)第一列 就是偏移量(倒着写的),即解包后的文件名;第二列没分析出来是啥;第三列与第四列重复,即解包后的文件大小(也是倒着写的),但是FB54F059文件 第三列与第三列却不同,第三列是94 04 00 00(1172字节),第四列是60 09 00 00(2400字节)与解包后显示的2.4k吻合。第五列和第六列数据重复(FB54F059不同),第7列均为00 00 00 00(FB54F059为10 00 00 00)。通过c32分析很容易发现FB54F059这个文件与众不同(可能可以通过这个来确定redirect?)
qq 20181202052535
qq 20181202144108

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.