-
June 14th, 2011, 06:51 PM
#1
Stuck with sockets/packets
Hi everyone, I'm currently attempting to create a 'bot' that will connect to a Flash game and send and receive packets. However, I'm a bit stuck as to how I should go about doing this...
I've searched about dll injection, sockets etc., but I haven't found anything that really gives me an idea of what I need to do, hence why I decided to join this forum and ask others.
If I could get some sort of send/recv packets to a server thing going, that'd be a real push in the right direction.
I'd be happy if someone could help/tell me what I need to know to complete this. Thanks
-
June 15th, 2011, 09:37 PM
#2
Re: Stuck with sockets/packets
As far as i know, Actionscript of flash has some built-in class for socket programming.
such as class "Socket" in namespace "flash.net.Socket", here is an example:
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.Socket;
public class SocketExample extends Sprite {
private var socket:Socket;
public function SocketExample( ) {
socket = new Socket( );
// Add an event listener to be notified when the connection
// is made
socket.addEventListener( Event.CONNECT, onConnect );
// Connect to the server
socket.connect( "localhost", 2900 );
}
private function onConnect( event:Event ):void {
trace( "The socket is now connected..." );
}
}
}
Last edited by deyili; June 15th, 2011 at 09:40 PM.
Reason: finished
-
June 15th, 2011, 09:43 PM
#3
Re: Stuck with sockets/packets
and if you want build a server, here is an example for you:
1 #include "unp.h"
2 int
3 main(int argc, char **argv)
4 {
5 int listenfd, connfd;
6 pid_t childpid;
7 socklen_t clilen;
8 struct sockaddr_in cliaddr, servaddr;
9 listenfd = Socket (AF_INET, SOCK_STREAM, 0);
10 bzero(&servaddr, sizeof(servaddr));
11 servaddr.sin_family = AF_INET;
12 servaddr.sin_addr.s_addr = htonl (INADDR_ANY);
13 servaddr.sin_port = htons (SERV_PORT);
14 Bind(listenfd, (SA *) &servaddr, sizeof(servaddr));
15 Listen(listenfd, LISTENQ);
16 for ( ; ; ) {
17 clilen = sizeof(cliaddr);
18 connfd = Accept(listenfd, (SA *) &cliaddr, &clilen);
19 if ( (childpid = Fork()) == 0) { /* child process */
20 Close(listenfd); /* close listening socket */
21 str_echo(connfd); /* process the request */
22 exit (0);
23 }
24 Close(connfd); /* parent closes connected socket */
25 }
26 }
It's a program for unix/linux. if you want to do it on windows, you'll need some small changes.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|