Sending data securely in C++? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Can someone give me some guidance on my problem - I am writing a game (CryEngine) and I need to know how to send data - including usernames and passwords to a server where they can be stored in a database and shown on a webpage displaying the players "stats". I'd like to start with the usernames and passwords as they are the most paramount that I get right, the other stuff really doesnt have to be encrypted. Although, it might make it a bit harder for hackers to alter their stats.
So how would I approach doing this? I know my way around C++ and I have been using it for a while, I have already built a system that stores and captures the player's kills and XP etc. but this bit sounds more tricky. It sounds like I'm going to make heavy use of BOOST and possibly OpenSSL, but having never used these libraries before or having to make a secure system, I'm slightly confused. Any help or general directions are greatly appreciated!

Open SSL sounds solid, have a look here: http://www.ibm.com/developerworks/linux/library/l-openssl/index.html .
You can use almost every crypting library for this (better not writing your own stuff) but since it is client/server anyway, using a protocol/system that was designed to do exactly this, your best bet is openSSL.
The rest is a secured server with some sort of application running on it (Java EE) and handling the entries in some sort of database.
Then choose some web-language of your preference to retrieve database entries.
PS: dont do it live (eg. every headshot is an entry) but transmit the final results of a round, or once every X minutes.

I suggest using HTTPS.
Link against libcurl and with a few cookbook examples from the net you can have your client portion ready in a couple of minutes or hours. Fiddling with OpenSSL by hand could take days or weeks if you are new to it.
For the server part you can use your game's existing web server. Your game is going to have a web site, isn't it? The users will be able to access their stats via their web browsers too.
If you want to protect the score update mechanism, use regular cryptography API like crypt and a key hidden in the code to obfuscate/deobfuscate the player's score update password. It's obfuscation, not encryption, since the key ultimately resides on the client machine and can be recovered with a debugger.

Related

How can I programmatically get the hot topic of the day/hour/moment? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I would like to grab the current hot topic when my page loads (it could be anything from a civil war in Syria to a sports team or a wardrobe malfunction). I would like it to be a simple web service call such as:
string hotTopic = getHotTopic();
..but that probably "ain't gonna happen."
So what can I realistically expect? In brainstorming this, I thought of grabbing the headlines on the New York Times, the Huffington Post and a couple of other sites, and then parsing the h1 tags in the html to look for non-common words that appear multiple times. Am I on the right track? Is there a known solution to this challenge?
One can always pull down the RSS feeds from a website and parse those out - however not every website is going to provide a "View-Count" for the articles you're pulling down (making it hard to determine whether or not it is a hot topic).
I personally would go to Twitter for trending topics - often times the trending words or hashtags coincide with what's really trending in the news. Events like the Superbowl or a weather catastrophe are often showing there.
To achieve your one method solution, you'll likely need to write a wrapper. If you're using the Twitter API there are some pre-made libraries you could use that help achieve this. The wrapper would be something like:
(Completely made up code)
string GetHotTopic()
{
var svc = new TwitterSvcWrapper();
var topics = svc.GetTrending("united states");
return topic[0].text;
}
I know this doesn't necessarily allow you to parse several pages and find some topics, but perhaps it gives you a method to discover what may be trending. To go against my own idea, Twitter isn't always the best place either. Silly items can be trending that you may not want to use, like "#whatToSayAfter" ...
I also wanted to add that some websites state it to be against their Terms of Use to "scrape" data. For example, (not that you would use it), but Xbox.com prohibits you from scraping data in their ToS. (1.12)
Just some ideas - good luck!
Cheers!

C++ "everlasting" variable [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I need a variable which will contain the best player's score in C++ . So I need something which will not be erased after the program ends and every time when someone gets a higher score that variable must be replaced with a new one . I know that I can save that number in .txt file , but I would like to know if there is an alternative way ?
You could using something like OpenKeyval.
Setting the highscore would be a POST request:
$ curl http://api.openkeyval.org/highscore -d "data=1000"
Getting the highscore is a GET request:
$ curl http://api.openkeyval.org/highscore
1000
One alternative is to store it in a SQLite database. That way you've got the flexibility of a database without needing to run or connect to a server.
You have three main options that I can think of:
1.) Store it in a file
2.) Store it in the registry (http://forum.codecall.net/topic/63205-registry-operations-using-win32-part-1/)
3.) Store it on a server online that you can read or write to
The most generic and "portable" way is to store it in a text file. Of course, that is also open to abuse, someone can open the file in notepad and change the score from 1234 to 999999, or similar.
Storing in a binary file will work, but is sensitive to machine architecture and size of the variable.
Windows has a "registry", which can be used to store strings or binary data, similar to files. But obviously won't work if you decide to move your game to Linux, for example.
If you want to keep track of all scores for all games played, a database may be a better solution than a simple file. There are databases for "local use", such as SQLite or MySql that you can run on your own machine (MySql will also run over network and can be centralized to a set of machines on the same network, and it used for a vast number of web-based applications).
And you could set up a (or use some existing) website, and use program driven web-access to store and restore the values. Or you could store a file on an FTP server, which is pretty much the same as web-access, but a little more "messing about" to configure and set up (and potentially more difficult to get through certain firewalls). Of course, if you want to have a "world-wide" top score, personal stats for each player, etc, then a web-based solution is probably the right way to go - but would also need a bit of security to prevent someone from just faking the score.
All choices have their benefits and drawbacks. Which is YOUR best choice really depends on what your ultimate goal is with your game. If it's simply a case of "Let's make a little game of tetris at home for myself and my friends to play", then it's probably not a big deal to keep the score in a text file. If you are looking for the next generation of World of Warcraft or some such, then web-based is almost certainly the ONLY solution.

