How to give privacy to a program?
I created this program, which is later connected to another code to form a software..
Actually, now I want to make my software private. I mean, it must work on a particular system but, when pirated and tried to run on some other system, it must not work.
while surfing on internet I found that the IP address of a system is the unique code for every pc. Is there any way to keep my software private such that it runs on a particular ip address??
here's the half-code:
Actually, now I want to make my software private. I mean, it must work on a particular system but, when pirated and tried to run on some other system, it must not work.
while surfing on internet I found that the IP address of a system is the unique code for every pc. Is there any way to keep my software private such that it runs on a particular ip address??
here's the half-code:
#include#include #include #include #include static int i=0; struct web { char name[30],pass[30]; }w[100]; int n; int login(void); int reg(void); int main() { system("cls"); printf("\n\n\n\n\n\n\t\t\tWELCOME TO C WORLD!!"); printf("\n\t\t\t^^^^^^^^^^^^^^^^^^^^"); printf("\n\n\n\n\t\t\tPress Enter to proceed..."); if(getche()==13) system("cls"); XY: printf("\n\n\n\t\t\t1. LOGIN\t\t2. REGISTER"); printf("\n\n\n\t\t\t\tENTER YOUR CHOICE: "); scanf("%d",&n); switch(n) { case 1: system("cls"); login(); break; case 2: system("cls"); reg(); break; default: printf("\n\n\t\t\t\tNO MATCH FOUND"); printf("\n\n\t\t\tPress Enter to re-Enter the choice"); if(getche()==13) system("cls"); goto XY; } return 0; } int reg() { FILE *fp; char c,checker[30]; int z=0,j=0; fp=fopen("Web_reg.txt","ab+"); printf("\n\n\t\t\t\tWELCOME TO REGISTER ZONE"); printf("\n\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^^^"); for(i=0;i<100;i++) { printf("\n\n\t\t\t\t ENTER USERNAME: "); scanf("%s",checker); while(!feof(fp)) { for(j=0;j<100;j++) { fread(&w[j],sizeof(w[j]),1,fp); if(strcmp(checker,w[j].name)==0) { printf("\n\n\t\t\tUSERNAME ALREDY EXISTS"); fclose(fp); reg(); break; } } strcpy(w[i].name,checker); fclose(fp); break; } fp=fopen("Web_reg.txt","ab+"); printf("\n\n\t\t\t\t DESIRED PASSWORD: "); while((c=getch())!=13) { w[i].pass[z++]=c; printf("%c",'*'); } w[i].pass[z]='\0'; fwrite(&w[i],sizeof(w[i]),1,fp); fclose(fp); printf("\n\n\tPress enter if you agree with Username and Password"); if(getche()==13) { system("cls"); printf("\n\n\t\t\t\tTHANK YOU FOR REGISTERING"); printf("\n\n\t\t\tYOU ARE SUCCESSFULLY REGISTERED"); printf("\n\n\n\t\t Press Enter to Login your account"); if(getche()==13) { system("cls"); login(); break; } } break; } getch(); return 0; } int login() { FILE *fp; char c,name[30],pass[30]; int z=0; int checku,checkp; fp=fopen("Web_reg.txt","rb"); printf("\n\n\t\t\t\tWELCOME TO LOG IN ZONE"); printf("\n\t\t\t\t^^^^^^^^^^^^^^^^^^^^^^"); printf("\n\n\t\t\t\t ENTER USERNAME: "); scanf("%s",name); printf("\n\n\t\t\t\t ENTER PASSWORD: "); while((c=getch())!=13) { pass[z++]=c; printf("%c",'*'); } pass[z]='\0'; while(!feof(fp)) { for(i=0;i<100;i++) { fread(&w[i],sizeof(w[i]),1,fp); checku=strcmp(name,w[i].name); checkp=strcmp(pass,w[i].pass); if(checku==0&&checkp==0) break; } if(checku==0&&checkp==0) { system("cls"); printf("\n\n\n\t\t\tYOU HAVE LOGGED IN SUCCESSFULLY!!"); printf("\n\n\n\t\t\t\tWELCOME!!"); break; } else { printf("\n\n\n\t\t\tYou are not a Registered User\n \t\t\tPress enter to register yourself"); if(getch()==13) { system("cls"); reg(); } } break; } getch(); return 0; }
Replies
-
Uday BidkarDon't use IP in your code to restrict it to a machine, as it "may" change the next time when you come online (depends upon the DHCP server). Use MAC address instead (Mac Address). You can find plenty of examples to get the MAC address of the machine programatically (e.g. #-Link-Snipped-#). If you are using windows, running ipconfig/all from command line will reveal the MAC of your machine against "Physical Address". On unix/linux ifconfig should give you this information.
-
Vishal Sharma
Yeah, using MAC address is good! I could get the MAC address for my pc using the code, but how to use it to avoid the misuse of the software?Uday BidkarDon't use IP in your code to restrict it to a machine, as it "may" change the next time when you come online (depends upon the DHCP server). Use MAC address instead (Mac Address). You can find plenty of examples to get the MAC address of the machine programatically (e.g. #-Link-Snipped-#). If you are using windows, running ipconfig/all from command line will reveal the MAC of your machine against "Physical Address". On unix/linux ifconfig should give you this information.
how to store this MAC address?? How to compare it with the MAC address of some other pc? -
Uday BidkarI don't understand, if you have mac of your machine and a way to get it programatically, why can't you just store your machine's mac as a string in your program and compare to one you get programatically in your code? If it's the same, proceed, if different, abort, or am I missing something here?
-
Harshad ItaliyaIn our company we had used MAC ID to protect one of our Application its the best way to protect your code or application.
-
Vishal Sharma
If i store the MAC address of my system as a string, then the software will be running only in my system, in that way I'll not be able to distribute it to anyone. ๐ Am I right???Uday BidkarI don't understand, if you have mac of your machine and a way to get it programatically, why can't you just store your machine's mac as a string in your program and compare to one you get programatically in your code? If it's the same, proceed, if different, abort, or am I missing something here? -
Vishal Sharma
I think your company used MAC code, to protect the app from employees. I mean, the application may be used only in the company no one can use it outside the company!godfatherIn our company we had used MAC ID to protect one of our Application its the best way to protect your code or application. -
Harshad Italiya
If you want to distribute it then you can add such routine which asks you first to enter Password or something like that.Vishal0203If i store the MAC address of my system as a string, then the software will be running only in my system, in that way I'll not be able to distribute it to anyone. ๐ Am I right??? -
Harshad Italiya
No in our case we have to do installation at client PC so we made small routine which was first checking for MAC and after that we make it as a security in Final Application.Vishal0203I think your company used MAC code, to protect the app from employees. I mean, the application may be used only in the company no one can use it outside the company! -
Vishal Sharma
I tried that, but if the other person gives the installer to his friend or anyone, even that person will be able to login using username and password provided to the 1st user.godfatherIf you want to distribute it then you can add such routine which asks you first to enter Password or something like that.
I think password would be helpful, if the software is network based! -
Harshad Italiya
Then there is one more option first ask them to send you MAC ID of their PC then implement in your software. So perticular that software will work only on that PC if they want to change PC charge them Extra.Vishal0203I tried that, but if the other person gives the installer to his friend or anyone, even that person will be able to login using username and password provided to the 1st user.
I think password would be helpful, if the software is network based! -
Vishal Sharma
Nice idea.. ๐ it'll be good.. Hope they know how to get the MAC address.. Anyway, I'm gonna try for that now.godfatherThen there is one more option first ask them to send you MAC ID of their PC then implement in your software. So perticular that software will work only on that PC if they want to change PC charge them Extra.
Hahaha.. or else, I can even say that, "You bought it using your money, why are you giving it to someone else, who has not payed for it" ๐ may be, this will click the selfish nature of a human being.. ๐ -
Vishal Sharma#-Link-Snipped-# do you have any idea? how to extract MAC address using C in windows??? I surfed the entire internet, but i could find it only for LINUX
-
Harshad Italiya
Not sure but there should be such app which can get MAC address.Vishal0203#-Link-Snipped-# do you have any idea? how to extract MAC address using C in windows??? I surfed the entire internet, but i could find it only for LINUX -
Vishal Sharma
using command prompt we can see the address but, it is of no use until we can extract itgodfatherNot sure but there should be such app which can get MAC address. -
Uday BidkarWell, if you can't find anything, a crud way will be to use system() to call getmac or ipconfig/all redirecting the output to a file, read the file and parse it to get mac out of it.
-
Vishal Sharma
Hey, I could get the address using the following code, but how to store the things present on output screen to a file???Uday BidkarWell, if you can't find anything, a crud way will be to use system() to call getmac or ipconfig/all redirecting the output to a file, read the file and parse it to get mac out of it.
#include
#include int main() { system("ipconfig/all"); getch(); return 0; } -
[Prototype]The best way is always to generate a GUID.
Other possible methods could be generating a uid based on the processor id or mobo id. Problem with this technique is that, few of the processor/mobo do not have these, but most of the machine will have it.
You can also use online authentication system, but it'll require internet on clients computer before it can be used. -
Uday Bidkar
Try system("ipconfig/all > ipconfig.txt");Vishal0203Hey, I could get the address using the following code, but how to store the things present on output screen to a file???
#include
#include int main() { system("ipconfig/all"); getch(); return 0; } -
Vishal Sharma
I thought of that before, but yea, it'll need internet connection, as well as, i'll have to connect the software to internet, which is not possible using C.[Prototype]The best way is always to generate a GUID.
Other possible methods could be generating a uid based on the processor id or mobo id. Problem with this technique is that, few of the processor/mobo do not have these, but most of the machine will have it.
You can also use online authentication system, but it'll require internet on clients computer before it can be used. -
Vishal Sharma
It does nothing...Uday BidkarTry system("ipconfig/all > ipconfig.txt");
Hey, the things on our output screen are stored in the Buffer memory!
why can't we use fprintf(fp,"%s",stdout); will that work???? -
Vishal Sharma
Sorry, It actually worked ๐Uday BidkarTry system("ipconfig/all > ipconfig.txt");
now there's a file named ipconfig.txt
Now the next task is to extract the mac address from it...
Thanks a lott #-Link-Snipped-#
๐
You've been helping me a lot! -
[Prototype]
Why not? Its totally possible to use internet. Windows provides API for communication.Vishal0203I thought of that before, but yea, it'll need internet connection, as well as, i'll have to connect the software to internet, which is not possible using C. -
Vishal Sharma
Well, then I don't know how to do that! ๐[Prototype]Why not? Its totally possible to use internet. Windows provides API for communication.
You are reading an archived discussion.
Related Posts
Rumors are spreading on the Internet that the popular news aggregation website, DIGG (which was the darling of web and publishers in the last decade) has been acquired by meager...
this is AKSHAY FROM SANGLI... NICE FEELING AFTER JOIN WITH THIS GROUP...
Engineering in EXTC from mumbai university.
Currently working as team leader
Take your phone to bath room or a beach and it can be its last day as most of the phones are water resistant Gizoo has come up with a...
1. MULTI-TASKING
Women - Multiple process
Womens brains designed to concentrate multiple task at a time.
Women can Watch a TV and Talk over phone and cook.
Men - Single...