Skip to content

Commit

Permalink
Add a verbose flag
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniovazquezblanco committed Mar 22, 2024
1 parent a321f00 commit 32efcbc
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions BlueSpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ def main():
dest="sink",
default="alsa_output.pci-0000_00_05.0.analog-stereo",
)
parser.add_argument(
"-v",
"--verbose",
help="Show verbose output",
dest="verbose",
default=False,
action='store_true'
)

args = parser.parse_args()

Expand All @@ -66,22 +74,22 @@ def main():
f"[{bcolors.OK_GREEN}I{bcolors.ENDC}] Avoiding authentication with {args.address}..."
)
print(f"[{bcolors.OK_GREEN}I{bcolors.ENDC}] Generating shared key...")
pair(BluezTarget(args.address, args.address_type), verbose=False)
pair(BluezTarget(args.address, args.address_type), verbose=args.verbose)
print(f"[{bcolors.WARNING}!{bcolors.ENDC}] Key generated")
print(f"[{bcolors.OK_GREEN}I{bcolors.ENDC}] Establishing connection...")
time.sleep(1)
connect(BluezTarget(args.address, args.address_type), verbose=False)
connect(BluezTarget(args.address, args.address_type), verbose=args.verbose)
print(f"[{bcolors.OK_GREEN}I{bcolors.ENDC}] Starting audio recording...")
print(f"[{bcolors.WARNING}!{bcolors.ENDC}] Recording!")
time.sleep(1)
record(BluezTarget(args.address), outfile=args.outfile, verbose=False)
record(BluezTarget(args.address), outfile=args.outfile, verbose=args.verbose)
print(f'[{bcolors.WARNING}!{bcolors.ENDC}] Recording stored in "{args.outfile}"')

print(f"[{bcolors.OK_BLUE}?{bcolors.ENDC}] Play audio back? ")
option = input("[Y/n] ") or "y"
if option.lower() in ("y", "yes"):
print(f"[{bcolors.WARNING}!{bcolors.ENDC}] Playing audio back!")
playback(args.sink, args.outfile, verbose=False)
playback(args.sink, args.outfile, verbose=args.verbose)
print(f"[{bcolors.OK_GREEN}I{bcolors.ENDC}] Exiting")


Expand Down

0 comments on commit 32efcbc

Please sign in to comment.