Skip to content

Instantly share code, notes, and snippets.

@gattacker
Created December 4, 2017 12:27
Show Gist options
  • Save gattacker/24594127aede6bef408104a5ec7fed69 to your computer and use it in GitHub Desktop.
Save gattacker/24594127aede6bef408104a5ec7fed69 to your computer and use it in GitHub Desktop.
#!/bin/bash
chat_id="-123456789"
token="123456789:ABCDEFGHELJKT"
document="/tmp/SMB-samples-$(date +%d-%m-%y-%T).tar.gz"
msg_description="Hey, dude! Look at here. Here is $($smb_file_count) samples. Dalshe sami y meny lapki."
function SendToTelegram {
curl -s -F chat_id=$chat_id -F document=@$document -F caption="$msg_description" https://api.telegram.org/bot$token/sendDocument > /dev/null 2&>1
}
smb_file_count=$(find /data/dionaea/binaries/ -type f | wc -l)
if [ $smb_file_count -ge 20 ]
then
tar czf $document /data/dionaea/binaries/* > /dev/null 2&>1
SendToTelegram
rm /data/dionaea/binaries/*
rm /tmp/*.tar.gz
echo -e "Send files!"
fi
echo -e 'Something goes wrong! Bye!'
#sleep 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment