Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


[C#] Verification for a Program

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun Apr 06, 2008 1:45 pm    Post subject: [C#] Verification for a Program Reply with quote

I made a program, and i dont want some of the things to get into the wrong hands....

I was wondering if there is a way to make a verification for my C# program where it checks there IP address and the password they enter... If the password and IP dont match, the progam exits. If it is correct, they get to go to this certain C# program.

Thank you!

_________________
Back to top
View user's profile Send private message MSN Messenger
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sun Apr 06, 2008 2:02 pm    Post subject: Reply with quote

Code:
namespace NKUtilities
{
    using System;
    using System.Net;
   
    public class DNSUtility
    {
        public static int Main (string [] args)
        {
       
          String strHostName = new String ("");
          if (args.Length == 0)
          {
              // Getting Ip address of local machine...

              // First get the host name of local machine.

              strHostName = DNS.GetHostName ();
              Console.WriteLine ("Local Machine's Host Name: " +  strHostName);
          }
          else
          {
              strHostName = args[0];
          }
         
          // Then using host name, get the IP address list..

          IPHostEntry ipEntry = DNS.GetHostByName (strHostName);
          IPAddress [] addr = ipEntry.AddressList;
         
          for (int i = 0; i < addr.Length; i++)
          {
              Console.WriteLine ("IP Address {0}: {1} ", i, addr[i].ToString ());
          }
          return 0;
        }   
     }
}


That will get you the IP address. Then just compare it with whatever they enter in the text box. Or how ever you are obtaining the pass.

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sun Apr 06, 2008 2:04 pm    Post subject: Reply with quote

this would do it in delphi:

function LocalIP:string;
var
WSA : TWSAData;
ILen : integer;
PHst : PChar;
PHEn : PHostEnt;
begin
WSAStartup( $0101, WSA );
ILen := $FF;
PHst := StrAlloc( ILen );
gethostname( PHst, ILen );
PHEn := gethostbyname( PHst );

with PHEn^ do result:=format(
'%d.%d.%d.%d',
[ord(h_addr^[ 0 ]), ord(h_addr^[ 1 ]),
ord(h_addr^[ 2 ]), ord(h_addr^[ 3 ])]
);

{Nuke the string}
StrDispose( PHst );

{Dust and Clean}
WSACleanup;

end;


Last edited by Anden100 on Sun Apr 06, 2008 2:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sun Apr 06, 2008 2:06 pm    Post subject: Reply with quote

Anden100 wrote:
in delphi, LocalIP would show you the users IP (its a read-only property, that returns the users IP adress)


hehe, silly Anden and your delphi...xD

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Sun Apr 06, 2008 2:10 pm    Post subject: Reply with quote

Overload wrote:
Anden100 wrote:
in delphi, LocalIP would show you the users IP (its a read-only property, that returns the users IP adress)


hehe, silly Anden and your delphi...xD


sorry, forgot the actual procedure... forgot that i was reading it from another unit..., and btw, its only the local IP adress...
Back to top
View user's profile Send private message
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun Apr 06, 2008 2:34 pm    Post subject: Reply with quote

Okay, well should i make a database that holds that passwords and the IP address? Because i just want the person to add the password, and then i can get the IP address on my own.


So i kind of have getting the IP address and getting the password done, now i just need a way to check to see if those two correspond with each other on a list. Ideas?

_________________
Back to top
View user's profile Send private message MSN Messenger
Overload
Master Cheater
Reputation: 0

Joined: 08 Feb 2008
Posts: 293

PostPosted: Sun Apr 06, 2008 2:43 pm    Post subject: Reply with quote

bam2550 wrote:
Okay, well should i make a database that holds that passwords and the IP address? Because i just want the person to add the password, and then i can get the IP address on my own.


So i kind of have getting the IP address and getting the password done, now i just need a way to check to see if those two correspond with each other on a list. Ideas?


compare them? O.o

like, you can get the IP address, sent it to a textbox or a label or something, then compare it to the password they entered. Something like this?

Code:
 if (label1.Text == textBox1.Text)
{
     //your code here
}
else
{
     //your code here
}

_________________
Blog

Quote:
Rhys says:
you can be my maid
Rhys says:
ill buy you a french maid outfit
Tyler says:
Sounds good
Rhys says:
ill hold you to that
Back to top
View user's profile Send private message MSN Messenger
Localhost
I post too much
Reputation: 0

Joined: 28 Apr 2007
Posts: 3402

PostPosted: Sun Apr 06, 2008 2:49 pm    Post subject: Reply with quote

Thanks all Smile I think i can take it from here.

Since i am only a beginner, i am not totally sure where or how to put these things in :p ... go figure

_________________
Back to top
View user's profile Send private message MSN Messenger
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Sun Apr 06, 2008 3:39 pm    Post subject: Reply with quote

Anden100 wrote:
this would do it in delphi:

function LocalIP:string;
var
WSA : TWSAData;
ILen : integer;
PHst : PChar;
PHEn : PHostEnt;
begin
WSAStartup( $0101, WSA );
ILen := $FF;
PHst := StrAlloc( ILen );
gethostname( PHst, ILen );
PHEn := gethostbyname( PHst );

with PHEn^ do result:=format(
'%d.%d.%d.%d',
[ord(h_addr^[ 0 ]), ord(h_addr^[ 1 ]),
ord(h_addr^[ 2 ]), ord(h_addr^[ 3 ])]
);

{Nuke the string}
StrDispose( PHst );

{Dust and Clean}
WSACleanup;

end;


Credit the work of others if you are going to post their code:
http://www.geocities.com/macrotech_tr/net/web2.html
http://www.delphipraxis.net/topic2902.html

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Anden100
Grandmaster Cheater
Reputation: 0

Joined: 20 Apr 2007
Posts: 668

PostPosted: Mon Apr 07, 2008 3:55 am    Post subject: Reply with quote

Wiccaan wrote:
Anden100 wrote:
this would do it in delphi:

function LocalIP:string;
var
WSA : TWSAData;
ILen : integer;
PHst : PChar;
PHEn : PHostEnt;
begin
WSAStartup( $0101, WSA );
ILen := $FF;
PHst := StrAlloc( ILen );
gethostname( PHst, ILen );
PHEn := gethostbyname( PHst );

with PHEn^ do result:=format(
'%d.%d.%d.%d',
[ord(h_addr^[ 0 ]), ord(h_addr^[ 1 ]),
ord(h_addr^[ 2 ]), ord(h_addr^[ 3 ])]
);

{Nuke the string}
StrDispose( PHst );

{Dust and Clean}
WSACleanup;

end;


Credit the work of others if you are going to post their code:
http://www.geocities.com/macrotech_tr/net/web2.html
http://www.delphipraxis.net/topic2902.html


Im sorry, but i got no idea where i got the code from... (all my sources are messed up, i aint very organized...)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites