Ciao ragazzi, il titolo dice tutto, per esempio, ho fatto un programma che a seconda di ciò che digiti dalla tastiera, parte la canzone che hai scelto.
Avira me lo sente come un trojan, ma non come keylogger, come si potrebbe pensare:
TR/ATRAPS.Gen
Ecco il codice molto semplice, se volete ve lo spiego, solo che adesso devo andare via:
Codice PHP:
//main.cpp
#include <all.h>
using namespace std;
int i;
int PerModificareInt;
char * PerModificareChar;
int ReturnValue;
string InputToString();
void logga(char stringa[500]);
void logga(char carattere); // OVERLOAD
string Input;
string s;
stringstream out;
stringstream outPath;
string Path;
HANDLE hFind;
WIN32_FIND_DATA wfd;
string FileName;
string MusicPlusExtension;
string music;
string Extension, Attribute;
BOOL FileIncompatibile;
#include "MyDefine.h" // BOOL VerifyPresenceOfFile();
int main()
{
Sleep(2);
for(int a = 0; a < 1;)
{
music = "";
Input = "";
for(int FOR = 0; FOR < 1;)
{
if(GetAsyncKeyState(VKM_DOWN) == -32767) FOR = 1;
if((GetAsyncKeyState(VKM_CTRL) < 0)&&
(GetAsyncKeyState(VKM_ALT) < 0)&&
(GetAsyncKeyState(VKM_M) < 0))
{Box("Software Terminated") exit(0);}
if((GetAsyncKeyState(VKM_CTRL) < 0)&&
(GetAsyncKeyState(VKM_ALT) < 0)&&
(GetAsyncKeyState(VKM_C) < 0))
mciSendString("close filemp3", NULL, 0, 0);
if((GetAsyncKeyState(VKM_CTRL) < 0)&&
(GetAsyncKeyState(VKM_ALT) < 0)&&
(GetAsyncKeyState(VKM_P) < 0))
mciSendString("play filemp3", NULL, 0, 0);
if((GetAsyncKeyState(VKM_CTRL) < 0)&&
(GetAsyncKeyState(VKM_ALT) < 0)&&
(GetAsyncKeyState(VKM_S) < 0))
mciSendString("pause filemp3", NULL, 0, 0);
Sleep(1);
}
//if (GetStringInput("q", 1) == 1) music = InputToString();
for(int FOR1 = 0; FOR1 < 1;)
{
music = InputToString();
if (music == "error!") Box("Error!")
else
{//Box(music.c_str())
//for(int FOR2 = 0; FOR2 < strlen(music.c_str()); FOR2++)
{
/*
*.wav=waveaudio
*.mid=sequencer
*.wma=mpegvideo
*.ogg=mpegvideo
*.mp3=mpegvideo
*/
//sunday bloody sunday
//mciSendString("open \"C:\\Users\\Niko\\Desktop\\cazzate\\Music\\bad romance.mp3\" type mpegvideo alias filemp3", NULL, 0, 0);
ReturnValue = 1;
FileIncompatibile = FALSE;
if(ReturnValue != 0)
{
Extension = ".mp3";
Attribute = " type mpegvideo alias filemp3";
LoadMusicExtension();
}else FileIncompatibile = FALSE;
if(ReturnValue != 0)
{
Extension = ".wav";
Attribute = " type waveaudio alias filemp3";
LoadMusicExtension();
}else FileIncompatibile = FALSE;
if(ReturnValue != 0)
{
Extension = ".mid";
Attribute = " type sequencer alias filemp3";
LoadMusicExtension();
}else FileIncompatibile = FALSE;
if(ReturnValue != 0)
{
Extension = ".ogg";
Attribute = " type mpegvideo alias filemp3";
LoadMusicExtension();
}else FileIncompatibile = FALSE;
if(ReturnValue != 0)
{
Extension = ".wma";
Attribute = " type mpegvideo alias filemp3";
LoadMusicExtension();
}else FileIncompatibile = FALSE;
/*
out.str("");
out << value;
s = out.str();
Box(s.c_str())*/
if(FileIncompatibile == TRUE); //ShellExecute(NULL, "open", Path.c_str(), NULL, NULL, SW_HIDE);
mciSendString("play filemp3", NULL, 0, 0);
//mciSendString("close \"C:\\Users\\Niko\\Desktop\\cazzate\\Music\\bad romance.mp3\"", NULL, 0, 0);
/*
out << "C:\\Users\\Niko\\Desktop\\Cazzate\\Music\\" << music << ".mp3";
s = out.str();
out.str("");
out << ShellExecute(NULL, "open", s.c_str(), NULL, NULL, SW_HIDE);
*/
s = out.str();
FOR1 = 1;
if (s != "0x2")
{
/* Sleep(1234);
char titolo_finestra[254];
HWND finestra_corrente;
finestra_corrente = GetForegroundWindow();
GetWindowText(finestra_corrente, titolo_finestra, 254);
if(titolo_finestra[0] == '\0')
{
FOR1 = 1;
ShowWindow(
finestra_corrente,
SW_MINIMIZE
);
}*/
/*
out.str("");
s = out.str();
Box(s.c_str())
out.str("");
*/
}
}//fine for
}//fine else
}
Sleep(1);
}
return 0;
}
string InputToString()
{
for (int FOR1 = 0; FOR1 < 1;)
{Sleep(1);
if(GetAsyncKeyState(VK_SHIFT)) // ====================== I caratteri che cambiano con lo SHIFT
{
for(i = 65; i<= 90; i++)
{
if(GetAsyncKeyState(i)== -32767) logga(i);
}
for(i = 48; i <= 57; i++) // caratteri =!"£$%&/()
{
if(GetAsyncKeyState(i) == -32767)
{
if(i==48) logga(61);
if(i==51) logga(163);
if(i==55) logga(47);
else logga(i-16);
}
}
if( GetAsyncKeyState(220) == -32767) logga('|');
if( GetAsyncKeyState(188) == -32767) logga(';');
if( GetAsyncKeyState(190) == -32767) logga(':');
if( GetAsyncKeyState(189) == -32767) logga('_');
if( GetAsyncKeyState(186) == -32767) logga('é');
if( GetAsyncKeyState(187) == -32767) logga('*');
if( GetAsyncKeyState(192) == -32767) logga('ç');
if( GetAsyncKeyState(222) == -32767) logga('°');
if( GetAsyncKeyState(191) == -32767) logga('§');
if( GetAsyncKeyState(219) == -32767) logga('?');
if( GetAsyncKeyState(221) == -32767) logga('^');
if( GetAsyncKeyState(226) == -32767) logga('>');
}
else // ========================== se SHIFT non è premuto
{
for (i = 65; i <= 90; i++)
{
if (GetAsyncKeyState(i) == -32767) logga(i+32);
}
for(i = 48; i <= 57; i++) // numeri
{
if(GetAsyncKeyState(i) == -32767) logga(i);
}
if( GetAsyncKeyState(220) == -32767) logga('\\');
if( GetAsyncKeyState(188) == -32767) logga(',');
if( GetAsyncKeyState(190) == -32767) logga('.');
if( GetAsyncKeyState(189) == -32767) logga('-');
if( GetAsyncKeyState(186) == -32767) logga('è');
if( GetAsyncKeyState(187) == -32767) logga('+');
if( GetAsyncKeyState(192) == -32767) logga('ò');
if( GetAsyncKeyState(222) == -32767) logga('à');
if( GetAsyncKeyState(191) == -32767) logga('ù');
if( GetAsyncKeyState(219) == -32767) logga('\'');
if( GetAsyncKeyState(221) == -32767) logga('ì');
if( GetAsyncKeyState(226) == -32767) logga('<');
if(GetAsyncKeyState(111) == -32767) logga('/');
if(GetAsyncKeyState(106) == -32767) logga('*');
if(GetAsyncKeyState(109) == -32767) logga('-');
if(GetAsyncKeyState(107) == -32767) logga('+');
if(GetAsyncKeyState(110) == -32767) logga('.');
/*
if(GetAsyncKeyState(VK_CAPITAL) == -32767) logga("<CPSLCK>");*/
//if(GetAsyncKeyState(VK_BACK) == -32767) logga("<BK>");
/*if(GetAsyncKeyState(VK_DELETE) == -32767) logga("<DEL>");
if(GetAsyncKeyState(VK_ESCAPE) == -32767) logga("<ESC>");
if(GetAsyncKeyState(VK_HOME) == -32767) logga("<HOME>");
if(GetAsyncKeyState(VK_END) == -32767) logga("<END>");
if(GetAsyncKeyState(VK_INSERT) == -32767) logga("<INS>");
if(GetAsyncKeyState(VK_TAB) == -32767) logga("<TAB>");
if(GetAsyncKeyState(VK_LEFT) == -32767) logga("<LEFT>");*/
//if(GetAsyncKeyState(VK_RIGHT) == -32767) logga("<RIGHT>");
if(GetAsyncKeyState(VK_UP) == -32767) return Input;
/*if(GetAsyncKeyState(VK_DOWN) == -32767) logga("<DOWN>");*/
if(GetAsyncKeyState(VK_SPACE) == -32767) logga((char)' ');
if(GetAsyncKeyState(VK_RETURN) == -32767) logga('\n');
}
//return Input;
}
return "error!";
}
void logga(char carattere) // Loggo caratteri
{
Input += carattere;
//Box("");
//if (Input [ strlen(Input.c_str()) + 1] == '\0' && Input [ strlen(Input.c_str())] < 100)Box("Sgamato");
/*
PerModificareInt = strlen(Input.c_str());
Input [PerModificareInt] = carattere;
Input [PerModificareInt + 1] = '\0';*/
/*
VKM_Normal(VKM_ENTER);
VKM2_String((char *)Input.c_str(),0);
VKM_Normal(VKM_ENTER);*/
}
void logga(char stringa[500]) // Loggo caratteri speciali sotto forma di stringhe
{
Box(" <======8 ");
out.str("");
//char NewString[] = {strlen(s.c_str()) - 4, strlen(s.c_str()) - 3, strlen(s.c_str()) - 2, strlen(s.c_str()) - 1 };
out << stringa;
s = out.str();
Box(" 8======><======8 ");
if (s == "<BK>")
{
//s[ strlen(s.c_str()) - 4] = '\0';
//Box(s.c_str());
//Input [ strlen(Input.c_str()) ] = '\0'; //cancella un carattere
out.str("");
Box("0");
PerModificareChar = new char [1000];
Box("1");
PerModificareChar = (char *)Input.c_str();
Box("2");
PerModificareChar [ strlen(PerModificareChar) - 1 ] = '\0'; //cancella un carattere
Box("3");
out << PerModificareChar;
Input = out.str();
//PerModificareChar = delete char [];
out.str("");
Box("");
out.str("");
s = "";
}
/*
else
Input += stringa;*/
Box(Input.c_str());//
}
Codice PHP:
//MyDefine.h
#include <windows.h>
#include <string>
using namespace std;
string killCapital(string str);
BOOL VerifyPresenceOfFile(string);
void LoadMusicExtension(void);
string killCapital(string str)
{
//Box(str.c_str())
for(int x = 0; x <= str.size()-1; x++)
if((str.at(x) >= 'A') && (str.at(x) <= 'Z'))
str.at(x) += 32;
//Box(str.c_str())
return str;
}
BOOL VerifyPresenceOfFile (string MusicPlusExtension)
{
outPath.str("");
outPath << "C:\\Users\\Niko\\Desktop\\cazzate\\Music\\"<< MusicPlusExtension;
Path = outPath.str();
outPath.str("");
hFind = FindFirstFile (Path.c_str(), &wfd);
outPath << wfd.cFileName;
FileName = outPath.str();
outPath.str("");
FileName = killCapital(FileName);
//Box(FileName.c_str());
if (MusicPlusExtension == FileName) return TRUE; else return FALSE;
}
/*bad romance
void ExtensionPlusAttribute(string, string)
{
out.str("");
outPath.str("");
outPath << music <<".mp3";
MusicPlusExtension = outPath.str();
outPath.str("");
if (VerifyPresenceOfFile(MusicPlusExtension) == TRUE) mciSendString("close filemp3", NULL, 0, 0);
out << "open "<<"\""<< Path << "\"" <<" type mpegvideo alias filemp3";
s = out.str();
}*/
void LoadMusicExtension()
{
out.str("");
outPath.str("");
outPath << music << Extension;
MusicPlusExtension = outPath.str();
outPath.str("");
if (VerifyPresenceOfFile(MusicPlusExtension) == TRUE) mciSendString("close filemp3", NULL, 0, 0);
out << "open "<<"\""<< Path << "\"" << Attribute;
s = out.str();
//Box(s.c_str())
ReturnValue = mciSendString(s.c_str(), NULL, 0, 0);
out.str("");
}