コマンドを入力し、xdotoolを使用して入力するbashスクリプトがあります。唯一の問題は、スクリプトの開始時に(スクリプトによって)ターミナルを開いてから、スクリプトの実行を続行する必要があることです。スクリプトはKaliLinuxで実行されるため、xfce4-terminal、xterm、bashなどが含まれます。
crtl alt tをシミュレートしようとしましたが、機能しませんでした
説明の試み#2:私のbashスクリプトは、キーボード入力をシミュレートし、コマンドを入力してタスクを自動化します。入力は端末に送られます。スクリプトのstsrtでターミナルを開く必要があります。とにかくこれを行うと、ターミナルが閉じるまでスクリプトが一時停止すると考えることができます。ターミナルを開いて、一時停止せずに元のスクリプトを実行し続ける方法が必要ですが、これは明確ですか?
を開いxfce4-terminal
てスクリプトの実行を続行するには、次のようにバックグラウンドでコマンドを開始します。
#!/bin/bash
xfce4-terminal &
sleep 5 # wait for terminal window to be ready
# continue with your script
xdotool type '...'
しかし、あなたが実際にすべきだと思うのは、あなたが適切に求めていることを達成するのは非常に複雑に見えるので、あなたのアプローチ全体を再考することです!(まだ言及していない特別な要件がない限り)
If you simply want to execute the commands as a script, you can put them there directly:
#!/bin/bash
airmon-ng stop wlan1mon
# note:
# no sleep required since the commands are executed one after another,
# waiting for the previous one to finish
airmon-ng check kill
# ...
If you want the output of the script to be visible in a xfce4-terminal
window you can just open one manually and start the script in it.
If you need to start the script automatically - e.g. on startup - but still want the output to be in a new window, start the script with xfce4-terminal -e /path/to/your/script.sh
, see https://askubuntu.com/q/46627/283843 as mentioned by αғsнιη.
If you need to enter input into other commands you may try to simply echo
and pipe it to them:
echo "events.stream off" | bettercap --iface wlan1mon
または、コマンドに応じて、入力を提供する、またはそれぞれのパラメーターで開始するためのより適切な方法を見つけます。これは、上記がすべての場合に機能するとは限らないためです。すなわち、のためにbettercap
あなたが使用すること-eval
のパラメータを:
bettercap --iface wlan1mon -eval 'events.stream off; wifi.recon on'
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加