forked from markus/S_New4
v3.6.0: füge Möglichkkeit hinzu keinen Proxy zu verwenden & keinen Proxy bei standert paramater bei upgrade Modus
This commit is contained in:
parent
de69b0bc59
commit
812df40b98
@ -13,9 +13,15 @@ PageManager::~PageManager()
|
||||
|
||||
void PageManager::setProxy(std::string ip, int port)
|
||||
{
|
||||
this->sock5Proxy = "socks5://" + ip + ":" + std::to_string(port);
|
||||
if(debugMode)
|
||||
std::cout << "Proxy: " << ip << ":" << port << std::endl;
|
||||
if(!port) {
|
||||
if(debugMode)
|
||||
std::cout << " => INFO: Es wird kein Proxy verwendet." << std::endl;
|
||||
this->sock5Proxy = "";
|
||||
} else {
|
||||
this->sock5Proxy = "socks5://" + ip + ":" + std::to_string(port);
|
||||
if(debugMode)
|
||||
std::cout << "Proxy: " << ip << ":" << port << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void PageManager::setCookieFilePath(std::string path)
|
||||
@ -51,7 +57,8 @@ Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::strin
|
||||
char *url;
|
||||
std::string returnUrl;
|
||||
|
||||
std::cout << ( "\33[2K\rLade: '" + Url + "'..." ) << std::flush;
|
||||
//info ausgabe
|
||||
std::cout << ( "\33[2K\rLade: '" + Url + "'..." + ((debugMode) ? "\n" : "" )) << std::flush;
|
||||
|
||||
curl = curl_easy_init();
|
||||
if(!curl) {
|
||||
@ -60,10 +67,14 @@ Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::strin
|
||||
}
|
||||
|
||||
//Settings
|
||||
if(sock5Proxy != "")
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
||||
else if(debugMode)
|
||||
std::cout << "\33[2K\r => INFO: Es wird kein Proxy verwendet." << std::endl;
|
||||
|
||||
//curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); // html errors to errorcode res
|
||||
//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); // Progressausgabe aktivieren
|
||||
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str()); //Url für Curl
|
||||
curl_easy_setopt(curl, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); //follows redirection
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); // Funktion zum Speichern des outputs in einem string
|
||||
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); //Legt die Variable readbuffer fest
|
||||
@ -124,6 +135,9 @@ int PageManager::downLoadToFile(std::string filePath, std::string url)
|
||||
return 1;
|
||||
}
|
||||
|
||||
//Info ausgabe
|
||||
std::cout << ( "\33[2K\rDownloade: '" + url + "'..." + ((debugMode) ? "\n" : "" )) << std::flush;
|
||||
|
||||
/* init the curl session */
|
||||
curl_handle = curl_easy_init();
|
||||
if(!curl_handle) {
|
||||
@ -144,7 +158,10 @@ int PageManager::downLoadToFile(std::string filePath, std::string url)
|
||||
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);
|
||||
|
||||
//Sock5Proxy für Curl
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, sock5Proxy.c_str() );
|
||||
if(sock5Proxy != "")
|
||||
curl_easy_setopt(curl_handle, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
||||
else if(debugMode)
|
||||
std::cout << "\33[2K\r => INFO: Es wird kein Proxy verwendet." << std::endl;
|
||||
|
||||
//User Agent
|
||||
curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0");
|
||||
|
@ -166,6 +166,7 @@ int loadDefaulOptions(Settings &settings)
|
||||
ofs << "#DebugModus=false" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Einstellung gleicht dem Parameter -p, --socks5-proxy:" << std::endl;
|
||||
ofs << "# Verwende den Port 0 um keinen Proxy zu verwenden." << std::endl;
|
||||
ofs << "#Socks5Proxy=127.0.0.1:9050" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Einstellung gleicht dem Parameter -c, --colorless:" << std::endl;
|
||||
@ -603,7 +604,7 @@ void unterOption_default_help(std::string programName)
|
||||
<< "SOCK5PROXY:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< "AUSGABEOPTIONEN:" << std::endl
|
||||
<< " -o [Pfad], --output-file [Pfad]" << std::endl
|
||||
<< " Mit diere Option kann man ein (nichtvorhandenes) Text-Datei" << std::endl
|
||||
@ -740,7 +741,7 @@ void unterOption_url_help(std::string programName)
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< " -o [Pfad], --output-file [Pfad]" << std::endl
|
||||
<< " Mit diere Option kann man ein (nichtvorhandenes) Text-Datei angeben," << std::endl
|
||||
<< " inwelches die umgewandelten Redirect-Links geschrieben werden." << std::endl << std::endl
|
||||
@ -852,7 +853,7 @@ void unterOption_search_help(std::string programName)
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< " -e, --exactly-writing" << std::endl
|
||||
<< " Mit dieser Option achtet das Programm auf Groß- und Kleinschreibung." << std::endl << std::endl
|
||||
<< " -c, --colorless" << std::endl
|
||||
@ -940,7 +941,7 @@ void unterOption_info_help(std::string programName)
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< " -c, --colorless" << std::endl
|
||||
<< " Mit dieser Option kann man die farbige Ausgabe ausstellen." << std::endl << std::endl
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
@ -1043,7 +1044,7 @@ int setS5ProxytoSettings(Settings &settings, std::string Optarg)
|
||||
if(optarg.find("localhost") != std::string::npos)
|
||||
optarg.insert(optarg.find("localhost"), "127.0.0.1").erase(optarg.find("localhost"), 9);
|
||||
|
||||
//Wenn optarg keine vollständige Addresse ( ip:port ) ist:
|
||||
//Wenn optarg keine vollständige Addresse ( ip:port ) ist: ip || port
|
||||
if(optarg.find(":") == std::string::npos) {
|
||||
//Wenn optarg eine Zahl ist, also Port:
|
||||
if(isNumber(optarg)) {
|
||||
@ -1198,7 +1199,7 @@ void unterOption_news_help(std::string programName)
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 127.0.0.1:9050 - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< " -c, --colorless" << std::endl
|
||||
<< " Mit dieser Option kann man die farbige Ausgabe ausstellen." << std::endl << std::endl
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
@ -1212,6 +1213,9 @@ int unterOption_update(Settings *settings, int argc, char **argv)
|
||||
{
|
||||
settings->modus = Modus::UPDATE_MODUS;
|
||||
|
||||
//deaktiviere Proxy als Standert
|
||||
settings->proxy_port = 0;
|
||||
|
||||
int c = 0;
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
@ -1260,7 +1264,7 @@ void unterOption_update_help(std::string programName)
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " Standart: 'Port 0' - Port 0 um Proxy zu deaktivieren." << std::endl << std::endl
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
||||
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
||||
|
@ -63,7 +63,7 @@ struct Settings {
|
||||
proxy_ip = "127.0.0.1",
|
||||
languages = "GerDub,GerSub,Eng,",
|
||||
genaueHoster = "",
|
||||
version = "3.5.6",
|
||||
version = "3.6.0",
|
||||
defaultFileVersion="1.6",
|
||||
outputFilePath = "",
|
||||
default_checkPath = "",
|
||||
|
Loading…
Reference in New Issue
Block a user