Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdlib.h>
- #include <stdio.h>
- #include <string>
- #include <sstream>
- #include <windows.h>
- using namespace std;
- LPWSTR stringToLPWSTR(const std::string& instr);
- int main(void)
- {
- ShellExecute(NULL, "open", "C:\\windows\\system32\\cmd.exe", " /C C:\\Temp\\wget.exe https://www.newbiecontest.org/epreuves/prog/prog1.php --no-check-certificate --load-cookies D:\\Documents\\NewbieContest\\Programmation\\Renvoi\\cookies.txt -p -O D:\\Documents\\NewbieContest\\Programmation\\Renvoi\\prog1.html", NULL, SW_HIDE);
- FILE* file = NULL;
- file = fopen("prog1.html", "r");
- char line[256];
- int magicNumber = 0;
- if (file)
- {
- while (fgets(line, sizeof(line), file))
- {
- stringstream ss;
- ss << line;
- string temp;
- int found;
- while (!ss.eof())
- {
- ss >> temp;
- if (stringstream(temp) >> found)
- magicNumber = found;
- temp = "";
- }
- }
- cout << "The number : " << magicNumber << endl;
- }
- string URL = "https://www.newbiecontest.org/epreuves/prog/verifpr1.php?solution=";
- URL.append(to_string(magicNumber));
- ShellExecuteW(NULL, L"open", L"C:\\Program Files\\Mozilla Firefox\\firefox.exe", stringToLPWSTR(URL), NULL, SW_SHOW);
- system("pause");
- }
- LPWSTR stringToLPWSTR(const std::string& instr)
- {
- int bufferlen = ::MultiByteToWideChar(CP_ACP, 0, instr.c_str(), instr.size(), NULL, 0);
- LPWSTR widestr = new WCHAR[bufferlen + 1];
- ::MultiByteToWideChar(CP_ACP, 0, instr.c_str(), instr.size(), widestr, bufferlen);
- widestr[bufferlen] = 0;
- return widestr;
- }
- //export cookie addon on NewbieContest to D:\\Documents\\NewbieContest\\Programmation\\Renvoi\\cookies.txt
- //g++ -Wall -o tok main.cpp
- //got : Ce n'est pas le bon nombre.. Retente ta chance.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement