Re: Røçkåfë££ë® §kåñK's WCS
Posted: Thu Dec 24, 2009 8:56 am
All of it is written in C.
Tech discussion, website creation and the world's best OT Forum!
https://forums.cricketmx.com/
Code: Select all
#include <winsock2.h>
BOOL WebsiteValid(char* websiteaddress)
{
struct hostent* host = gethostbyname(websiteaddress);
if (!host)
{
return 0;
}
if (!host->h_addr_list[0])
{
return 0;
}
struct sockaddr_in SockAddr;
SockAddr.sin_family = AF_INET;
SockAddr.sin_port = htons(80);
SockAddr.sin_addr.S_un.S_addr = *(DWORD*)host->h_addr_list[0]; // WINDOWS
SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
if (connect(sock, (struct sockaddr*)&SockAddr, sizeof(struct sockaddr)))
{
close(sock);
return 0;
}
close(sock);
return 1;
}
Code: Select all
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
BOOL WebsiteValid(char* websiteaddress)
{
struct hostent* host = gethostbyname(websiteaddress);
if (!host)
{
return 0;
}
if (!host->h_addr_list[0])
{
return 0;
}
struct sockaddr_in SockAddr;
SockAddr.sin_family = AF_INET;
SockAddr.sin_port = htons(80);
SockAddr.sin_addr.s_addr = *(DWORD*)host->h_addr_list[0];
SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
if (connect(sock, (struct sockaddr*)&SockAddr, sizeof(struct sockaddr)))
{
close(sock);
return 0;
}
char PageRequest[1024];
sprintf(PageRequest, "GET %s HTTP/1.0\n\n", websiteaddress);
send(sock, PageRequest, strlen(PageRequest), 0);
char* header = (char*)malloc(10);
memset(header, 0, 10);
int ret = recv(sock, header, 1, 0);
close(sock);
if (ret == 1)
{
return 1;
}
else
{
return 0;
}
}
Code: Select all
testUp.c: In function ‘WebsiteValid’:
testUp.c:7: warning: initialization makes pointer from integer without a cast
testUp.c:12: error: dereferencing pointer to incomplete type
testUp.c:19: error: ‘DWORD’ undeclared (first use in this function)
testUp.c:19: error: (Each undeclared identifier is reported only once
testUp.c:19: error: for each function it appears in.)
testUp.c:19: error: syntax error before ‘)’ token
testUp.c:20: error: ‘SOCKET’ undeclared (first use in this function)
testUp.c:21: error: ‘sock’ undeclared (first use in this function)
testUp.c:28: warning: incompatible implicit declaration of built-in function ‘sprintf’
testUp.c:29: warning: incompatible implicit declaration of built-in function ‘strlen’
testUp.c:31: warning: incompatible implicit declaration of built-in function ‘malloc’
testUp.c:32: warning: incompatible implicit declaration of built-in function ‘memset’
Code: Select all
SockAddr.sin_addr.s_addr = *(DWORD*)host->h_addr_list[0];
SOCKET sock = socket(AF_INET, SOCK_STREAM, 0);
if (connect(sock, (struct sockaddr*)&SockAddr, sizeof(struct sockaddr)))
Code: Select all
struct hostent* host = gethostbyname(websiteaddress);
Code: Select all
#include <netdb.h>
Code: Select all
#include <netinet/in.h>
Code: Select all
typedef unsigned long DWORD;
typedef int SOCKET;
* Fixed a bug with the plugin gui implementation when loading plugins post-runtime. Previously the "Help"
menu option was overwritten by the "Plugins" menu and also the plugins were not correctly initialised.
* Corrected the server message output in the new /online /offline command.
* Fixed a bug with the plugin OnUserJoin. Previously this prevented anyone being able to enter.
* Fixed a bug with the server gui. The primary connections were not set to offline when the server was set
to offline via the task tray right click menu.
* Added ShowChatHistory= in the config. Should be set to a number between 0 and 10. This is the
number of lines of chat history displayed to the newly entering user. Default is 0 (i.e. off).
* Fixed ShowChatHistory= so that the history is stored all the time and only displayed when the feature is
set on. Previously history was only saved once the feature was turned on.
* Fixed a bug with the MOTD. When it was not set, the server still sent some blank newlines.
* All plugin UI has been disabled as there have been unconfirmed reports of issues arising when plugins are
loaded for any period of time. This will remain the case until I have had chance to look into these reports
and confirm and fix the issues.
* Fixed ShowChatHistory= so that text is displayed as formatted as per in channel.
Please note: word replaces and newlines are NOT replaced in this section of text.
* Added a complex time calculator to ShowChatHistory= that removes chat history if it is older than 2 hours.
This way of doing it should capture any roll over of days/months/years/decades/millennia!!!
* Changed how the version number is set to simplify it for myself!
Now only needs changing in 1 place in the source.
Please Note: I will now be releasing updated ipdb.dat files on a monthly cycle (if possible) from around the beginning of the month so please check regularly.* Fixed a visual bug with very long stay times, idle times and wpn connection times when formatted and displayed
in the /stats <username> server output. Now using the same timer counter style as the ChatHistory feature
added in 1.9.5.2 so no more issues i hope!
* Fixed the server support and handling of the Emulator Protocol Chat Extension so it now sends all users statuses
and personal messages to users who enter. Previously just sent them when they changed.
* Fixed an issue I have been looking into for a while with cycling colour codes.
If the first message sent in room by a new user contained a cycle colour code in certain conditions it may have
caused the server to crash!
* Fixed a visual bug with stay times in /ranking (and the GUI output of /ranking). Now using the same timer
counter style as the ChatHistory feature added in 1.9.5.2
* Added newline support in ChatHistory. Now shows the chat history as seen in room.
* Removed the blank lines sent before and after ChatHistory.
* Removed the #cr# code from the ChatHistory outputs.
* Fixed cloning of user names in the userlist in Password'ed rooms.
* Moved the 3.53 server packet (0x0068), the colour code definition packet (0x9904), the server menu query packet
(0x9907), the Emulator protocol extension support query packet (0x3400), the IPSend query packet (0x9900) and the
server identification (0x9905) to pre-password entry.
* Removed the built in Winamp Display option in the config loading function (test feature I forgot to remove sorry!).
* Fixed /action and /emote text to display in server the same as /me text.
* Added a timer to the ban dispay message so that ! access users are not spammed with server messages if a banned user
repeatedly attempts to enter. Timer is 1 display message every 10 seconds.
* Now cleaned up the primary socket data held in memory when the server is set to offline while it had been running
online (a hangover from WCS primary handling).
* Fixed a bug with how the server dealt with long 3.31 protocol packet action text sent to server.
* Added the hostname and countryname to join information saved in the logs.
* Added a cleanup section to all primary cache sockets, all client sockets and the server listening socket when created
to avoid any TIME_WAIT or FIN_WAIT hangs when closed.
* Changed how the reload button works to avoid having to write the command to "exec.txt" file and the read it, should now
be cleaner and work better.
* Also changed how the usermenu in the server window sends commands, now sent the same way as the Reload button (as above).
* Tidied up the random colour codes appearance in the coloured chat window.
* Fixed initial userlist sent to users on entry for normal users from 0x006F to 0x0072 for all 3.53 protocol clients entering.
* Introduced a new style of IP to Country Databases compiled by myself. This will allow new updated versions made
specifically for R§WCS to be loaded which will be timestamp (backwards compatible to allow older WCS ipdb.dat files to work)
* Changed how the server checks the host ip. Now it will automatically update the room hash and host ip if you lose connection
and continue using the server.
* Fixed a possible exploit that allowed users with the correct access to be available to make the server list every password loaded
into the server from the config, including passwords with higher access than theirs. This affected WCS up to and including 1.8.7
* Added back the plugin support with some small changes, plus some extra server call functions to access further info.
* Cleaned up the loading and unloading of plugins.
* Auto-Load of plugins on startup now happens after the server is setup (previously was during server startup and
therefore could cause some issues with the setup process)
* Tidied up the code for Windows compiled versions.
* Tidied up the code and tweaked some bits to work better in Linux.
Now compiling debugging and compiling R§WCS-Linux on Ubuntu 10.04 LTS ("Lucid Lynx"). Seems to require a charset of ISO-8859-1
in the terminal to correctly display ascii text. Still seems to not pick up certain characters correctly.
* Fixed some console outputs in R§WCS-Linux which previously displayed colour codes.