Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit aa33c4b

Browse files
committed
rebase
2 parents 66ed8a3 + fa403eb commit aa33c4b

File tree

13 files changed

+106
-97
lines changed

13 files changed

+106
-97
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ python:
1919

2020
before_install:
2121
- sudo apt-get update -qq
22-
- sudo apt-get install gcc python-socksipy libssl-dev swig p7zip-full unrar ssdeep libfuzzy-dev -qq
22+
- sudo apt-get install gcc python-socksipy libssl-dev swig p7zip-full unrar ssdeep libfuzzy-dev tor -qq
2323
install:
2424
- pip install -U -r requirements.txt
2525
- pip install -U tox-travis

LICENSE

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1+
BSD 3-Clause License
2+
13
Copyright (c) 2013-2016, Claudio "nex" Guarnieri
24
All rights reserved.
35

4-
Redistribution and use in source and binary forms, with or without modification,
5-
are permitted provided that the following conditions are met:
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
68

79
* Redistributions of source code must retain the above copyright notice, this
810
list of conditions and the following disclaimer.
911

10-
* Redistributions in binary form must reproduce the above copyright notice, this
11-
list of conditions and the following disclaimer in the documentation and/or
12-
other materials provided with the distribution.
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
1315

14-
* Neither the name of the {organization} nor the names of its
16+
* Neither the name of the copyright holder nor the names of its
1517
contributors may be used to endorse or promote products derived from
1618
this software without specific prior written permission.
1719

18-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
22-
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25-
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27-
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28-
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2930

3031
Individual Licenses for modules
3132

3233
IDX Module Licensed under the Apache License, Version 2.0. Original Copyright @bbaskin
3334
pymacho Licensed under the GNU License Copyright 2013 Jérémie BOUTOILLE
34-

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
include LICENSE
22
include README.rst
33
include CHANGELOG
4+
include requirements.txt
5+
include requirements-*.txt
46
recursive-include data *.*

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ dist:
1818
python setup.py sdist
1919

2020
clean:
21-
find . -name '*.pyc' -delete
21+
find . -type f -iname '*.pyc' -delete
22+
find . -type d -iname "__pycache__" -delete
2223
rm -rf dist build viper.egg-info

requirements-base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ bitstring==3.1.5
22
pbkdf2==1.3
33
python-dateutil==2.6.0
44
python-magic==0.4.13
5-
requests==2.13.0
5+
requests[socks]==2.13.0
66
requests-cache==0.4.13
77
scandir==1.5
88
six==1.10.0

requirements-dev.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ pytest-cov
2424
python-dateutil
2525
python-magic
2626
r2pipe
27-
requests
2827
requests-cache
2928
scandir
3029
six
@@ -33,10 +32,10 @@ tox
3332
virustotal-api
3433
yara-python
3534
cryptography
35+
requests[socks]
3636

3737
git+https://github.com/viper-framework/pefile.git#egg=pefile
3838
git+https://github.com/smarnach/pyexiftool.git#egg=pyexiftool
39-
git+https://github.com/crackinglandia/pype32.git#egg=pype32
4039
git+https://github.com/kbandla/pydeep.git#egg=pydeep
4140

4241
# pe module (verify sigs)

setup.py

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,46 @@
33
# This file is part of Viper - https://github.com/viper-framework/viper
44
# See the file 'LICENSE' for copying permission.
55

6-
from setuptools import setup, find_packages
76
from viper.common.version import __version__
87

8+
# Always prefer setuptools over distutils
9+
from setuptools import setup, find_packages
10+
import pip
11+
12+
links = []
13+
requires = []
14+
15+
requirement_files = ['requirements-base.txt']
16+
17+
for req_file in requirement_files:
18+
requirements = pip.req.parse_requirements(req_file, session=pip.download.PipSession())
19+
20+
for item in requirements:
21+
# we want to handle package names and also repo urls
22+
if getattr(item, 'url', None): # older pip has url
23+
links.append(str(item.url))
24+
if getattr(item, 'link', None): # newer pip has link
25+
links.append(str(item.link))
26+
if item.req:
27+
requires.append(str(item.req))
28+
29+
description = "Binary Analysis & Management Framework"
30+
931
setup(
1032
name='viper',
1133
version=__version__,
1234
author='Claudio Guarnieri',
1335
author_email='nex@nex.sx',
14-
description="Binary Analysis & Management Framework",
36+
description=description,
37+
long_description=description,
1538
url='http://viper.li',
1639

40+
platforms='any',
1741
scripts=['viper-cli', 'viper-api', 'viper-web', 'viper-update'],
18-
packages=find_packages(),
19-
setup_requires=['pytest-runner'],
42+
packages=find_packages(exclude=['tests', 'tests.*']),
43+
install_requires=requires,
44+
dependency_links=links,
45+
2046
tests_require=['pytest'],
2147

2248
# BSD 3-Clause License:

tests/core/ui/test_commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ def test_open(self, capsys):
5555
assert re.search("usage: open \[-h\] .*", out)
5656
assert re.search(".*Session opened on /tmp/.*", out)
5757

58+
def test_open_tor(self, capsys):
59+
instance = commands.Commands()
60+
instance.cmd_open('-h')
61+
instance.cmd_open('-t', '-u', 'https://github.com/viper-framework/viper-test-files/raw/master/test_files/cmd.exe')
62+
out, err = capsys.readouterr()
63+
assert re.search("usage: open \[-h\] .*", out)
64+
assert re.search(".*Session opened on /tmp/.*", out)
65+
5866
def test_notes_existing(self, capsys):
5967
instance = commands.Commands()
6068
instance.cmd_open('-f', os.path.join(FIXTURE_DIR, "chromeinstall-8u31.exe"))

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ commands =
3636
bash -c 'echo "exit" | python viper-cli'
3737
pytest {posargs}
3838
codecov
39-
rm -r {toxworkdir}/.viper
39+
rm -rf {toxworkdir}/.viper
4040

4141

4242
# Style/Lint

viper-update

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ from viper.common.out import print_success
2323
from viper.common.out import print_item
2424
from viper.common.network import download
2525
from viper.common.objects import File
26-
from viper.common.utils import path_split_all
2726
from viper.core.config import Config
2827
from viper.core.project import __project__
2928

@@ -37,6 +36,24 @@ except NameError:
3736
url = 'https://github.com/viper-framework/viper/archive/master.zip'
3837

3938

39+
# Taken from the Python Cookbook.
40+
def path_split_all(path):
41+
allparts = []
42+
while 1:
43+
parts = os.path.split(path)
44+
if parts[0] == path:
45+
allparts.insert(0, parts[0])
46+
break
47+
elif parts[1] == path:
48+
allparts.insert(0, parts[1])
49+
break
50+
else:
51+
path = parts[0]
52+
allparts.insert(0, parts[1])
53+
54+
return allparts
55+
56+
4057
# TODO: this is a first draft, needs more work.
4158
# - Add a check for current working directory.
4259
# - Add error handling.

0 commit comments

Comments
 (0)