Skip to content

Commit

Permalink
Merge pull request #82 from Guilhem7/master
Browse files Browse the repository at this point in the history
Catch OSError on ioctl TIOCSTI Error - thanks @Guilhem7
  • Loading branch information
v1k1ngfr committed Mar 4, 2024
2 parents fa42ded + c14b39f commit 36e754f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions arsenal/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,18 @@ def prefil_shell_cmd(self, cmd):
# use the new attributes
termios.tcsetattr(stdin, termios.TCSANOW, newattr)
# write the selected command in stdin queue
for c in cmd.cmdline:
fcntl.ioctl(stdin, termios.TIOCSTI, c)
try:
for c in cmd.cmdline:
fcntl.ioctl(stdin, termios.TIOCSTI, c)
except OSError:
message = "========== OSError ============\n"
message += "Arsenal needs TIOCSTI enable for running\n"
message += "Please run the following commands as root to fix this issue on the current session :\n"
message += "sysctl -w dev.tty.legacy_tiocsti=1\n"
message += "If you want this workaround to survive a reboot, add the following configuration to sysctl.conf file and reboot :\n"
message += "echo \"dev.tty.legacy_tiocsti=1\" >> /etc/sysctl.conf\n"
message += "More details about this bug here: https://github.com/Orange-Cyberdefense/arsenal/issues/77"
print(message)
# restore TTY attribute for stdin
termios.tcsetattr(stdin, termios.TCSADRAIN, oldattr)

Expand Down

0 comments on commit 36e754f

Please sign in to comment.