|
4 | 4 | executable python file of quickping as command-line tools |
5 | 5 | """ |
6 | 6 |
|
| 7 | +import time |
7 | 8 | import click |
8 | 9 | from quickping import Quickping |
9 | 10 |
|
|
13 | 14 | @click.option('-t', '--threads', default=512, type=int, help='number of threads') |
14 | 15 | @click.option('-l', '--log', default=False, type=bool, help='display logging') |
15 | 16 | def cLI(start, end, threads, log): |
16 | | - |
| 17 | + |
| 18 | + """ |
| 19 | + run python cLI.py --help |
| 20 | + """ |
| 21 | + |
| 22 | + stimer = time.time() |
17 | 23 | try: |
18 | 24 | testRange = Quickping(start=start, end=end, ignore=[], threads=threads, log=log) |
19 | 25 | testRange.active() |
20 | 26 | except expression as identifier: |
21 | 27 | raise identifier from None |
| 28 | + etimer = time.time() |
22 | 29 |
|
23 | | - print('\nActive Addresses\n') |
| 30 | + click.echo("\nActive Addresses\n") |
24 | 31 | 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) |
| 32 | + click.echo(aa) |
| 33 | + |
| 34 | + # time take to process |
| 35 | + timeToDone = time.strftime("%H:%M:%S", time.gmtime(etimer - stimer)) |
| 36 | + click.echo("") |
| 37 | + click.echo("Start @ : {}".format(testRange.start)) |
| 38 | + click.echo("End @ : {}".format(testRange.end)) |
| 39 | + click.echo("Total Addresses : {}".format(len(testRange.addresses))) |
| 40 | + click.echo("Active Addresses : {}".format(len(testRange.activeAddresses))) |
| 41 | + click.echo("Number of Threads : {}".format(testRange.threads)) |
| 42 | + click.echo("Time take to Done : {}".format(timeToDone)) |
| 43 | + click.echo("") |
34 | 44 |
|
35 | 45 | if __name__ == "__main__": |
36 | 46 | cLI() |
|
0 commit comments