diff options
author | Alex Borisov <b0ris@b0ris-universe.localdomain> | 2011-10-20 05:35:36 +0300 |
---|---|---|
committer | Alex Borisov <b0ris@b0ris-universe.localdomain> | 2011-10-20 05:35:36 +0300 |
commit | d3ff62b1eeaba12131226a277b56abd15b015bda (patch) | |
tree | 0bf38bbcb83ba2ca8bd9b4c7f30cf85559283c6e /client | |
parent | 4ac3da0fe4400b9109636143e8da53dbef6c3984 (diff) |
proxy representation classes
Diffstat (limited to 'client')
-rw-r--r-- | client/client.h | 14 | ||||
-rw-r--r-- | client/config | 20 | ||||
-rw-r--r-- | client/config_example | 17 | ||||
-rw-r--r-- | client/config_samples/proxy_list.cfg | 20 | ||||
-rw-r--r-- | client/config_samples/static_proxy_list.cfg | 2 | ||||
-rw-r--r-- | client/proxy.cpp | 79 | ||||
-rw-r--r-- | client/proxy.h | 37 |
7 files changed, 189 insertions, 0 deletions
diff --git a/client/client.h b/client/client.h new file mode 100644 index 0000000..4d35e2e --- /dev/null +++ b/client/client.h @@ -0,0 +1,14 @@ + +#ifndef CLIENT_H +#define CLIENT_H + +#ifdef WIN32 +#include <windows.h> +#else +#include <unistd.h> +#endif + +#include <iostream> +#include <string> + +#endif diff --git a/client/config b/client/config new file mode 100644 index 0000000..184aee0 --- /dev/null +++ b/client/config @@ -0,0 +1,20 @@ +config_update_interval=600; +client_update_interval=60000; + +#0 - invisible, 1 - visible +speed_visibility=0; + +#server option format (all values required) +#keyword ip:port timeout retry_interval +server=8.8.8.8:8080 600 60; +server=8.8.4.4:3124 100 50; + +welcome_msg="Hello, world!"; +top_panel_text="Top Panel"; +bottom_panel_text="Bottom Panel"; + +#firewall record format (all values required) +#keyword action address_pattern +firewall block *.adobeereg.com +firewall block ereg.adobe.com +firewall block practivate.adobe.com
\ No newline at end of file diff --git a/client/config_example b/client/config_example new file mode 100644 index 0000000..712ef6b --- /dev/null +++ b/client/config_example @@ -0,0 +1,17 @@ +BanTime=60; //minutes +ConnListCheckInterval=30; //seconds +ConnectionCount=30; //conection limit for ban +ConnectionTimeOut=60; //conection limit for ban +DosConnectionCount=200; //conections before adding to dos list +MainAccountInvalidLoginCount=10; //invalid logins to ban +SubAccountInvalidLoginCount=3; //subaccount invalid logins to disconnect +LSServerPort=80; //port for ls server http connection +LSServerHost=chat1.aionlegend.ru; //ls server host +BindAddress=0.0.0.0; //ip address to listen on, 0.0.0.0 - any +LogPath=/var/aion_otp; //auth system log file path, use /dev/null for disable +DosLogPath=/var/log/aion_otp_dos; // log path for dos ip list +Debug=0; //debug log + +//options name are case sensitive +//no spaces allowed in options +//; - end line character
\ No newline at end of file diff --git a/client/config_samples/proxy_list.cfg b/client/config_samples/proxy_list.cfg new file mode 100644 index 0000000..0c35bf4 --- /dev/null +++ b/client/config_samples/proxy_list.cfg @@ -0,0 +1,20 @@ +user:password@server.com:123 "Ukraine" "Kharkovskaya obl." "Kharkov"; +server.com:123 "Ukraine" "Kharkovskaya obl." "Izum"; +user:password@server.com:123 "Ukraine" "Kharkovskaya obl." "Balakleya"; +user:password@server.com:123 "Ukraine" "AR Krym" "Alushta"; +user:password@server.com:123 "Ukraine" "AR Krym" "Simferorpol"; +user:password@server.com:123 "Ukraine" "AR Krym" "Sevastopol"; +user:password@server.com:123 "Ukraine" "AR Krym" "Evpatoria"; +server.com:123 "Ukraine" "AR Krym" "Kerch"; +user:password@server.com:123 "Ukraine" "AR Krym" "Yalta"; +user:password@server.com:123 "Ukraine" "AR Krym" "Sudak"; +server.net:213 "Russia" "-" "Moscow"; +server.net:213 "Russia" "-" "St. Petersburg"; +server.net:213 "Russia" "-" "Perm"; +server.net:213 "Russia" "-" "Vlasivostok"; +server.net:213 "Russia" "-" "Belgorod"; +server.net:213 "Russia" "-" "Bryansk"; +server.net:213 "Russia" "-" "Sochi"; +server.net:213 "USA" "California" "San francisco"; +sdf:wer@sfds.info:666 "China" "-" "Shanghai"; + diff --git a/client/config_samples/static_proxy_list.cfg b/client/config_samples/static_proxy_list.cfg new file mode 100644 index 0000000..4bc40bd --- /dev/null +++ b/client/config_samples/static_proxy_list.cfg @@ -0,0 +1,2 @@ +asdsad:qweqwe@qweqwe.df:324 "lbl" 1; +sdfsdf:234 "asdd" 2; diff --git a/client/proxy.cpp b/client/proxy.cpp new file mode 100644 index 0000000..1857231 --- /dev/null +++ b/client/proxy.cpp @@ -0,0 +1,79 @@ + +#include <stdlib.h> +#include "proxy.h" + +/************************************** + * Proxy methods + **************************************/ + + // + // Parse proxy string and set calss members according to it's contents + // Some examples: + // user:password@server.com:1234 + // server.com:1234 +void Proxy::Parse(std::string entry) +{ + login.clear(); + password.clear(); + host.clear(); + + size_t lp1 = 0, lp2 = 0; + int port = 0; + if(entry.find('@') != std::string::npos) + { + lp2 = entry.find(':', lp1); + login = entry.substr(lp1, lp2-lp1); + lp1 = lp2+1; + lp2 = entry.find('@', lp1); + password = entry.substr(lp1, lp2-lp1); + lp1 = lp2+1; + lp2 = entry.find(':', lp1); + host = entry.substr(lp1, lp2-lp1); + lp1 = lp2+1; + port = atoi(entry.substr(lp1).c_str()); + } + else + { + lp2 = entry.find(':', lp1); + host = entry.substr(lp1, lp2-lp1); + lp1 = lp2+1; + port = atoi(entry.substr(lp1).c_str()); + } +} + + +/************************************** + * ProxyEntry methods + **************************************/ +void ProxyEntry::Parse(std::string entry) +{ + country.clear(); + state.clear(); + city.clear(); + + size_t lp1 = 0, lp2 = 0; + //extract Proxy part + lp2 = entry.find(" ", lp1); + std::string proxy = entry.substr(lp1, lp2-lp1); + Proxy::Parse(proxy); + // extract country, city and state + lp1 = lp2+2; + lp2 = entry.find('"', lp1); + country = entry.substr(lp1, lp2-lp1); + lp1 = lp2+3; + lp2 = entry.find('"', lp1); + state = entry.substr(lp1, lp2-lp1); + lp1 = lp2+3; + lp2 = entry.find('"', lp1); + city = entry.substr(lp1, lp2-lp1); +} + + +/************************************** + * StaticProxyEntry methods + **************************************/ +void ProxyEntryStatic::Parse(std::string entry) +{ + +} +
\ No newline at end of file diff --git a/client/proxy.h b/client/proxy.h new file mode 100644 index 0000000..321922a --- /dev/null +++ b/client/proxy.h @@ -0,0 +1,37 @@ + +#include <client.h> + +class Proxy +{ +public: + std::string login; + std::string password; + std::string host; + short port; + + Proxy(): port(0) {} + virtual void Parse(std::string entry); +}; + + +class ProxyEntry: public Proxy +{ +public: + std::string country; + std::string state; + std::string city; + + ProxyEntry(): Proxy() {} + void Parse(std::string entry); +}; + + +class ProxyEntryStatic: public Proxy +{ +public: + std::string name; + int position; + + ProxyEntryStatic(): Proxy(), position(0) {} + void Parse(std::string entry); +}; |