Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
加一个根据从网易阴阳师中libclient.so逆向出来的redirect.pyc的解密方法重写的解密阴阳师(其他游戏暂未尝试)scrip…
…t.npk中脚本的脚本
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import zlib | ||
import argparse | ||
|
||
def _reverse_string(s): | ||
l = list(s) | ||
l = map(lambda x: chr(ord(x) ^ 154), l[0:128]) + l[128:] | ||
l.reverse() | ||
return ''.join(l) | ||
|
||
|
||
def unnpk(data): | ||
asdf_dn = 'j2h56ogodh3se' | ||
asdf_dt = '=dziaq.' | ||
asdf_df = '|os=5v7!"-234' | ||
asdf_tm = asdf_dn * 4 + (asdf_dt + asdf_dn + asdf_df) * 5 + '!' + '#' + asdf_dt * 7 + asdf_df * 2 + '*' + '&' + "'" | ||
import rotor | ||
rotor = rotor.newrotor(asdf_tm) | ||
data = rotor.decrypt(data) | ||
data = zlib.decompress(data) | ||
data = _reverse_string(data) | ||
return data | ||
|
||
def main(): | ||
parser = argparse.ArgumentParser(description='unnpk tool') | ||
parser.add_argument("INPUT_NAME", help='input file') | ||
# parser.add_argument("OUTPUT_NAME", help='output file') | ||
args = parser.parse_args() | ||
input_file = args.INPUT_NAME | ||
# output_file = args.OUTPUT_NAME | ||
# if not output_file: | ||
# output_file = input_file + '.unnpk' | ||
data = unnpk(open(input_file).read()) | ||
# with open(output_file, 'wb') as fd: | ||
# fd.write(data) | ||
print(data) | ||
|
||
if __name__ == '__main__': | ||
main() |