2019-07-06 18:47:29 +00:00
|
|
|
#include "accountManager.h"
|
|
|
|
|
2021-03-01 09:42:50 +00:00
|
|
|
AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountNumberFile, PAGE page)
|
|
|
|
: pathToAccountNumberFile(pathToAccountNumberFile + "_" + page.name_id), pageInUse(page)
|
2019-07-06 18:47:29 +00:00
|
|
|
{
|
2021-03-01 09:42:50 +00:00
|
|
|
std::string pathToAccountsFile = pathToFil + "_" + page.name_id;
|
|
|
|
std::ifstream ifs(pathToAccountsFile);
|
2019-07-06 18:47:29 +00:00
|
|
|
if(!ifs.is_open()) {
|
2021-03-01 09:42:50 +00:00
|
|
|
if(writeDefault(pathToAccountsFile) != 0)
|
2019-07-08 18:17:11 +00:00
|
|
|
exit(12);
|
2021-03-01 09:42:50 +00:00
|
|
|
ifs.open(pathToAccountsFile);
|
2019-07-08 18:17:11 +00:00
|
|
|
if(!ifs.is_open()) {
|
2019-08-17 15:55:00 +00:00
|
|
|
std::cout << " => Error: Konnte Account File nicht öffnen" << std::endl;
|
2019-07-08 18:17:11 +00:00
|
|
|
exit(13);
|
|
|
|
}
|
2019-07-06 18:47:29 +00:00
|
|
|
}
|
|
|
|
|
2019-07-08 18:17:11 +00:00
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
std::string line;
|
|
|
|
while (std::getline(ifs, line)) {
|
2019-07-08 18:17:11 +00:00
|
|
|
if(line.length() > 0 && line[0] == '#')
|
|
|
|
continue;
|
2019-07-06 18:47:29 +00:00
|
|
|
Account account;
|
|
|
|
size_t Delimeter = line.find("/");
|
|
|
|
|
|
|
|
if(Delimeter == std::string::npos) {
|
|
|
|
account.Email = line;
|
|
|
|
account.Password = line;
|
|
|
|
} else {
|
|
|
|
account.Email = std::string(line).erase(Delimeter, line.length() - Delimeter);
|
|
|
|
account.Password = line.erase(0, Delimeter + 1);
|
|
|
|
}
|
|
|
|
if(account.Email == "" || account.Password == "")
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
accounts.push_back(account);
|
|
|
|
}
|
|
|
|
|
2019-07-08 18:17:11 +00:00
|
|
|
ifs.close();
|
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Account AccountManager::getNextAccount()
|
|
|
|
{
|
2019-07-08 18:17:11 +00:00
|
|
|
if(accounts.size() == 0) {
|
2019-08-17 15:55:00 +00:00
|
|
|
std::cout << " => Error: Keine Accounts vorhanden." << std::endl;
|
2019-07-08 18:17:11 +00:00
|
|
|
exit(36);
|
|
|
|
}
|
|
|
|
size_t accountNumber = getLastAccountNumber();
|
2019-09-04 20:05:41 +00:00
|
|
|
++accountNumber;
|
2019-07-08 18:17:11 +00:00
|
|
|
|
|
|
|
if( accountNumber >= accounts.size() )
|
|
|
|
accountNumber=0;
|
|
|
|
if(setLastAccountNumber(accountNumber) != 0)
|
|
|
|
exit(45);
|
|
|
|
|
|
|
|
return accounts.at(accountNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
int AccountManager::writeDefault(std::string path)
|
|
|
|
{
|
|
|
|
std::ofstream ofs(path);
|
|
|
|
if(!ofs.is_open()) {
|
2019-08-17 15:55:00 +00:00
|
|
|
perror((std::string(" => Error: Konnte Account Datei nicht öffnen: ") + path).c_str());
|
2019-07-08 18:17:11 +00:00
|
|
|
return -1;
|
|
|
|
}
|
2019-08-17 15:55:00 +00:00
|
|
|
std::cout << " => Erstelle Datei mit Accounts unter: " << path << "..." <<std::endl;
|
2019-07-08 18:17:11 +00:00
|
|
|
ofs << "# <- Am Anfang der Zeile deaktiviert diese." << std::endl;
|
|
|
|
ofs << "#Email/Passwort - Falls diese gleich sind, geht auch nur Email oder Passwort" << std::endl;
|
2021-03-01 09:42:50 +00:00
|
|
|
|
|
|
|
if( pageInUse.url == "serienstream.sx" || pageInUse.url == "s.to" ) {
|
|
|
|
ofs << "EntzueckendPackenderSkorpion@oida.icu" << std::endl;
|
|
|
|
ofs << "HumorvollWundervollerDelfin@spam.care/HumorvollWundervollerDelfin@spam.care" << std::endl;
|
|
|
|
ofs << "ExzellentPackenderHirsch@muell.icu/ExzellentPackenderHirsch@muell.icu" << std::endl;
|
|
|
|
ofs << "GrandiosLeuchtenderPanda@papierkorb.me" << std::endl;
|
|
|
|
ofs << "AttraktivPositiverSteinbock@magspam.net" << std::endl;
|
|
|
|
ofs << "FreundlichKostbarerSteinbock@spam.care" << std::endl;
|
|
|
|
ofs << "FabelhaftSelbstsichererUhu@spam.care" << std::endl;
|
|
|
|
ofs << "HumorvollSinnlicherRabe@muell.icu" << std::endl;
|
|
|
|
ofs << "AnspruchsvollTraumhafterPavian@ultra.fyi" << std::endl;
|
|
|
|
ofs << "FaszinierendRiskanterLuchs@magspam.net" << std::endl;
|
|
|
|
ofs << "BeruehmtMystischerPanda@ultra.fyi" << std::endl;
|
|
|
|
ofs << "CharmantRasanterLoewe@existiert.net" << std::endl;
|
|
|
|
ofs << "BedeutendLuesternerAal@existiert.net" << std::endl;
|
|
|
|
ofs << "ElegantSelbstsichererAdler@ultra.fyi" << std::endl;
|
|
|
|
ofs << "FaszinierendKoeniglicherBaer@spam.care" << std::endl;
|
|
|
|
ofs << "CharmantKostbarerLoewe@magspam.net" << std::endl;
|
|
|
|
ofs << "BedeutendPrallerSkorpion@muellemail.com" << std::endl;
|
|
|
|
ofs << "FreundlichPerfekterRochen@muellmail.com" << std::endl;
|
|
|
|
ofs << "AusgelassenKostbarerBasilisk@magspam.net" << std::endl;
|
|
|
|
ofs << "FabelhaftLebhafterSchakal@ultra.fyi" << std::endl;
|
|
|
|
ofs << "ExzellentSchoenerSteinbock@existiert.net" << std::endl;
|
|
|
|
ofs << "ErhellendLustvollerAdler@muell.icu" << std::endl;
|
|
|
|
ofs << "ExzellentIdealerSchakal@muell.icu" << std::endl;
|
|
|
|
ofs << "BrillantVitalerSalamander@spam.care" << std::endl;
|
|
|
|
ofs << "BezauberndRiesigerSchakal@oida.icu" << std::endl;
|
|
|
|
ofs << "DynamischWarmerBaer@magspam.net" << std::endl;
|
|
|
|
ofs << "EmotionalLeidenschaftlicherBaer@oida.icu" << std::endl;
|
|
|
|
ofs << "BewundernswertWarmerSchwan@oida.icu" << std::endl;
|
|
|
|
ofs << "HuebschUnfassbarerAal@papierkorb.me" << std::endl;
|
|
|
|
ofs << "FroehlichWundervollerBiber@muellmail.com" << std::endl;
|
|
|
|
ofs << "BefreiendWilderDelfin@spam.care" << std::endl;
|
|
|
|
ofs << "FreundlichStilvollerTiger@oida.icu" << std::endl;
|
|
|
|
ofs << "EchtKoeniglicherStorch@existiert.net" << std::endl;
|
|
|
|
ofs << "BefluegeltPrallerSchwan@spam.care" << std::endl;
|
|
|
|
ofs << "ErhellendSeltenerSeeloewe@ultra.fyi" << std::endl;
|
|
|
|
ofs << "FreundlichZuverlaessigerSchwan@spam.care" << std::endl;
|
|
|
|
ofs << "HervorragendWundervollerReiher@oida.icu" << std::endl;
|
|
|
|
ofs << "AnspruchsvollStilvollerUhu@magspam.net" << std::endl;
|
|
|
|
ofs << "AnmutigTraumhafterHai@muellemail.com" << std::endl;
|
|
|
|
ofs << "AtemberaubendIdealerTapir@ultra.fyi" << std::endl;
|
|
|
|
ofs << "GeheimLeuchtenderLuchs@muellemail.com" << std::endl;
|
|
|
|
ofs << "DuftendKlarerTapir@muellmail.com" << std::endl;
|
|
|
|
ofs << "GeheimUnwiderstehlicherRabe@muell.icu" << std::endl;
|
|
|
|
ofs << "ExtravagantSpektakulaererAdler@spam.care" << std::endl;
|
|
|
|
ofs << "BildlichWarmerLoewe@oida.icu" << std::endl;
|
|
|
|
ofs << "AktivKlarerHai@spam.care" << std::endl;
|
|
|
|
ofs << "AktivKostbarerElch@oida.icu" << std::endl;
|
|
|
|
ofs << "Strust1991@jourrapide.com" << std::endl;
|
|
|
|
ofs << "Natchoughe1928@dayrep.com" << std::endl;
|
|
|
|
ofs << "zweirot@einrot.com" << std::endl;
|
|
|
|
ofs << "AktivMagischerFrosch@existiert.net" << std::endl;
|
|
|
|
ofs << "ErhellendPerfekterDachs@existiert.net" << std::endl;
|
|
|
|
ofs << "ojfvwj.fgf@existiert.net" << std::endl;
|
|
|
|
ofs << "lusiouae@wegwerfemail.de" << std::endl;
|
|
|
|
ofs << "fraiwrou@wegwerfemail.de" << std::endl;
|
|
|
|
ofs << "driotean@wegwerfemail.de" << std::endl;
|
|
|
|
ofs << "tiaprour@wegwerfemail.de" << std::endl;
|
|
|
|
ofs << "FeurigWarmerPapagei@existiert.net" << std::endl;
|
|
|
|
ofs << "FrischStilvollerPavian@magspam.net" << std::endl;
|
|
|
|
ofs << "FeurigZaghafterLoewe@muellmail.com" << std::endl;
|
|
|
|
ofs << "GigantischKoeniglicherSchwan@magspam.net" << std::endl;
|
|
|
|
ofs << "FreizuegigPersoenlicherLemming@spam.care" << std::endl;
|
|
|
|
ofs << "BelebtIntelligenterHusky@papierkorb.me" << std::endl;
|
|
|
|
ofs << "FreundlichMaximalerSpecht@muellmail.com" << std::endl;
|
|
|
|
ofs << "FreundlichStarkerHirsch@ultra.fyi" << std::endl;
|
|
|
|
ofs << "ErstklassigRasanterElch@oida.icu" << std::endl;
|
|
|
|
ofs << "FreundlichStarkerPavian@ultra.fyi" << std::endl;
|
|
|
|
ofs << "EinfuehlsamRiskanterPapagei@oida.icu" << std::endl;
|
|
|
|
ofs << "FantastischPositiverHirsch@existiert.net" << std::endl;
|
|
|
|
ofs << "GeborgenIndividuellerOtter@muell.icu" << std::endl;
|
|
|
|
ofs << "HervorragendSensibelerWal@oida.icu" << std::endl;
|
|
|
|
ofs << "HerrlichIndividuellerPelikan@spam.care" << std::endl;
|
|
|
|
ofs << "HerrlichLeuchtenderTapir@muellmail.com" << std::endl;
|
|
|
|
ofs << "ErstaunlichIntensiverEsel@magspam.net" << std::endl;
|
|
|
|
ofs << "ExtravagantPraechtigerWal@muellemail.com" << std::endl;
|
|
|
|
ofs << "GravierendWundervollerFalke@spam.care" << std::endl;
|
|
|
|
ofs << "EntzueckendLebhafterFlamingo@magspam.net" << std::endl;
|
|
|
|
ofs << "GeheimSprachloserStorch@existiert.net" << std::endl;
|
|
|
|
ofs << "GravierendVitalerOtter@spam.care" << std::endl;
|
|
|
|
ofs << "GrenzenlosInteressanterElch@oida.icu" << std::endl;
|
|
|
|
ofs << "HellPackenderGoldfisch@muellemail.com" << std::endl;
|
|
|
|
ofs << "AbenteuerlichSelbstloserFalke@muell.icu" << std::endl;
|
|
|
|
ofs << "EmotionalZaghafterPapagei@magspam.net" << std::endl;
|
|
|
|
ofs << "HellLiebenswerterElefant@muellemail.com" << std::endl;
|
|
|
|
ofs << "BildlichImponierenderEsel@muellemail.com" << std::endl;
|
|
|
|
ofs << "ErstaunlichSprachloserPapagei@ultra.fyi" << std::endl;
|
|
|
|
ofs << "BerauschendLebendigerDelfin@ultra.fyi" << std::endl;
|
|
|
|
ofs << "GravierendIntensiverHase@oida.icu" << std::endl;
|
|
|
|
ofs << "BerauschendUnglaublicherGorilla@oida.icu" << std::endl;
|
|
|
|
ofs << "GenuesslichPraechtigerDachs@spam.care" << std::endl;
|
|
|
|
|
|
|
|
} else if( pageInUse.url == "anicloud.io" ) {
|
|
|
|
ofs << "C322334ark1954@teleworm.us/C322334ark1954@teleworm.us" << std::endl;
|
|
|
|
ofs << "wemixex225@iconmle.com/wemixex225@iconmle.com" << std::endl;
|
|
|
|
ofs << "Thw86757utary@teleworm.us" << std::endl;
|
|
|
|
ofs << "thw811ssssutary@teleworm.us" << std::endl;
|
|
|
|
ofs << "Leonardoutary@teleworm.us" << std::endl;
|
|
|
|
ofs << "" << std::endl;
|
|
|
|
ofs << "" << std::endl;
|
|
|
|
ofs << "" << std::endl;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
std::cout << " => WARNUNG: Keine standart Accounts für die Url '" << pageInUse.url << "' vorhanden." <<std::endl;
|
2019-08-16 10:29:18 +00:00
|
|
|
}
|
2021-03-01 09:42:50 +00:00
|
|
|
|
2019-07-08 18:17:11 +00:00
|
|
|
ofs.close();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t AccountManager::getLastAccountNumber()
|
|
|
|
{
|
|
|
|
std::ifstream fStream;
|
|
|
|
fStream.open(pathToAccountNumberFile);
|
|
|
|
if(!fStream.is_open()) {
|
|
|
|
std::ofstream ofs;
|
|
|
|
ofs.open(pathToAccountNumberFile);
|
|
|
|
ofs << "0" << std::endl;
|
|
|
|
ofs.close();
|
|
|
|
fStream.open(pathToAccountNumberFile);
|
|
|
|
if(!fStream.is_open()) {
|
2019-08-17 15:55:00 +00:00
|
|
|
perror(" => Error: Konnte Account Number Datei nicht erstellen");
|
2019-07-08 18:17:11 +00:00
|
|
|
exit(34);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
std::string content( (std::istreambuf_iterator<char>(fStream) ), (std::istreambuf_iterator<char>() ) );
|
|
|
|
return static_cast<size_t>( atoi(content.c_str()) );
|
|
|
|
}
|
|
|
|
|
|
|
|
int AccountManager::setLastAccountNumber(size_t number)
|
|
|
|
{
|
|
|
|
std::ofstream ofs;
|
|
|
|
ofs.open(pathToAccountNumberFile, std::ios::trunc);
|
|
|
|
if(!ofs.is_open()) {
|
2019-08-17 15:55:00 +00:00
|
|
|
std::cout << " => Error: Account Number Datei ist nicht geöffnet." << std::endl;
|
2019-07-08 18:17:11 +00:00
|
|
|
return 110;
|
|
|
|
}
|
|
|
|
//fStream.clear();
|
|
|
|
ofs << number << std::endl;
|
|
|
|
return 0;
|
2019-07-06 18:47:29 +00:00
|
|
|
}
|
|
|
|
|