deadman 33 Posted December 17, 2014 Share Posted December 17, 2014 Well, dev actually, im trying to add a block to the core like this: i put a IP for example: 5.5.5.5 and if the server dont have the same ip of the core don't start. any idea of how i do this? Link to comment Share on other sites More sharing options...
Active Member Koray 1999 Posted December 17, 2014 Active Member Share Posted December 17, 2014 use internal ip algorithm Link to comment Share on other sites More sharing options...
Honorable Member martysama0134 7178 Posted December 17, 2014 Honorable Member Share Posted December 17, 2014 Well, dev actually, im trying to add a block to the core like this: i put a IP for example: 5.5.5.5 and if the server dont have the same ip of the core don't start. any idea of how i do this? It could be put at the end of this function inside config.cppvoid config_init(const string& st_localeServiceName) if (strcmp(g_szPublicIP, "5.5.5.5")) { fprintf(stderr, "Illegal IPn"); exit(1); } Check out my GitHub Link to comment Share on other sites More sharing options...
Krixius 13 Posted December 18, 2014 Share Posted December 18, 2014 martysama, as i see in your code, if i put the same ip of the dedicated machine, the game never starts. so, i think we need to put the ! for put a diference in the condition im right ? Regards Akroma PD: As i see in the first comment, deadman, is trying to block other IPS not, the ip of the dedicated. PD2: my fault, as i see the strcmp, is for compare, btw i don't understand why this dont run. Link to comment Share on other sites More sharing options...
deadman 33 Posted December 19, 2014 Author Share Posted December 19, 2014 bump, solution of marty sama don't work, or i don't know how to do it good. Regards Deadman Link to comment Share on other sites More sharing options...
Krixius 13 Posted December 19, 2014 Share Posted December 19, 2014 i tryed code of marty sama in my core, and as deadman says, the core never starts (ofc, i put a public ip good). So, i hope marty sama or other C++ scripter read this, and put a good code for protect the core. Link to comment Share on other sites More sharing options...
Honorable Member xP3NG3Rx 19679 Posted December 19, 2014 Honorable Member Share Posted December 19, 2014 But martys code looks like working. Read about strcmp here: http://www.cplusplus.com/reference/cstring/strcmp/ Maybe try with this code: if (strcmp(g_szPublicIP, "5.5.5.5") != 0) { fprintf(stderr, "Illegal IPn"); exit(1); } However if your protected core will be publicly these things easily bypassable. Link to comment Share on other sites More sharing options...
Krixius 13 Posted December 19, 2014 Share Posted December 19, 2014 yes, i read about strcmp yesterday, for that i don't undestand why the code don't work, but i try with the != 0. Thnks penger. Regards Akroma Link to comment Share on other sites More sharing options...
Think 117 Posted December 19, 2014 Share Posted December 19, 2014 Don't waste your time with silly protections like that one. In general, don't waste your time protecting your server binary from use (it's just going to bite you back at some point). Protect the server its stored at! If it's interesting enough that people will want to steal it, anyone can easily bypass stuff like this. And no, the != 0 is not going to change a lot besides removing a warning if you have them on a high level. Nevertheless, the problem is that you are placing the code in the wrong place. It has to be at any point after GetIPInfo(). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now