Skip to content

Commit

Permalink
Fix: Handle default prompt when stdout is redirected (#938)
Browse files Browse the repository at this point in the history
* when stdout is redirected, use default prompt values
  • Loading branch information
Arker123 authored Jan 30, 2024
1 parent 57a8cd8 commit b2ca8ad
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion floss/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,11 @@ def main(argv=None) -> int:

if results.metadata.language not in ("", "unknown"):
if args.enabled_types == [] and args.disabled_types == []:
prompt = input("Do you want to enable string deobfuscation? (this could take a long time) [y/N] ")
# when stdout is redirected, such as in 'floss foo.exe | less' use default prompt values
if sys.stdout.isatty():
prompt = input("Do you want to enable string deobfuscation? (this could take a long time) [y/N] ")
else:
prompt = "n"

if prompt.lower() == "y":
logger.info("enabled string deobfuscation")
Expand Down

0 comments on commit b2ca8ad

Please sign in to comment.