Skip to content

Commit a5e61c5

Browse files
author
iamsajjad
committed
rebuilt quickping cli tool using click package
1 parent d5d00ce commit a5e61c5

File tree

2 files changed

+37
-48
lines changed

2 files changed

+37
-48
lines changed

cli/cLI.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
2+
"""
3+
cli/cLI.py
4+
executable python file of quickping as command-line tools
5+
"""
6+
7+
import click
8+
from quickping import Quickping
9+
10+
@click.command(context_settings=dict(help_option_names=['-h', '--help']))
11+
@click.option('-s', '--start', default="", required=True, type=str, help='start range of IPv4 address')
12+
@click.option('-e', '--end', default="", required=True, type=str, help='end range of IPv4 address')
13+
@click.option('-t', '--threads', default=512, type=int, help='number of threads')
14+
@click.option('-l', '--log', default=False, type=bool, help='display logging')
15+
def cLI(start, end, threads, log):
16+
17+
try:
18+
testRange = Quickping(start=start, end=end, ignore=[], threads=threads, log=log)
19+
testRange.active()
20+
except expression as identifier:
21+
raise identifier from None
22+
23+
print('\nActive Addresses\n')
24+
for aa in testRange.activeAddresses:
25+
print(aa)
26+
27+
informations = """\nStart at : {}\nEnd at : {}\nTotal Addresses : {}\nActive Addresses : {}\nNumber of Threads : {}""".format(
28+
testRange.start,
29+
testRange.end,
30+
len(testRange.addresses),
31+
len(testRange.activeAddresses),
32+
testRange.threads)
33+
click.echo(informations)
34+
35+
if __name__ == "__main__":
36+
cLI()
37+

cli/quickpingcli.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)