Imagine this: you load up a 4chan chat page, and you're connected to another user to chat one on one. Completely at random, with no traces of identity whatsoever. That's it. There could be a button to get a new person if you really don't like who you're talking to or you've seen them before, or you could just hit F5. In the true spirit of Anonymous, you could talk about anything in complete freedom.
I think that could be pretty awesome (and also pretty fail, but such is the way of all things chan), and it's an idea that I've had in the back of my mind for a while. I don't have the wherewithal to make it happen, however, so by /img/'s recommendation I'm here pitching it to /prog/ in the hope that someone will get inspired and make this happen. I'd really like to see it made real. I have to imagine that it would be very simple to make, although finding a good host and getting people to use it is another matter.
Yeah, the machine is still closing connections. I'm not using a kernel which supports large amounts of connections, so it basically shat itself. I'll restart the app once the port opens (since I'm too lazy to open another one on the router).
THANKS FOR PROVING ME WRONG :D
Name:
Anonymous2007-12-10 15:18
>>118 Microsoft Telnet> o rawwr.kicks-ass.net 7000
Connecting To rawwr.kicks-ass.net...Could not open connection to the host, on port 7000: Connect failed
Microsoft Telnet>
Name:
Anonymous2007-12-10 15:18
Hm, I suppose the machine ran out of memory due to Erlang, or something... it should be up by now if it was just being DDoSed.
Okay, there's 11 connections which are in FIN_WAIT_2, and I doubt they'll be closed before they timeout, which'll probably take awhile. So in the meanwhile -
telnet://rawwr.kicks-ass.net:7001/
To be sure, this vunerability is due to a software flaw, and not a bug with the platform it's running on (Erlang).
Name:
Anonymous2007-12-10 15:22
>>127
It was just a bunch of
echo `perl -e 'print rand 0, 9999'` | netcat rawwr.kicks-ass.net 7000 &
in a while loop. I killed it a few seconds later :)
{ new_client, ClientSock }
->
% Spawn a new thread for this client, attempt to get name
spawn( server, client_get_name, [ ClientSock, self() ] ),
% Loop
responder( ClientList );
{ client_choose_name, { ClientSock, ClientName } }
->
% Make sure the name isn't taken.
case lists:keysearch( ClientName, 2, ClientList ) of
false
->
% Add the client into the list
NewClientList = [ { ClientSock, ClientName } | ClientList ],
% Send the join message to all users
send_to_all_clients(
NewClientList,
io_lib:format(
"~s has joined the chat.~n",
[ ClientName ]
)
),
% Set up the thread to listen for that client
spawn( server, client,
[ { ClientSock, ClientName }, self() ]
),
% Loop with new client list.
responder( NewClientList );
{ value, _ }
->
% Send them a message
gen_tcp:send( ClientSock,
io_lib:format(
"The name ~s is already taken.~n",
[ ClientName ]
)
),
% Request they choose another name
spawn( server, client_get_name, [ ClientSock, self() ] ),
% Loop with old client list.
responder( ClientList )
end;
% Already looped above.
{ client_message, Msg }
->
% Message is preformatted.
% Need to send the message to all clients.
send_to_all_clients( ClientList, Msg ),
% Loop
responder( ClientList );
{ client_closed, { ClientSock, ClientName } }
->
% Remove the entry from the list, if it exists.
NewClientList = lists:keydelete( ClientSock, 1, ClientList ),
% Send message to all clients about logoff.
send_to_all_clients(
NewClientList,
io_lib:format( "~s has left the chat.~n", [ ClientName ] )
),
Okay, I'm turning it off for now. Source is posted for anyone else who wants to run it. The spam is (amazingly) eating too much bandwidth and I don't have any traffic shaping. I had fun though, thanks for the laughs, /prog/
Name:
Anonymous2007-12-10 16:24
This thread was brought to you by EXPERT PROGRAMMING(tm)
... Holy fuck. Well I'm glad someone gave this a shot, although I was hoping ultimately for some kind of web-based interface, as the telnet prompt isn't exactly user friendly. On that note, I can probably do a quick crash course in AJAX and cobble together some sort of front end if whoever writes the back end can give me a few pointers.
start( Port )
->
% Start up the responder so messages can get sent to it.
PID_Responder = spawn( server, responder, [ [] ] ),
% Create the server socket and start the server
case gen_tcp:listen( Port, [ list, { active, false }, { packet, line } ] ) of
{ ok, ServSock }
->
{ ok, Port } = inet:port( ServSock ),
io:format( "Listening on port ~w.~n", [ Port ] ),
listen( ServSock, PID_Responder, invalid, 0, [] );
{ error, Reason }
->
{ error, Reason }
end
.
listen( ServerSock, PID_Responder, LastIP, IPtimes, BannedIPs )
->
% Grab the client attempting to connect
case gen_tcp:accept( ServerSock, 5 * 60 * 1000 ) of
{ ok, ClientSock }
->
% IP checking and banning
{ ok, { IP, _ } } = inet:peername( ClientSock ),
io:format( "Client connected from ~p!~n", [ IP ] ),
case lists:member(IP, BannedIPs) of
true
->
gen_tcp:send( ClientSock, "B&\n" ),
gen_tcp:close( ClientSock ),
listen( ServerSock, PID_Responder, IP, 0, BannedIPs );
false
->
% Set up the thread to listen for that client
spawn( server, client, [ClientSock, PID_Responder] ),
case IP == LastIP of
true
->
case IPtimes < 10 of
true
->
listen( ServerSock, PID_Responder, IP, IPtimes + 1, BannedIPs );
false
->
listen( ServerSock, PID_Responder, IP, 0, [ IP | BannedIPs ] )
end
;
false
->
listen( ServerSock, PID_Responder, IP, 0, BannedIPs )
end
end
;
Other
->
io:format( "gen_tcp:accept returned ~p. Quitting.~n", [ Other ] )
end
.
client( ClientSock, PID_Responder )
->
% Welcome message
gen_tcp:send( ClientSock,
"HAVE YOU READ YOUR SICP TODAY?
Use /next to ditch current chatpartner.
Use /echo to toggle echoing.
Waiting for a chatter...\n"),
% Make thread to handle connection
spawn( server, client_listen, [ ClientSock, self() ] ),
% Add to list of available chatters
PID_Responder ! { add_client, self() },
% Go into the main loop
client_mainloop( ClientSock, PID_Responder, nope, false )
.
client_mainloop( ClientSock, PID_Responder, Otherperson, Echo )
->
receive
{ toggle_echo }
->
gen_tcp:send( ClientSock,
io_lib:format("Echo mode set to ~p~n", [ not Echo ] )),
client_mainloop( ClientSock, PID_Responder, Otherperson, not Echo );
{ die }
->
case Otherperson of
nope
->
ok;
PID
->
PID ! { disconnected }
end
,
PID_Responder ! { remove_client, self() },
{ send_message, Message }
->
case Otherperson of
nope
->
ok;
PID
->
case Echo of
true
->
gen_tcp:send( ClientSock,
io_lib:format("<Me> ~s~n", [ Message ] ) );
false
->
ok
end
,
PID ! { message, Message }
end
,
% Loop
client_mainloop( ClientSock, PID_Responder, Otherperson, Echo )
end
.
isprintable( Character )
->
Character >= 32 andalso Character =< 126
.
client_listen( ClientSock, ClientPID )
->
% Just wait for something to happen.
case gen_tcp:recv( ClientSock, 0 ) of
{ ok, RawMsg }
->
Msg = lists:filter( fun isprintable/1, RawMsg ),
case lists:sublist(Msg, 5) of
"/next"
->
ClientPID ! { disconnect };
"/echo"
->
ClientPID ! { toggle_echo };
_
->
ClientPID ! { send_message, Msg }
end
,
% Loop
client_listen( ClientSock, ClientPID );
{ error, _ }
->
gen_tcp:close(ClientSock),
ClientPID ! { die }
end
.
random2( Max )
->
% Get two random numbers 1 <= x <= Max
Random1 = random:uniform( Max ),
Random2 = random:uniform( Max ),
case Random1 == Random2 of
true
->
random2( Max );
false
->
{Random1, Random2}
end
.
>>89 here
Right smack in the middle of my first finals week of comp sci grad school, which is why I can't do it this week. But this weekend, I will probably hack something together. It shouldn't be too hard to pair people up, and once they're paired up, I see no reason why they'd need to go through the server anymore, so it shouldn't be _too much_ of a load on the server.
(except of course, EXPERT PROGRAMMERS may DoS it, etc...)
Name:
Anonymous2007-12-11 4:39
It's empty. Post URL in /b/ or something.
Name:
Anonymous2007-12-11 6:39
THERES ANOTHER ON BEEN POSTED ON B. WHY IS IT NOT MENTIONED HERE. I GOT BANNED FROM IT FOR STRESS TESTING.