 |
Cheat Engine The Official Site of Cheat Engine
|
| View previous topic :: View next topic |
| Author |
Message |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Mon Jan 05, 2009 1:29 pm Post subject: [SOLVED]Sending Packets specific |
|
|
Hi, ive got a little problem.
I want to send packets to a server. I already got it working, but right now, i have to place the ip and port inside the code.
| Code: |
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
char Data1[] = {0x02, 0x00, 0xFC, 0x01, 0x06, 0x50, 0x6C,0x61,0x79,0x65,0x72,0x00,0x09,0xC8,0x95,
0x9E,0x99,0xAA,0x9B,0xA0,0x9C,0x9C,0x6F,0x00,0x00,0x00,0x00,0x00,0x12,0x75,0x6E,
0x72,0x65,0x61,0x6C,0x73,0x6F, 0x66, 0x74,0x77,0x61,0x72,0x65,0x2E,0x62,0x6D,0x70};
void main() {
for (int i = 1; i < 10; i++){
WSADATA wsaData;
struct sockaddr_in RecvAddr;
// Initialize Winsock
printf("WSAStartup: %d\n", WSAStartup(MAKEWORD(2, 2), &wsaData));
// Create a socket for sending data
SOCKET DestSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
printf("Socket: %d\n", DestSocket);
// Set up IP address and port
RecvAddr.sin_family = AF_INET;
RecvAddr.sin_addr.s_addr = inet_addr("209.250.231.xx");
RecvAddr.sin_port = htons(atoi("36965"));
// Send an UDP packet
printf("\n");
int BytesSent = sendto(DestSocket, Data1, sizeof(Data1), NULL, (sockaddr
*)&RecvAddr, sizeof (RecvAddr));
printf("Bytes sent: %d\n", BytesSent);
printf("WSAGetLastError: %d\n", WSAGetLastError());
Sleep(1000);
};
}
|
Now, i want to have the user to input the ip and port.
I didnt really know how to do it, i've tried it with cin and cin.getinput
but i couldnt figure it out.
Last edited by blackmorpheus on Mon Jan 05, 2009 1:52 pm; edited 1 time in total |
|
| Back to top |
|
 |
Zerith Master Cheater
Reputation: 1
Joined: 07 Oct 2007 Posts: 468
|
Posted: Mon Jan 05, 2009 1:37 pm Post subject: |
|
|
You're having a problem getting a user input while you're coding with Winsock!?
| Code: |
char IpAddress[16];
unsigned short port;
cin >> IpAdress;
cin >> port;
|
..:\
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Mon Jan 05, 2009 1:44 pm Post subject: |
|
|
Sorry lol, i was being stupid, can be closed
|
|
| Back to top |
|
 |
&Vage Grandmaster Cheater Supreme
Reputation: 0
Joined: 25 Jul 2008 Posts: 1053
|
Posted: Mon Jan 05, 2009 2:53 pm Post subject: |
|
|
@Zerith But he's using stdio :S It's irrelevant for him to both use iostream and stdio.
Use gets();
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Tue Jan 06, 2009 2:07 pm Post subject: |
|
|
Would it be possible to randomize a small part of this Data1 array?
i mean the bytes 0x50 till 0x72
| Code: | | 0x50, 0x6C,0x61,0x79,0x65,0x72 | represent the player name im sending to my server. Would it be possible to randomize those?
( 50,6C etc, represent the ascii: Player)
|
|
| Back to top |
|
 |
oib111 I post too much
Reputation: 0
Joined: 02 Apr 2007 Posts: 2947 Location: you wanna know why?
|
Posted: Tue Jan 06, 2009 5:55 pm Post subject: |
|
|
Does that packet consist of both the header and payload, because if it does I would love if you could help me in constructing some packets
_________________
| 8D wrote: |
cigs dont make people high, which weed does, which causes them to do bad stuff. like killing |
|
|
| Back to top |
|
 |
blackmorpheus Expert Cheater
Reputation: 0
Joined: 05 Apr 2008 Posts: 159
|
Posted: Wed Jan 07, 2009 10:49 am Post subject: |
|
|
| Can anyone help to generate random bytes at Data1[5] and Data1[6] ?
|
|
| Back to top |
|
 |
Noz3001 I'm a spammer
Reputation: 26
Joined: 29 May 2006 Posts: 6220 Location: /dev/null
|
Posted: Wed Jan 07, 2009 11:13 am Post subject: |
|
|
| Code: | srand( GetTickCount() );
Data1[5] = rand() % 0xFF + 1;
Data1[5] = rand() % 0xFF + 1; |
Like dis?
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|