-
Notifications
You must be signed in to change notification settings - Fork 0
/
arves.py
805 lines (677 loc) · 27 KB
/
arves.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
#!/usr/bin/env python3
import argparse
import os
from typing import Dict, List, Set
import shutil
import asyncio
import json
from itertools import chain
import ipaddress
from libnmap.parser import NmapParser
from urllib.parse import urlparse
import socket
import signal
def printc(line, text_color):
endc = '\033[0m'
vals = {
'cyan': '\033[96m',
'green': '\033[92m',
'warning': '\033[93m',
'fail': '\033[91m'
}
if color:
print(f"{vals.get(text_color)}{line}{endc}")
else:
print(line)
def v(line: str):
if verbose:
printc(f"[+] {line}", "cyan")
def w(line: str):
printc(f"[!] WARNING - {line}", "warning")
def i(line: str):
printc(f"[*] {line}", "green")
def e(line: str):
printc(f"[!] ERROR - {line}, exiting...", "fail")
exit(-1)
def cli():
"""
Parse the input commands and return the arguments Namespace
Returns:
args (argparse.Namespace): Namespace containing the arguments from the command line
"""
parser = argparse.ArgumentParser(
description="Automate the recon, enumeration, and vulnerability scanning phases of external pen-tests and \
bug bounties."
)
parser.add_argument(
"-v",
"--verbose",
action="store_true",
help="Enable verbose output (display each command)",
default=False,
)
parser.add_argument(
"--no-color",
action="store_true",
help="Do not display colored output",
default=False,
)
parser.add_argument(
"-d",
"--domains",
action="store",
type=str,
help="A comma-separated list of target domains (e.g. -d 'example.com,info.com')",
default=None,
)
parser.add_argument(
"-dL",
"--domain-file",
action="store",
type=str,
help="Input file containing a newline separated list of target domains",
default=None,
)
parser.add_argument(
"-i",
"--include",
action="store",
type=str,
help="Input file containing IP addresses, CIDR ranges, or hostnames to INCLUDE in scanning/enumeration",
default=None,
)
parser.add_argument(
"-e",
"--exclude",
action="store",
type=str,
help="Input file containing IP addresses, CIDR ranges, or hostnames to EXCLUDE from scanning/enumeration. \
This has precedence over the --include flag.",
default=None,
)
parser.add_argument(
"-p",
"--phase",
action="store",
type=str,
help="Execute only a single 'phase' of the arves.json config file. (Must be used with --target-file)",
default=None,
)
parser.add_argument(
"-tf",
"--target-file",
action="store",
type=str,
help="The path to the target file to use for performing scanning of a specific phase (To be used with \
the --phase flag)",
default=None,
)
parser.add_argument(
"--workers",
action="store",
type=int,
help="The maximum amount of commands to run at a time",
default=10,
)
parser.add_argument(
"-c",
"--config",
action="store",
type=str,
help="Path to the 'config' folder containing both the 'arves.json' file as well as individual \
tool configuration files",
required=True,
)
parser.add_argument(
"-o",
"--output",
action="store",
type=str,
help="Path to the output directory",
required=True,
)
args = parser.parse_args()
# Seting the verbose and color flags
global verbose
global color
verbose = args.verbose
color = not args.no_color
# TODO do more error checking here, such as checking that all provided files exist
if args.phase and not args.target_file:
e("If the --phase flag is provided then a --target-file must also be provided")
if args.target_file and not args.phase:
e("A --target-file was provided but no --phase was provided")
return args
def parse_config(config: str):
"""
Parse the arves.json configuation file from the config directory
Parameters:
config (str) - The directory that the arves.json file is stored in
Returns:
commands (Dict) - Parsed JSON containing the commands to be run by the script
"""
try:
with open(f"{config}/arves.json") as f:
commands = json.load(f)
v(f"Configuration file {config} parsed successfully.")
except FileNotFoundError as err:
e(f"Could not open config file: {config}/arves.json")
return commands
def clean_target(target: str):
"""
This function cleans the target of path characters and the pesky http[s]
Parameters:
target (str) - the target (domain, URL, etc.) to clean
Returns:
(str) - The cleaned version of the target
"""
# Parse the URL
parsed = urlparse(target)
# If an incomplete URL was provided (such as with domains)
# Then complete the URL so that urllib can parse out the netloc
if parsed.scheme == "":
parsed = urlparse(f"http://{target}")
return parsed.netloc
def check_bins(commands: List):
"""
Check that the nessecary binaries are available and on the $PATH
Parameters:
commands (List) - The list of commands to run
Returns:
passed (bool) - False if a nessecary binary is not on the $PATH, otherwise true
"""
# We don't want to fail as soon as we find a missing binary, but we want to report
# all of the missing binaries. This variable will remain "True" unless a binary is found
# missing, but we will continue going through the loop to see if anything else is missing
passed = True
for _, cmd_list in commands.items():
for cmd in cmd_list:
# shutil.which is basically just the platform independant `which` command
# this line just checks to see if the binary name is in the path
if shutil.which(cmd.get("bin")) == None:
w(f"Missing binary: {cmd.get('bin')} ({cmd.get('loc', 'No location provided')})")
passed = False
return passed
def read_target_file(target_file: str, resolve_hostnames: bool):
"""
Read in a target file and return the contents of the raw file and
the resolved IP addresses
Parameters:
target (str) - path to the input target file
resolve_hostnames (bool) - Whether to include the IP addresses
of resolved hostnames in the returned IP list
Returns:
hostnames (Set), ips (Set) - Tuple containing a set of all the hostnames
included in the file as well as a set of the IP addresses. If
resovle_hostnames is true, the IP address set will also contain the
resolved IP addresses of hosts discovered in the file
"""
cidrs = set()
ips = set()
hostnames = set()
with open(target_file) as f:
contents = set(f.read().splitlines())
for target in contents:
# This try / except will catch if the provided input is a hostname or IP address/network
try:
cidrs.add(ipaddress.ip_network(target, strict=False))
except ValueError:
# This except is hit when a hostname is provided to the ip_network function
hostnames.add(target)
if resolve_hostnames:
# Resolve the hostname then pass each IP address to the ip_network function
# to be added to the cidrs pool
try:
_, _, resolved_ips = socket.gethostbyname_ex(target)
for ip in resolved_ips:
cidrs.add(ipaddress.ip_network(ip, strict=False))
except socket.gaierror:
# This is hit if the hostname is unresolvable
w(f"Unresolvable hostname in the input file: {target}")
# get all the individual ip addresses from the CIDRs
for cidr in cidrs:
for ip in cidr:
ips.add(str(ip))
return hostnames, ips
def collect_domains(output: str, input_domains: str, domain_file: str):
"""
Retrieve the input domains from the CLI and input files, then write them to a file in the
output folder.
Parameters:
output (str) - path to output directory
input_domains (str) - List of input domains provided via CLI
domain_file (str) - path to file containing input domains
Returns:
domains_file (str): file containing domains to run tools against
"""
domains = set()
# Grab domains provided via CLI
if input_domains:
domains.update(input_domains.split(","))
# Grab domains provided in a file
if domain_file:
try:
with open(domain_file) as f:
file_contents = f.read()
domains.update(file_contents.splitlines())
except FileNotFoundError as err:
e(f"Could not open input domain list ({domain_file})")
# Write the domains to a file
domain_file = os.path.join(output, "targets", "domains.txt")
with open(domain_file, "w") as f:
f.write("\n".join(domains))
# Return the path to the domain file
v(f"{len(domains)} input domains collected in {domain_file}.")
return domain_file
def collect_subdomains(output: str):
"""
Collect the output of the 'dns_enum' phase into one file
Parameters:
output (str) - path to output directory
Returns:
N/A
"""
# Gather all of the enumerated subdomains into a file
subs = set()
subs_folder = os.path.join(output, "dns_enum")
for file in os.listdir(subs_folder):
with open(os.path.join(subs_folder, file)) as f:
# Add all of the discovered subdomains to the list
subs.update(f.read().splitlines())
# write the results to a file
sub_file = os.path.join(output, "targets", "subs.txt")
with open(sub_file, "w") as f:
f.write("\n".join(subs))
v(f"{len(subs)} subdomains discovered and collected in {sub_file}.")
return sub_file
def collect_ips(output: str, include_file: str, exclude_file: str):
"""
Collect all of the IP addresses from the provided IP list, as well as from
the subdomain enumeration, and write them to a file. This will write 2 files,
one with just IP addresses, and one with IP addresses and subdomains (for virtual
hosting). This function will also use the exclude file to remove hosts from the
final target files.
Parameters:
output (str) - path to output directory
ip_in_file (List) - path to the file contining IP addresses to include
ip_ex_file (str) - path to the file containing IP addresses to exclude
Returns:
(str) - path to the final ip file
"""
ips = set()
hosts = set()
# Read in the two target files (if the were provided)
# If no target files were provided just use an empty set
if include_file:
in_hostnames, in_ips = read_target_file(
target_file=include_file, resolve_hostnames=True
)
else:
in_hostnames = in_ips = set()
if exclude_file:
ex_hostnames, ex_ips = read_target_file(
target_file=exclude_file, resolve_hostnames=False
)
else:
ex_hostnames = ex_ips = set()
# read in the DNS validation file
dns_file = os.path.join(output, "dns_valid", "dnsx")
with open(dns_file) as f:
# newline delimited JSON
for line in f:
record = json.loads(line)
# Only proceed if there was an A record (IP address) for the host
if record.get("a", False):
# Add the host to the list of hostnames
hosts.add(record.get("host"))
# Get the A records (IP addresses) for the host and
# add the IP to the list if it is not in the exclusion list
ips.update(record.get("a"))
# Add the "include" targets and remove the "exclude" targets
ips.update(in_ips)
ips = ips - ex_ips
hosts.update(in_hostnames)
hosts = hosts - ex_hostnames
# Write the resulting sets to their output files
targets_folder = os.path.join(output, "targets")
ip_file = os.path.join(targets_folder, "ips.txt")
host_file = os.path.join(targets_folder, "hosts.txt")
with open(ip_file, "w") as f:
f.write("\n".join(ips))
with open(host_file, "w") as f:
f.write("\n".join(hosts))
f.write("\n")
f.write("\n".join(ips))
v(f"{len(hosts) + len(ips)} targets (hostnames + IPs) discovered and collected in {host_file}.")
v(f"{len(ips)} IP addresses discovered and collected in {ip_file}.")
return ip_file
def collect_ports(output: str):
"""
Collect the open ports from the masscan run, as well as return the full hosts
list to run against nmap.
Parameters:
output (str) - The output directory
Returns:
(str), (str) - A tuple containing the ports to be scanned (in nmap format)
as well as the path to the host list file
"""
ports = set()
targets_folder = os.path.join(output, "targets")
with open(os.path.join(output, "port_scan", "masscan")) as f:
# Read in the masscan output and add all ports listed as "open"
# to the discovered_ports set
discovered = json.load(f)
for host in discovered:
for port in host.get("ports"):
if port.get("status") == "open":
ports.add(str(port.get("port")))
# Format the ports in nmap style
ports_len = len(ports)
ports = ",".join(ports)
# Write the discovered ports to a file
port_file = os.path.join(targets_folder, "ports.txt")
with open(port_file, "w") as f:
f.write(ports)
v(f"{ports_len} ports discovered and collected in {port_file}.")
return (ports, os.path.join(targets_folder, "hosts.txt"))
def collect_webservers(output: str):
"""
Collect all of the HTTP web servers from the nmap XML output and write
them to a webservers file
Parameters:
output (str) - Path to the output folder
Returns:
(str) - Path to the webservers file
"""
webservers = set()
nmap_file = os.path.join(output, "validation_scan", "nmap.xml")
parser = NmapParser.parse_fromfile(nmap_file)
for host in parser.hosts:
for service in host.services:
if service.state == "open":
if "https" in service.service or "ssl/http" in service.service:
webservers.add(f"https://{host.address}:{service.port}")
for hostname in host.hostnames:
webservers.add(f"https://{hostname}:{service.port}")
elif "http" in service.service:
webservers.add(f"http://{host.address}:{service.port}")
for hostname in host.hostnames:
webservers.add(f"http://{hostname}:{service.port}")
webserver_file = os.path.join(output, "targets", "webservers.txt")
with open(webserver_file, "w") as f:
f.write("\n".join(webservers))
v(f"{len(webservers)} webservers discovered and collected in {webserver_file}.")
return webserver_file
class Phase:
"""
This class represents the a 'phase' of the recon scanning process. This is initialized with all
of the variables that the phase needs to run. The run() method is used to actually execute the
phase of the scan.
"""
def __init__(
self, name: str, commands: List, target_file: str, output: str, workers: int
) -> None:
self.name = name
self.commands = commands
self.target_file = target_file
self.targets = self._read_targets(target_file)
self.output = output
self.log_dir = os.path.join(output, "log")
self.sem = asyncio.Semaphore(workers)
# Make the output and log directories
os.makedirs(self.output, exist_ok=True)
os.makedirs(self.log_dir, exist_ok=True)
@staticmethod
def _read_targets(target_file):
with open(target_file) as f:
return f.read().splitlines()
@staticmethod
def _replace_vars(line: str, **kwargs):
"""
Replace the {vars} in the line with the values stored in the kwargs
"""
for key, val in kwargs.items():
line = line.replace(f"{{{key}}}", val)
return line
async def _run_cmd(self, cmd, **kwargs):
"""
This funciton acts as a wrapper around subprocess.run to run commands. Dynamic input such as
{config} may be passed in via the kwargs variable.
Parameters:
cmd (Dict) - The command dict to execute
kwargs (Dict) - All of the dynamic values to populate the `cmd` with
Returns:
None
"""
async with self.sem:
# Build the command
shell_cmd = f"{cmd.get('bin')} {cmd.get('args')}"
shell_cmd = self._replace_vars(shell_cmd, **kwargs)
# Get the STDIN input (if it was provided)
stdin = cmd.get("stdin", None)
# If the command requires input from stdin
if stdin:
# This pipe will tell the create_subprocess_shell method to
# expect data from STDIN
input_pipe = asyncio.subprocess.PIPE
stdin = self._replace_vars(stdin, **kwargs)
# convert STDIN into bytes
stdin = bytes(stdin, encoding="utf8")
else:
# If the command doesn't require STDIN then send None
# so that create_subprocess_shell doesn't expect anything
input_pipe = None
i(f"Issued: {shell_cmd}")
# Write the command to the log file
with open(os.path.join(self.log_dir, "_commands.log"), "a") as f:
f.write(f"{shell_cmd}\n")
# Run the command
proc = await asyncio.create_subprocess_shell(
shell_cmd,
stdin=input_pipe,
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE,
)
# Send whatever STDIN there is to the process, then wait
# for the command to exit and return stdout and stderr
stdout, stderr = await proc.communicate(input=stdin)
# If the command executed successfully, inform the user
if proc.returncode == 0:
i(f"Command {shell_cmd!r} exited with code: {proc.returncode}")
# If the command failed, WARN the user
else:
w(f"Command {shell_cmd!r} exited with code: {proc.returncode}")
# Get the name of the log file from the output variable
filename = kwargs.get("output").split("/")[-1]
# Check to see if the logfile already exists, if it does then increment the number on the end
logfile = os.path.join(self.log_dir, filename)
if os.path.isfile(logfile):
append = 1
while os.path.isfile(f"{logfile}.{append}"):
append += 1
logfile = f"{logfile}.{append}"
# Write the command output to a write to a log file
with open(logfile, "w") as f:
if stderr:
f.write(f"[stderr]\n{stderr.decode()}")
if stdout:
f.write(f"[stdout]\n{stdout.decode()}\n")
async def _handle_signal(self, signal, loop):
"""
This method will handle the interrupt signals. If the
run() method recives an interrupt signal, it should stop execution and allow
the user to determine what to do, which is either go to the next phase (i.e.
dont stop the program) or end the program. Either way, it should cancel all of
the current queued tasks.
"""
# Get input from the user about how to proceed
print("")
print(f"Recieved {signal.name} signal. Please enter \"1\" or \"2\" at the prompt below to select from"
" the two options.")
print("1) End execution of the program.")
print(f"2) End the {self.name} phase and continue to the next phase. (WARNING - "
"This may cause errors)")
choice = input("> ")
# input validation of choice
while choice != "1" and choice != "2":
choice = input(
"Invalid selection, Please enter either \"1\" or \"2\": ")
# If the user selects 2, then end this phase and move on
if choice == "2":
return
# The user selected 1, so cancel all queued tasks
remaining_tasks = [
t for t in asyncio.all_tasks() if t is not asyncio.current_task()]
for task in remaining_tasks:
task.cancel()
i(f"Cancelling {len(remaining_tasks)} remaining tasks...")
await asyncio.gather(*remaining_tasks)
async def run(self, **kwargs):
"""
This method will handle the execution of this phase of the process.
Parameters:
kwargs (Dict) - Any dynamically defined variables from the config
file, such as {ports}
"""
# Make the output directory
output = os.path.join(self.output, self.name)
os.makedirs(output, exist_ok=True)
# generate the command list
cmd_list = []
for cmd in self.commands:
# determine target type for each command (single vs multi)
if cmd.get("target_type", None) == "single":
# Single target commands require that each target be passed individually
for target in self.targets:
# output file is {output}/{phase}/{target}.{cmd}
cleaned_output_filename = os.path.join(
output, f"{clean_target(target)}.{cmd.get('bin')}"
)
cmd_list.append(
self._run_cmd(
cmd,
output=cleaned_output_filename,
target=target,
**kwargs,
)
)
else:
# Multi target commands can accept the targets either via stdin
# or as an input file
# output file is {output}/{phase}/{cmd}
output_filename = os.path.join(output, cmd.get("bin"))
cmd_list.append(
self._run_cmd(
cmd,
output=output_filename,
target="\n".join(self.targets),
target_file=self.target_file,
**kwargs,
)
)
# Add the signal handler
# https://www.roguelynn.com/words/asyncio-graceful-shutdowns/
loop = asyncio.get_event_loop()
signals = (signal.SIGHUP, signal.SIGTERM, signal.SIGINT)
for s in signals:
loop.add_signal_handler(
s, lambda s=s: asyncio.create_task(self._handle_signal(s, loop)))
# Execute the commands
i(f"Executing phase: {self.name}")
await asyncio.gather(*cmd_list)
async def main():
# Get the user input from the command parser
args = cli()
# Parse the configuration file
commands = parse_config(args.config)
# This only works on Unix, gotta figure out a windows alternative
# If this script is calling nmap, then it must be run with sudo
if (args.phase == None or args.phase == "validation_scan") and os.geteuid() != 0:
e("This script must be run with sudo")
# Make sure the requried bins are installed
if check_bins(commands=commands) == False:
e(f"Not all nessecary binaries were found on the $PATH")
# Create the output directory (if it doesn't already exist)
# And warn the user if the output directory does already exist
if os.path.exists(args.output):
w(f'Output directory ({args.output}) already exists. '
f'This script will overwrite the contents of the "{args.output}" directory.')
# Create the targets directory that will hold the target files for each phase
os.makedirs(os.path.join(args.output, "targets"), exist_ok=True)
if args.phase:
c = commands.get(args.phase, False)
if c:
await Phase(
args.phase,
commands=c,
target_file=args.target_file,
output=args.output,
workers=args.workers,
).run(config=args.config)
else:
e(f"Invalid phase ({args.phase}) provided")
else:
# Create the initial "domains" target file
target_file = collect_domains(
output=args.output,
input_domains=args.domains,
domain_file=args.domain_file,
)
# Run the DNS enumeration (subdomain enumeration) phase
await Phase(
"dns_enum",
commands.get("dns_enum"),
target_file=target_file,
output=args.output,
workers=args.workers,
).run(config=args.config)
# Collect the subdomains from the DNS enumeration
target_file = collect_subdomains(
output=args.output,
)
# Run the DNS validation phase
await Phase(
"dns_valid",
commands.get("dns_valid"),
target_file=target_file,
output=args.output,
workers=args.workers,
).run(config=args.config)
# Collect the active hosts from the DNS enumeration
target_file = collect_ips(
output=args.output, include_file=args.include, exclude_file=args.exclude
)
# Run the initial port scan phase
await Phase(
"port_scan",
commands.get("port_scan"),
target_file=target_file,
output=args.output,
workers=args.workers,
).run(config=args.config)
# Collect the active hosts from the DNS enumeration
ports, target_file = collect_ports(output=args.output)
# Run the service validation phase
await Phase(
"validation_scan",
commands.get("validation_scan"),
target_file=target_file,
output=args.output,
workers=args.workers,
).run(config=args.config, ports=ports)
# Collect the web servers from the nmap results
target_file = collect_webservers(output=args.output)
# Run the final HTTP scanning phase
await Phase(
"http_scan",
commands.get("http_scan"),
target_file=target_file,
output=args.output,
workers=args.workers,
).run(config=args.config)
i("Completed Scanning!")
if __name__ == "__main__":
try:
asyncio.run(main())
except asyncio.CancelledError:
i("Exiting Program.")