Skip to content

Commit 4e9dcbe

Browse files
authored
Merge pull request #30 from knownsec/dev
Dev
2 parents 09fa02b + d6b9e73 commit 4e9dcbe

6 files changed

Lines changed: 26 additions & 10 deletions

File tree

setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111
"""
1212
from setuptools import setup
1313

14+
from zoomeye import __version__
15+
1416

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

1820
setup(
1921
name='zoomeye',
20-
version='2.0.4.2',
22+
version=__version__,
2123
description='Python library and command-line tool for ZoomEye (https://www.zoomeye.org/doc)',
2224
long_description=README,
2325
long_description_content_type='text/x-rst',
@@ -38,7 +40,7 @@
3840
'Programming Language :: Python :: 3.6',
3941
'Programming Language :: Python :: 3.7',
4042
'Programming Language :: Python :: 3.8',
41-
'Programming Language :: Python :: 3.9'
43+
'Programming Language :: Python :: 3.9',
4244
'Topic :: Software Development :: Libraries :: Python Modules',
4345
],
4446
)

zoomeye/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111

1212
__name__ = 'zoomeye'
1313
__package__ = 'zoomeye'
14+
__version__ = '2.0.4.2'

zoomeye/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
sys.path.insert(1, module_path)
1818

1919
from zoomeye import core
20+
from zoomeye import __version__
21+
22+
23+
def get_version():
24+
return "ZoomEye-python version number {}".format(__version__)
2025

2126

2227
class ZoomEyeParser(argparse.ArgumentParser):
@@ -37,6 +42,13 @@ def main():
3742
# zoomeye account info
3843
parser_info = subparsers.add_parser("info", help="Show ZoomEye account info")
3944
parser_info.set_defaults(func=core.info)
45+
# show version number
46+
parser.add_argument(
47+
'-v', '--version',
48+
action='version',
49+
version=get_version(),
50+
help="Show program's version number and exit"
51+
)
4052

4153
# query zoomeye data
4254
parser_search = subparsers.add_parser(

zoomeye/data.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,12 @@ def filter_search_data(keys, field_table, data):
146146
return result
147147

148148

149-
def filter_history_data(fileds, host_data):
149+
def filter_history_data(fileds, host_data, omit=True):
150150
"""
151151
filter historical data based on user input
152152
:param fileds: list, user input
153153
:param host_data: list, exclude web data
154+
:param omit: bool, omit string flag
154155
return: all_data,list matched data
155156
return: port_count, set, count open ports non-repeating
156157
"""
@@ -171,7 +172,10 @@ def filter_history_data(fileds, host_data):
171172
host_result = str(utc_time)
172173
# omit raw data, is too long
173174
if filed_item == 'raw':
174-
host_result = show.omit_str(show.convert_str(host_result))
175+
if omit:
176+
host_result = show.omit_str(show.convert_str(host_result))
177+
else:
178+
host_result = show.convert_str(host_result)
175179
# replace None --> [unknown]
176180
if host_result is None:
177181
host_result = "[unknown]"

zoomeye/plotlib.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ def show_pie_chart(stat):
3737
:param stat: list, all data and label
3838
"""
3939

40-
print()
4140
if len(stat) > len(config.COLOR_TABLE):
4241
raise ("max support 10 items")
4342

@@ -64,7 +63,6 @@ def show_pie_chart(stat):
6463
else:
6564
print(ch)
6665
count += 1
67-
print()
6866

6967

7068
def unicode_output():
@@ -128,7 +126,6 @@ def generate_histogram(values, labels=None, force_ascii=False):
128126
:param force_ascii: bool, unicode or ascii output
129127
return :None
130128
"""
131-
print()
132129
# max length and bar width
133130
matrix = get_matrix(values, 36, 1)
134131

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

169166

170167

zoomeye/show.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def print_filter_history(fileds, hist_data):
280280
"""
281281
filter_title = ''
282282
first_item = hist_data[0]
283-
all_data, port_count = data.filter_history_data(fileds, hist_data)
283+
all_data, port_count = data.filter_history_data(fileds, hist_data, omit=False)
284284
printf(first_item.get('ip'))
285285
dict_first_item = data.ZoomEyeDict(first_item)
286286
for dict_item in data.tables_history_info.keys():

0 commit comments

Comments
 (0)