Communicate With Online Message Board [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
How might one create an application that communicates to an online website's message board, say www.espn.com's message boards that can retrieve posts, post stuff, and flag posts. How might somebody go about creating an application that does something like that? sockets?
I would like to create this in c++
This is actually more complicated than it sounds. Most message boards don't open up their API (usually to prevent spam), and if they do, you'll probably have to work with them to get the details.
The general idea is:
Open socket to their server
Send the appropriate data according to their API
Profit
If you want to hack it, you'll have to do some scraping/wireshark packet sniffing to figure out their API. There will probably be some cookies you'll have to read to get communication tokens and whatnot. It's possible, but it's a lot of work.
Some other websites (like Twitter and Google) open up their API and actually provide developer tools to interact with their data. I don't think a site like ESPN would be that open to hobbyist developers, so you'd probably have to sign some kind of agreement.
If you're really interested, read up on HTTP (here's a really simple beginning tutorial). Most APIs are built on the HTTP protocol, so you'll want to become very familiar with it. I'd recommend using something besides C++ though, since socket work can be a bit tedious. Try something like Python.

Things i need to know to build a real time feed system in Django [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to build a simple app where i have different users and they make updates and all the users get the updates in real time much like facebook.
Edit:
I just want to know how to push updates to profiles of users without them reloading the page. Do i make repeated AJAX calls or is there something out there that can solve this problem for me.
Edit 2:
Here's a presentation which helped me http://www.slideshare.net/oellegaard/implementing-real-time-web-applications-with-django
for real-time like interaction, one idea is to use sockets.
What I would do is write my front facing site in python/django, and have a node.js layer behind that w/ socket.io (websockets) that handles keeping all of the clients in sync.
[DB]
/ \
[Django] [node.js]
app logic -> \ / <- async updates
[Browser]
but really this is a fairly uninformed answer based heavily on assumptions b/c you haven't told us anything concrete about what your site needs to do.
You need to know how to Program, you need to know Python, and the Django Framework, you will need to know HTML, JavaScript, and CSS, you will need to know some Database of your choice, you will need to know enough to make educated decisions about MVC frameworks on the Client Side, you will need to know about Queues, Stacks, Asynchronous Callbacks, HTTP methods, Encryption and other Security Practices, the list goes on.
Basically, you need to know more then someone who would ask the question you asked.

Save Data permanently [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am working on a project with qt, I need to save data(file path and password) permanently so I can get it or modify it any time even when I exit my application and rerun it.
I thought to solve it with an encrypted xml file but I want to do it without trace.
You either use a file or some other platform specific database mechanism, like Windows' registry. But then it would leave a trace; you can't hope to store something locally and don't leave a trace without rootkiting the operating system (and even that would leave a trace in the hardware, after all, you are writing your data to the drive).
One thing you can hope to do without leaving a trace, is to store the data remotely in some server via the network, since network activity usually is not logged (but can be observed), but I can see 2 problems with this approach:
1) it may be pose some privacy concern to your user (if I were an user of your application, I would not like too see my data sent over the wire to an unknown server);
2) how could you identify the information so that you can retrieve it? You could use some hash with the user name and computer hard drive id and network interfaces MAC adresses, but if some of these change, the data would be lost. You could also generate an unique id for each installation of your application, but it would require you to store that ID locally, and that would be a trace.
Local cryptography to prevent reading/tampering with the data is inherently insecure, because you will need to have some repeatable mean to retrieve the key. How would you do it? If you simply hardcode it in your application, it is easily retrievable by some binary file reader. It can't be on a file named 'key.txt', for obvious reasons. You can compute it at runtime with some complicated algorithm, but you will always need to have it loaded into memory at some point, from where it can be retrieved by someone willingly enough.
It is certainly not possible to save something on the computer without a trace. Everything is visible to root user.
But if you do not want to let others to change it, you can encrypt it, hide it and set it read-only and root edit permission only. But not to let any one find it is impossible. (are you trying to make a virus?) Even if you put in the BIOS, there is way to find it.