1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
#include <iostream>
#include <sstream>
#include <winsock2.h>
#include "Data.h"
using namespace std;
int main(int argc,char *argv[])
{
string portnumber(argv[1]); // Buffer for first argument (port number)
unsigned short portnum; // port number
istringstream selectport(portnumber);
selectport >> portnum; // extract port number from first argument (forgive me, i'm noob ^^)
char *launchprogram=new char[150]; // Buffer for second argument (program to launch)
launchprogram=argv[2];
data s11,s12; // Objects for save login and password
if (argc == 0 )
{
cout << " Default cfg is set. Port number is: 12345 and launched program is: C:\\WINDOWS\\System32\\Cmd.exe " << endl;
cout << " You can use this syntax: ServLogin.exe portnumber launchedprogram user password" << endl;
cout << " Example: ServLogin.exe 1337 C:\\WINDOWS\\System32\\Cmd.exe mike greyhat" << endl;
}
if ((argc != 3) && (argc != 0) && (argc !=5))
{
cout <<"\n -==| Samael Login Server |==-\n"<< endl;
cout << " You can use this syntax: ServLogin.exe portnumber launchedprogram login password" << endl;
cout << " Or this: ServLogin.exe portnumber launchedprogram" << endl;
cout << " Example: ServLogin.exe 1337 C:\\WINDOWS\\System32\\Cmd.exe user password" << endl;
cout << " You can also let the default config" <<endl;
cout << " Defaut config: "<< endl;
cout << " Port number is: 12345" << endl;
cout << " Launched program is: C:\\WINDOWS\\System32\\Cmd.exe"<< endl;
cout << " Login is: userAlpha" << endl;
cout << " Password is: passwordAlpha" << endl;
exit(0);
}
if (argc == 5)
{
s11.set(argv[3],argv[4]); // Set login and password from third and fourth arguments
} |
Partager