| | |
Terminating Zero Problem
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
There are different socket type protocols. Do you know what protocol the source and destination sockets are communicating with? Based upon the data you're seeing it doesn't look encrypted!
You're trying to intercept the message, by listening on any address.
Is your computer setup as a bridge? Two network cards? If not, how do you know the source isn't still communicating with the target!
Normally if you're trying to intercept, you aren't a node on a network, you put yourself in the data stream.
Which requires two separate sockets.
Otherwise you're just sniffing packets, not trying to relay them on the sly. Unless you have told the sender to send straight to you, and then you send them to where the sender originally wanted to go!
I'm not familiar with Python but what does its code look like!
You're trying to intercept the message, by listening on any address.
Is your computer setup as a bridge? Two network cards? If not, how do you know the source isn't still communicating with the target!
Normally if you're trying to intercept, you aren't a node on a network, you put yourself in the data stream.
C++ Syntax (Toggle Plain Text)
NODE --------------------HOST --------------------------YOU NODE--/ \-----NODE NODE --------- > YOU < -------HOST
Otherwise you're just sniffing packets, not trying to relay them on the sly. Unless you have told the sender to send straight to you, and then you send them to where the sender originally wanted to go!
I'm not familiar with Python but what does its code look like!
4,294,967,295
0xffffffff (-1)
Check the error!
Sounds like you don't have your second connection between proxy and Host established!
let's see your code again!
0xffffffff (-1)
Check the error!
Sounds like you don't have your second connection between proxy and Host established!
let's see your code again!
C Syntax (Toggle Plain Text)
int rval = send( hSock, (const char *)vp, nLen, 0 ); if (SOCKET_ERROR == rval) { closesocket( hSock ); hSock = INVALID_SOCKET; ELog( "Error: sendto() %s", ErrText( WSAGetLastError() ) ); return false; }
C Syntax (Toggle Plain Text)
// // Error String // char *WSock::ErrText( int err ) { static char buf[80]; switch (err) { case WSAEINTR: // 10004 return "(10004) WSAEINTR - Interrupted function call."; case WSAEACCES: // 10013 return "(10013) WSAEACCES - Permission Denied."; case WSAEFAULT: // 10014 return "(10014) WSAEFAULT - Bad Address."; case WSAEINVAL: // 10022 return "(10022) WSAEINVAL - Invalid Argument."; case WSAEMFILE: // 10024 return "(10024) WSAEMFILE - Too many open files."; case WSAEWOULDBLOCK: // 10035 return "(10035) WSAEWOULDBLOCK - Resource temporarily unavailable."; case WSAEINPROGRESS: // 10036 return "(10036) WSAEINPROGRESS , Operation now in progress."; case WSAEALREADY: // 10037 return "(10037) WSAEALREADY - Operation already in progress."; case WSAENOTSOCK: // 10038 return "(10038) WSAENOTSOCK - Socket operation on nonsocket."; case WSAEDESTADDRREQ: // 10039 return "(10039) WSAEDESTADDRREQ - Destination address required."; case WSAEMSGSIZE: // 10040 return "(10040) WSAEMSGSIZE - Message too long."; case WSAEPROTOTYPE: // 10041 return "(10041) WSAEPROTOTYPE - Protocol wrong type for socket."; case WSAENOPROTOOPT: // 10042 return "(10042) WSAENOPROTOOPT - Bad protocol option."; case WSAEPROTONOSUPPORT: // 10043 return "(10043) WSAEPROTONOSUPPORT - Protocol not supported."; case WSAESOCKTNOSUPPORT: // 10044 return "(10044) WSAESOCKTNOSUPPORT - Socket type not supported."; case WSAEOPNOTSUPP: // 10045 return "(10045) WSAEOPNOTSUPP - Operation not supported."; case WSAEPFNOSUPPORT: // 10046 return "(10046) WSAEPFNOSUPPORT - Protobol family not supported."; case WSAEAFNOSUPPORT: // 10047 return "(10047) WSAEAFNOSUPPORT - Address family not supported by protocol family."; case WSAEADDRINUSE: // 10048 return "(10048) WSAEADDRINUSE - Address already in use."; case WSAEADDRNOTAVAIL: // 10049 return "(10049) WSAEADDRNOTAVAIL - Cannot assign requested address."; case WSAENETDOWN: // 10050 return "(10050) WSAENETDOWN - Network is down."; case WSAENETUNREACH: // 10051 return "(10051) WSAENETUNREACH - Network is unreachable."; case WSAENETRESET: // 10052 return "(10052) WSAENETRESET - Network dropped connection on reset."; case WSAECONNABORTED: // 10053 return "(10053) WSAECONNABORTED - Software caused connection abort."; case WSAECONNRESET: // 10054 return "(10054) WSAECONNRESET - Connection reset by peer."; case WSAENOBUFS: // 10055 return "(10055) WSAENOBUFS - No buffer space available."; case WSAEISCONN: // 10056 return "(10056) WSAEIRCONN - Socket is already connected."; case WSAENOTCONN: // 10057 return "(10057) WSAENOTCONN - Socket is not connected."; case WSAESHUTDOWN: // 10058 return "(10058) WSAESHUTDOWN - Cannot Twx/Rcv after socket shutdown."; case WSAETIMEDOUT: // 10060 return "(10060) WSAETIMEDOUT - Connection timed out."; case WSAECONNREFUSED: // 10061 return "(10061) WSAECONNREFUSED - Connection refused."; case WSAEHOSTDOWN: // 10064 return "(10064) WSAEHOSTDOWN - Host is down."; case WSAEHOSTUNREACH: // 10065 return "(10065) WSAEHOSTUNREACH - No route to host."; case WSAEPROCLIM: // 10067 return "(10067) WSAEPROCLIM - Too many processes."; case WSASYSNOTREADY: // 10091 return "(10091) WSASYSNOTREADY - Network subsystem is unavailable."; case WSAVERNOTSUPPORTED: // 10092 return "(10092) WSAVERNOTSUPPORTED - Winsock.dll version out of range."; case WSANOTINITIALISED: // 10093 return "(10093) WSANOTINITIALISED - Successful WSARtartup not yet performed."; case WSAEDISCON: // 10101 return "(10101) WSAEDISCON - Graceful shutdown in progress."; #ifdef WSATYPE_NOT_FOUND case WSATYPE_NOT_FOUND: // 10109 return "(10109) WSATYPE_NOT_FOUND - Class type not found."; #endif case WSAHOST_NOT_FOUND: // 11001 return "(11001) WSAHOST_NOT_FOUND - Host not found."; case WSATRY_AGAIN: // 11002 return "(11002) WSATRY_AGAIN - Nonauthoritative host not found."; case WSANO_RECOVERY: // 11003 return "(11003) WSANO_RECOVERY - This is a nonrecoverable error."; case WSANO_DATA: // 11004 return "(11004) WSANO_DATA - Valid name, no data record of requested type."; default: sprintf( buf, "(%d)", err ); return buf; break; } }
Last edited by wildgoose; Aug 12th, 2009 at 4:48 pm.
•
•
Join Date: Aug 2009
Posts: 32
Reputation:
Solved Threads: 0
I know I intercept all the messages, because I can set up in the config what the server IP is, which is 127.0.0.1:1339 in this case.
I also know you need two sockets, I got a program running two sockets, but for the previous problem I just made a simplified version of my program.
I am not either familiar with Python, my cousin made this one:
I am now trying to find out what the error message is, I will let you know in a few minutes.
I also know you need two sockets, I got a program running two sockets, but for the previous problem I just made a simplified version of my program.
I am not either familiar with Python, my cousin made this one:
Python Syntax (Toggle Plain Text)
from socket import *;import thread,time,pickle;caddr=("127.0.0.1", 1337);saddr=("94.75.229.241", 7777);tijdbalk = [];infobalk = [] cl = socket(AF_INET,SOCK_DGRAM) cl.bind(("",1337)) sv = socket(AF_INET,SOCK_DGRAM) sv.connect(("94.75.229.241", 7777)) def a(): global caddr,saddr,infobalk,tijdbalk while 1: try: (data, caddr) = cl.recvfrom(999999) tijdbalk.append(time.time()) infobalk.append(data) sv.sendto(data, (saddr)) except: None def b(): global caddr,saddr while 1: try: (data, saddr) = sv.recvfrom(999999) cl.sendto(data, (caddr)) except: None thread.start_new_thread(a,()) thread.start_new_thread(b,()) raw_input("Done?") cl.close() sv.close() file = raw_input("Profile name: ") data = pickle.dumps([tijdbalk,infobalk]) c = open(file,"wb") c.write(data) c.close()
I am now trying to find out what the error message is, I will let you know in a few minutes.
•
•
Join Date: Aug 2009
Posts: 32
Reputation:
Solved Threads: 0
I am sure it works trough UDP, because so does the Python script.
This is my real code:
This is my real code:
C++ Syntax (Toggle Plain Text)
#include <cstdio> #include <winsock2.h> #include <iostream> #include <string> using namespace std; struct incSockets { SOCKET* sv; SOCKET* cl; sockaddr_in* clSockAddr; sockaddr_in* svSockAddr; }; void filter( char* packet, int nPacketLen ) { while (nPacketLen > 0) { cout << "(" << int(*packet) << ")"; packet++; nPacketLen--; } cout << endl; } DWORD WINAPI svtocl(void* param) { cout << "Arived in thread SVTOCL" << endl; struct incSockets* incs = static_cast<struct incSockets*>(param); SOCKET cl = *incs->cl; SOCKET sv = *incs->sv; sockaddr_in clSockAddr = *incs->clSockAddr; sockaddr_in svSockAddr = *incs->svSockAddr; char buffer[999999]; size_t bytesReceived; int fromlen = 999999; int bytes_sent; while(true){ bytesReceived = recvfrom(sv, buffer, 999999, 0, (struct sockaddr *)&svSockAddr, &fromlen); if(bytesReceived < 0) { cout << "svtocl error" << endl; } if(bytesReceived > 0) { cout << "Server: "; cout << "Bytes: " << bytesReceived << endl; Sleep(10000); } bytes_sent = sendto(cl, buffer, 999999, 0, (struct sockaddr*)&clSockAddr, sizeof(struct sockaddr_in)); } } DWORD WINAPI cltosv(void* param) { cout << "Arived in thread CLTOSV" << endl; struct incSockets* incs = static_cast<struct incSockets*>(param); SOCKET cl = *incs->cl; SOCKET sv = *incs->sv; sockaddr_in clSockAddr = *incs->clSockAddr; sockaddr_in svSockAddr = *incs->svSockAddr; char buffer[999999]; size_t bytesReceived; int fromlen = 999999; int bytes_sent; while(true){ bytesReceived = recvfrom(cl, buffer, 999999, 0, (struct sockaddr *)&clSockAddr, &fromlen); if(bytesReceived < 0) { cout << "cltosv error" << endl; } if(bytesReceived > 0) { cout << "Client: "; cout << "Bytes: " << bytesReceived << endl; //filter(buffer, bytesReceived); } bytes_sent = sendto(sv, buffer, 999999, 0, (struct sockaddr*)&svSockAddr, sizeof(struct sockaddr_in)); //Sleep(3000); } } int main(int argc, char** argv) { struct incSockets incs; const int iReqWinsockVer = 2; WSADATA wsaData; if (WSAStartup(MAKEWORD(iReqWinsockVer,0), &wsaData)==0) { if (LOBYTE(wsaData.wVersion) >= iReqWinsockVer) { SOCKET cl = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); SOCKET sv = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); if (cl==INVALID_SOCKET) { cout << "Client: 1" << endl; } if(sv == INVALID_SOCKET) { cout << "Server: 1" << endl; } sockaddr_in clSockAddr; memset(&clSockAddr, 0, sizeof(clSockAddr)); clSockAddr.sin_family = AF_INET; clSockAddr.sin_port = htons(1339); clSockAddr.sin_addr.S_un.S_addr = INADDR_ANY; if (bind(cl, (sockaddr*)(&clSockAddr), sizeof(clSockAddr))!=0) { cout << "Client: 2" << endl; } sockaddr_in svSockAddr; memset(&svSockAddr, 0, sizeof(svSockAddr)); svSockAddr.sin_family = AF_INET; svSockAddr.sin_port = htons(7777); svSockAddr.sin_addr.S_un.S_addr = inet_addr("94.75.229.241"); incs.clSockAddr = &clSockAddr; incs.svSockAddr = &svSockAddr; incs.cl = &cl; incs.sv = &sv; void* pIncs = &incs; DWORD threadId1; CreateThread(0, 0, cltosv, pIncs, 0, &threadId1); DWORD threadId2; CreateThread(0, 0, svtocl, pIncs, 0, &threadId2); while(true) {} closesocket(cl); closesocket(sv); } else { // Required version not available } // Cleanup winsock if (WSACleanup()!=0) { // cleanup failed } } else { // startup failed } return 0; }
•
•
Join Date: Aug 2009
Posts: 32
Reputation:
Solved Threads: 0
(10022) WSAEINVAL - Invalid Argument.
Is the error I get.
Oh, why I do this.
Well, it is for Grand Theft Auto San Andreas Multi-Player. GTA SAMP.
If I know the packets I receive I can alter them. I am planning to make some kind of bot, but most of all, just because it's possible, and I thought this was a nice way to learn programming better.
Is the error I get.
Oh, why I do this.
Well, it is for Grand Theft Auto San Andreas Multi-Player. GTA SAMP.
If I know the packets I receive I can alter them. I am planning to make some kind of bot, but most of all, just because it's possible, and I thought this was a nice way to learn programming better.
Last edited by Schoorsteen; Aug 12th, 2009 at 5:09 pm.
![]() |
Similar Threads
- problem with passing dynamic links (C)
- OUTPUT problem (C++)
- Tubo C strange problem (C)
- IE 6 problem with .innerHTML (JavaScript / DHTML / AJAX)
- Input Stream Problem (C++)
- Problem with "getline(cin, name)" (C++)
- problem with output values (Assembly)
- Need help with signals problem please... (C)
- A small problem in the output (C++)
Other Threads in the C++ Forum
- Previous Thread: sequence diagram help
- Next Thread: how to derive class from a derived class
| Thread Tools | Search this Thread |
api application array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg simple sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets





