Skip to content

Commit

Permalink
Merge pull request #30 from knownsec/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
wh0am1i authored Mar 23, 2021
2 parents 09fa02b + d6b9e73 commit 4e9dcbe
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 10 deletions.
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
"""
from setuptools import setup

from zoomeye import __version__


DEPENDENCIES = open('requirements.txt', 'r', encoding='utf-8').read().split('\n')
README = open('README.rst', 'r', encoding='utf-8').read()

setup(
name='zoomeye',
version='2.0.4.2',
version=__version__,
description='Python library and command-line tool for ZoomEye (https://www.zoomeye.org/doc)',
long_description=README,
long_description_content_type='text/x-rst',
Expand All @@ -38,7 +40,7 @@
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9'
'Programming Language :: Python :: 3.9',
'Topic :: Software Development :: Libraries :: Python Modules',
],
)
1 change: 1 addition & 0 deletions zoomeye/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@

__name__ = 'zoomeye'
__package__ = 'zoomeye'
__version__ = '2.0.4.2'
12 changes: 12 additions & 0 deletions zoomeye/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
sys.path.insert(1, module_path)

from zoomeye import core
from zoomeye import __version__


def get_version():
return "ZoomEye-python version number {}".format(__version__)


class ZoomEyeParser(argparse.ArgumentParser):
Expand All @@ -37,6 +42,13 @@ def main():
# zoomeye account info
parser_info = subparsers.add_parser("info", help="Show ZoomEye account info")
parser_info.set_defaults(func=core.info)
# show version number
parser.add_argument(
'-v', '--version',
action='version',
version=get_version(),
help="Show program's version number and exit"
)

# query zoomeye data
parser_search = subparsers.add_parser(
Expand Down
8 changes: 6 additions & 2 deletions zoomeye/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ def filter_search_data(keys, field_table, data):
return result


def filter_history_data(fileds, host_data):
def filter_history_data(fileds, host_data, omit=True):
"""
filter historical data based on user input
:param fileds: list, user input
:param host_data: list, exclude web data
:param omit: bool, omit string flag
return: all_data,list matched data
return: port_count, set, count open ports non-repeating
"""
Expand All @@ -171,7 +172,10 @@ def filter_history_data(fileds, host_data):
host_result = str(utc_time)
# omit raw data, is too long
if filed_item == 'raw':
host_result = show.omit_str(show.convert_str(host_result))
if omit:
host_result = show.omit_str(show.convert_str(host_result))
else:
host_result = show.convert_str(host_result)
# replace None --> [unknown]
if host_result is None:
host_result = "[unknown]"
Expand Down
7 changes: 2 additions & 5 deletions zoomeye/plotlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def show_pie_chart(stat):
:param stat: list, all data and label
"""

print()
if len(stat) > len(config.COLOR_TABLE):
raise ("max support 10 items")

Expand All @@ -64,7 +63,6 @@ def show_pie_chart(stat):
else:
print(ch)
count += 1
print()


def unicode_output():
Expand Down Expand Up @@ -128,7 +126,6 @@ def generate_histogram(values, labels=None, force_ascii=False):
:param force_ascii: bool, unicode or ascii output
return :None
"""
print()
# max length and bar width
matrix = get_matrix(values, 36, 1)

Expand Down Expand Up @@ -163,8 +160,8 @@ def generate_histogram(values, labels=None, force_ascii=False):
r = trim_zeros(row)
data.append("".join(chars[item] for item in r))
out.append(fmt.format(*data))
result = '\n'.join(out) + '\n'
print(result)
for item in out:
print(' ' + item)



Expand Down
2 changes: 1 addition & 1 deletion zoomeye/show.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def print_filter_history(fileds, hist_data):
"""
filter_title = ''
first_item = hist_data[0]
all_data, port_count = data.filter_history_data(fileds, hist_data)
all_data, port_count = data.filter_history_data(fileds, hist_data, omit=False)
printf(first_item.get('ip'))
dict_first_item = data.ZoomEyeDict(first_item)
for dict_item in data.tables_history_info.keys():
Expand Down

0 comments on commit 4e9dcbe

Please sign in to comment.