mirror of
https://github.com/botlabsDev/npkpy.git
synced 2025-12-10 06:54:37 +01:00
refactored code
This commit is contained in:
parent
de282a39e7
commit
4a924fb1cc
5 changed files with 14 additions and 16 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
# npkPy
|
# npkPy
|
||||||
The npkPy package module is an unpacking tool for MikroTiks custom NPK container format. The tool is capable
|
The npkPy package module is an unpacking tool for MikroTiks custom NPK container format. The tool is capable
|
||||||
to display to the content of any NPK package and to export all container.
|
to display the content of any NPK package and to export all container.
|
||||||
|
|
||||||
["NPK stands for MikroTik RouterOS upgrade package"](https://whatis.techtarget.com/fileformat/NPK-MikroTik-RouterOS-upgrade-package)
|
["NPK stands for MikroTik RouterOS upgrade package"](https://whatis.techtarget.com/fileformat/NPK-MikroTik-RouterOS-upgrade-package)
|
||||||
and since there is no solid unpacking tool for the format available, I want to share my approach of it.
|
and since there is no solid unpacking tool for the format available, I want to share my approach of it.
|
||||||
|
|
@ -21,6 +21,12 @@ All recent packages are signed with EC-KCDSA signature,
|
||||||
and there's no way to create a valid npk file unless you know a secret key.
|
and there's no way to create a valid npk file unless you know a secret key.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install npkPy
|
||||||
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ if [[ ! -e ${venv} ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
git config user.name "botlabsDev"
|
git config user.name "botlabsDev"
|
||||||
git config user.email "git@botlabs.dev"
|
git config user.email "botlabs.dev@botlabs.dev"
|
||||||
echo "--git config--"
|
echo "--git config--"
|
||||||
echo -n "git user:"; git config user.name
|
echo -n "git user:"; git config user.name
|
||||||
echo -n "git email:"; git config user.email
|
echo -n "git email:"; git config user.email
|
||||||
|
|
|
||||||
10
pytest.sh
10
pytest.sh
|
|
@ -1,11 +1,3 @@
|
||||||
!/bin/bash
|
!/bin/bash
|
||||||
|
|
||||||
if [ ! -z "$1" ]
|
pytest --cov=npkpy --cov=acceptance_test -v
|
||||||
then
|
|
||||||
clear; echo "test specific file: $1"
|
|
||||||
pytest --cov=./ $1 -v
|
|
||||||
else
|
|
||||||
clear; echo "test all project files"
|
|
||||||
pytest --cov=npkpy --cov=acceptance_test -v
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -23,7 +23,7 @@ setuptools.setup(
|
||||||
],
|
],
|
||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': [
|
'console_scripts': [
|
||||||
"npkPy=npkpy.main:main",
|
"npkpy=npkpy.main:main",
|
||||||
# "npkDownloader=npkpy.download:main",
|
# "npkDownloader=npkpy.download:main",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,12 @@ class Test_npkPy(unittest.TestCase):
|
||||||
self.dstFolder.rmdir()
|
self.dstFolder.rmdir()
|
||||||
|
|
||||||
def test_showAllContainersFromNpkPkg(self):
|
def test_showAllContainersFromNpkPkg(self):
|
||||||
cmd = ["npkPy", "--file", self.pathToNpk, "--showContainer"]
|
cmd = ["npkpy", "--file", self.pathToNpk, "--showContainer"]
|
||||||
output = runCmdInTerminal(cmd)
|
output = runCmdInTerminal(cmd)
|
||||||
self.assertEqual(self.npkContainerList, output)
|
self.assertEqual(self.npkContainerList, output)
|
||||||
|
|
||||||
def test_exportAllContainerFromNpk(self):
|
def test_exportAllContainerFromNpk(self):
|
||||||
cmd = ["npkPy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportAll"]
|
cmd = ["npkpy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportAll"]
|
||||||
|
|
||||||
runCmdInTerminal(cmd)
|
runCmdInTerminal(cmd)
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ class Test_npkPy(unittest.TestCase):
|
||||||
'npkPyExport_gps-6.45.6/009_cnt_CntArchitectureTag.raw'], exportedContainer)
|
'npkPyExport_gps-6.45.6/009_cnt_CntArchitectureTag.raw'], exportedContainer)
|
||||||
|
|
||||||
def test_extractSquashFsContainerFromNpk(self):
|
def test_extractSquashFsContainerFromNpk(self):
|
||||||
cmd = ["npkPy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportSquashFs"]
|
cmd = ["npkpy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportSquashFs"]
|
||||||
|
|
||||||
runCmdInTerminal(cmd)
|
runCmdInTerminal(cmd)
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ class Test_npkPy(unittest.TestCase):
|
||||||
|
|
||||||
#
|
#
|
||||||
def test_extractZlibContainerFromNpk_NonExisitngNotExtracted(self):
|
def test_extractZlibContainerFromNpk_NonExisitngNotExtracted(self):
|
||||||
cmd = ["npkPy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportZlib"]
|
cmd = ["npkpy", "--file", self.pathToNpk, "--dstFolder", self.dstFolder.absolute(), "--exportZlib"]
|
||||||
|
|
||||||
runCmdInTerminal(cmd)
|
runCmdInTerminal(cmd)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue