FleexSecurity/fleex

"terminal make raw:inappropriate ioctl for device"

michael1026 opened this issue · 3 comments

Hello,

I noticed when running fleex scans from within a bash loop, it causes an issue with SSH. I have not been able to figure out the solution to this yet, but it should be easy to reproduce.

Error I get: FATA[0002] terminal make raw:inappropriate ioctl for device

Working bash script

#!/bin/bash
fleex scan -n pwn -i "/home/myInput.txt" -c "~/go/bin/httpx -l {{INPUT}} -o {{OUTPUT}}" -o "/home/myOutput.txt"

Erroring bash script

#!/bin/bash
while read f; do
  FILE="/home/$f.txt"
  fleex scan -n pwn -i "${f}" -c "~/go/bin/httpx -l {{INPUT}} -o {{OUTPUT}}" -o "/home/${f}-output.txt"
done </home/hosts.txt

You should even be able to reproduce with less code...

#!/bin/bash
while read f; do
  fleex scan -n pwn -i "/home/myInput.txt" -c "~/go/bin/httpx -l {{INPUT}} -o {{OUTPUT}}" -o "/home/myOutput.txt"
done </home/hosts.txt

Possible code in question:

state, err := terminal.MakeRaw(fd)

Possible solution 1: golang/go#19909
Possible solution 2: c-bata/go-prompt#88

Thanks!

I was able to get around this issue using for f in $(cat myfile.txt); do ... done instead. Not sure why the other loop wasn't working, so it actually might not be an issue with this project.

Hi there, apologies for the late reply.
I had the same issue a while ago and ended up fixing it in a similar way as well.
It's also in the docs.

I think there's a way to change something in the code to avoid this entirely, but not really sure what to touch 😄

Ah! How did I mange to miss that in the docs. Thanks for the reply.