Jump to content

how would I go about doing something like this?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1
Amy N.

Amy N.

    Newbie

  • Members
  • Pip
  • 1 posts
From a C program running from a local system, when it first executes, I would like check its ID against a text file located on a remote FTP site or a website. At that FTP site, there will be a text file that looks something like this:


ID_NUMBER ALLOW

12345 yes
11111 no
22222 yes


So let's say the user executes this executable program from location 1. His PC's ID is designated as 12345. The C program checks my FTP site, and ID 12345 is allowed to execute. The executable program has permission, and it just continues at that location 1.

At location 2, that PC's ID is designated as, let's say, 11111. As the executable C program runs, it checks that text file on my FTP site, and sees that ID 11111 does not have permission (or that ID is not on the list), the C program simply gives an error message to the user, and then, stops.

How would I go about implementing something like this? Thanks.

#2
theonejb

theonejb

    Learning Programmer

  • Members
  • PipPipPip
  • 52 posts
First, you need some sort of algorithm in C to calculate the ID of the users PC. Calculate the ID everytime the program runs.
Next, use some FTP access library, such as CURL or use wget if that is available to download the list of ids from the ftp site. Finally, read in the file and compare if the users ID is in the file and if it is, does it have permission to execute.

I have to warn you though, this kind of piracy protection mechanism is VERY easy to break. A faulty DNS server can redirect the ftp request to any site the cracker wants. An even easier method can use direct memory access to modify the calculated ID to match the ones in the list of IDs at the ftp.

#3
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Are you having issues with how to establish an FTP connection (depends on the system your program is running on) or with how to receive and process the file?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog