justeyngonzales Posted May 7, 2013 Group: Members Topic Count: 24 Topics Per Day: 0.01 Content Count: 72 Reputation: 0 Joined: 04/30/13 Last Seen: April 12, 2021 Share Posted May 7, 2013 Is it possible ? Quote Link to comment Share on other sites More sharing options...
Mootie Posted May 7, 2013 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 815 Reputation: 86 Joined: 10/26/12 Last Seen: June 10, 2022 Share Posted May 7, 2013 No. but some src code can Quote Link to comment Share on other sites More sharing options...
Jaburak Posted May 7, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 1125 Reputation: 236 Joined: 07/30/12 Last Seen: April 13 Share Posted May 7, 2013 Saw this one in eAthena, I do not know if this is compatible with rAthena. I suggest you to use Harmony, but here's the code. trunk/src/common/socket.c Index: socket.c =================================================================== --- socket.c (revision 13725) +++ socket.c (working copy) @@ -16,6 +16,7 @@ #ifdef WIN32 #include <winsock2.h> + #include <time.h> #include <io.h> #else #include <errno.h> @@ -112,7 +113,54 @@ sock_arr_len = fd+1; return fd; } + +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + int sAccept(int fd, struct sockaddr* addr, int* addrlen) { SOCKET s; @@ -196,6 +244,9 @@ time_t last_tick; time_t stall_time = 60; +uint32 max_frequency_warning = 12; //Max number of packets user can have that are within a certain interval of each other before the program kicks +int diff_tolerance = 7000; //In microseconds + uint32 addr_[16]; // ip addresses of local host (host byte order) int naddr_ = 0; // # of ip addresses @@ -317,9 +368,37 @@ set_eof(fd); return 0; } - session[fd]->rdata_size += len; session[fd]->rdata_tick = last_tick; + + // Anti-WPE script by Zohan + if(!session[fd]->flag.server && (RFIFOW(fd,0) == 0x0438 || RFIFOW(fd,0) == 0x0116)) + { + session[fd]->lastDiff = session[fd]->thisDiff; + session[fd]->lastPacket.tv_sec = session[fd]->thisPacket.tv_sec; + session[fd]->lastPacket.tv_usec = session[fd]->thisPacket.tv_usec; + gettimeofday(&session[fd]->thisPacket, NULL); + session[fd]->thisDiff = (((session[fd]->thisPacket.tv_sec - session[fd]->lastPacket.tv_sec) * 1000000) + session[fd]->thisPacket.tv_usec) - session[fd]->lastPacket.tv_usec; + if(abs(session[fd]->thisDiff - session[fd]->lastDiff) < diff_tolerance) + { + session[fd]->warning_number++; + if(session[fd]->warning_number > max_frequency_warning) + { + set_eof(fd); + } + } + else if(session[fd]->thisPacket.tv_sec - session[fd]->lastPacket.tv_sec > 10) + { + session[fd]->warning_number = 0; + } + else + { + if(session[fd]->warning_number > 0) + { + session[fd]->warning_number--; + } + } + } return 0; } trunk/src/common/socket.h Index: socket.h =================================================================== --- socket.h (revision 13725) +++ socket.h (working copy) @@ -83,6 +83,13 @@ size_t rdata_pos; time_t rdata_tick; // time of last recv (for detecting timeouts); zero when timeout is disabled + //Anti-WPE + struct timeval thisPacket; + struct timeval lastPacket; + int thisDiff; + int lastDiff; + uint32 warning_number; + RecvFunc func_recv; SendFunc func_send; ParseFunc func_parse; Quote Link to comment Share on other sites More sharing options...
Famous Posted August 30, 2013 Group: Members Topic Count: 145 Topics Per Day: 0.03 Content Count: 455 Reputation: 3 Joined: 06/19/12 Last Seen: February 26, 2018 Share Posted August 30, 2013 I hope we could have something like this from Hercules http://hercules.ws/board/topic/1105-hercules-wpe-free-june-14th-patch/ Quote Link to comment Share on other sites More sharing options...
Joseph Posted August 30, 2013 Group: Members Topic Count: 5 Topics Per Day: 0.00 Content Count: 341 Reputation: 43 Joined: 01/10/12 Last Seen: June 29, 2020 Share Posted August 30, 2013 - script AntiWPEandRPE -1,{ OnPCLoginEvent: dispbottom "Do not use WPE/RPE."; end; } Sadly, you can't do it with script. 3 Quote Link to comment Share on other sites More sharing options...
nanakiwurtz Posted August 30, 2013 Group: Members Topic Count: 81 Topics Per Day: 0.02 Content Count: 1654 Reputation: 583 Joined: 08/09/12 Last Seen: January 14, 2020 Share Posted August 30, 2013 - script AntiWPEandRPE -1,{ OnPCLoginEvent: dispbottom "Do not use WPE/RPE."; end; } Sadly, you can't do it with script. Quote Link to comment Share on other sites More sharing options...
kangfredy Posted August 30, 2013 Group: Members Topic Count: 112 Topics Per Day: 0.02 Content Count: 388 Reputation: 4 Joined: 05/01/12 Last Seen: October 25, 2022 Share Posted August 30, 2013 · Hidden by Capuche, August 31, 2013 - No reason given Hidden by Capuche, August 31, 2013 - No reason given - script AntiWPEandRPE -1,{ OnPCLoginEvent: dispbottom "Do not use WPE/RPE."; end; } Sadly, you can't do it with script. LOL trolling wkkwkw Link to comment
Phantom Of Rogue-Gon Posted August 31, 2013 Group: Members Topic Count: 65 Topics Per Day: 0.02 Content Count: 181 Reputation: 0 Joined: 08/07/13 Last Seen: September 15, 2014 Share Posted August 31, 2013 · Hidden by Capuche, August 31, 2013 - Trolling Hidden by Capuche, August 31, 2013 - Trolling use @cleanmap at commands Link to comment
uDe Posted September 2, 2013 Group: Members Topic Count: 43 Topics Per Day: 0.01 Content Count: 400 Reputation: 5 Joined: 12/05/11 Last Seen: September 27, 2015 Share Posted September 2, 2013 (edited) Saw this one in eAthena, I do not know if this is compatible with rAthena. I suggest you to use Harmony, but here's the code. trunk/src/common/socket.c Index: socket.c =================================================================== --- socket.c (revision 13725) +++ socket.c (working copy) @@ -16,6 +16,7 @@ #ifdef WIN32 #include <winsock2.h> + #include <time.h> #include <io.h> #else #include <errno.h> @@ -112,7 +113,54 @@ sock_arr_len = fd+1; return fd; } + +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else + #define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + int sAccept(int fd, struct sockaddr* addr, int* addrlen) { SOCKET s; @@ -196,6 +244,9 @@ time_t last_tick; time_t stall_time = 60; +uint32 max_frequency_warning = 12; //Max number of packets user can have that are within a certain interval of each other before the program kicks +int diff_tolerance = 7000; //In microseconds + uint32 addr_[16]; // ip addresses of local host (host byte order) int naddr_ = 0; // # of ip addresses @@ -317,9 +368,37 @@ set_eof(fd); return 0; } - session[fd]->rdata_size += len; session[fd]->rdata_tick = last_tick; + + // Anti-WPE script by Zohan + if(!session[fd]->flag.server && (RFIFOW(fd,0) == 0x0438 || RFIFOW(fd,0) == 0x0116)) + { + session[fd]->lastDiff = session[fd]->thisDiff; + session[fd]->lastPacket.tv_sec = session[fd]->thisPacket.tv_sec; + session[fd]->lastPacket.tv_usec = session[fd]->thisPacket.tv_usec; + gettimeofday(&session[fd]->thisPacket, NULL); + session[fd]->thisDiff = (((session[fd]->thisPacket.tv_sec - session[fd]->lastPacket.tv_sec) * 1000000) + session[fd]->thisPacket.tv_usec) - session[fd]->lastPacket.tv_usec; + if(abs(session[fd]->thisDiff - session[fd]->lastDiff) < diff_tolerance) + { + session[fd]->warning_number++; + if(session[fd]->warning_number > max_frequency_warning) + { + set_eof(fd); + } + } + else if(session[fd]->thisPacket.tv_sec - session[fd]->lastPacket.tv_sec > 10) + { + session[fd]->warning_number = 0; + } + else + { + if(session[fd]->warning_number > 0) + { + session[fd]->warning_number--; + } + } + } return 0; } trunk/src/common/socket.h Index: socket.h =================================================================== --- socket.h (revision 13725) +++ socket.h (working copy) @@ -83,6 +83,13 @@ size_t rdata_pos; time_t rdata_tick; // time of last recv (for detecting timeouts); zero when timeout is disabled + //Anti-WPE + struct timeval thisPacket; + struct timeval lastPacket; + int thisDiff; + int lastDiff; + uint32 warning_number; + RecvFunc func_recv; SendFunc func_send; ParseFunc func_parse; Anyone had tried this at rAthena? - script AntiWPEandRPE -1,{ OnPCLoginEvent: dispbottom "Do not use WPE/RPE."; end; } Sadly, you can't do it with script. Haha. Very sad! Posted 30 August 2013 - 05:59 PM I hope we could have something like this from Hercules http://hercules.ws/b...une-14th-patch/ Posted 15 June 2013 - 05:33 PM either request at rAthena to convert it, or change to using Hercules Hercules devs will not create this for rAthena o_O Dem~ Edited September 2, 2013 by uDe Quote Link to comment Share on other sites More sharing options...
chatterboy Posted January 28, 2014 Group: Members Topic Count: 8 Topics Per Day: 0.00 Content Count: 309 Reputation: 26 Joined: 11/26/12 Last Seen: November 22, 2024 Share Posted January 28, 2014 i will try this "Anakid" Quote Link to comment Share on other sites More sharing options...
Question
justeyngonzales
Is it possible ?
Link to comment
Share on other sites
9 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.