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 


How to encode Computer Id in CE Lua?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Tue Feb 11, 2020 5:18 pm    Post subject: How to encode Computer Id in CE Lua? Reply with quote

I have given some examples below.
But what I want to learn is; "Computer Id" or "USERID"

Code:
print(os.getenv("windir")) -->C:\Windows
print(os.getenv("SYSTEMROOT")) -->C:\Windows
print(os.getenv("APPDATA")) -->C:\Users\username\AppData\Roaming
print(os.getenv("USERPROFILE")) -->C:\Users\username
print(os.getenv("homepath")) -->\Users\username
print(os.getenv("TEMP")) -->C:\Users\username\AppData\Local\Temp
print(os.getenv("PROCESSOR_ARCHITECTURE")) -->AMD64


"USERNAME" looks the same on most computers.
(windows 10, acer, hp, user etc. )
Or I want some advice; Is there an example of a unique, readable computer ID?
This is another example:

Code:
print(os.getenv("COMPUTERNAME"))


Thanks in advance for your suggestions.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Feb 12, 2020 8:02 am    Post subject: This post has 1 review(s) Reply with quote

To identifying a computer machine by a unique identifier, should be by retrieving information about:

- UUID = Universally Unique Identifier
- GUID = Global Unique Identifier
- HWID = Hard Ware Identifier (18 Capital letters)
- CPUID = Central Processing Unit Identifier
- HDDID = Hard Disk Serial Identifier
- IPv4 address
- IP Config for a physical address
- and others.

Almost game providers, apps developers, and programmers using UUID (similar to HWID) to identify users
and employ anti-cheat by using that HWID info. We were not able to retrieve HWID info by using os.getenv() statement.

If you want to know what os.getenv() handle, you can execute this script:

Code:
local osEnv = {}

for line in io.popen("set"):lines() do
  envName = line:match("^[^=]+")
  osEnv[envName] = os.getenv(envName)
  if envName == nil or os.getenv(envName) == nil then return nil else
  print(tostring(envName)..' = '..osEnv[envName])
  end
end


And you can see, nothing unique identifier there. using os.getenv('COMPUTERNAME') is not effective. You can imagine how many computers with name 'JOHN-PC' or others?.

Anyhow, we still able to get a unique 'Computer ID' info by using the command line.
Some examples:

Code:
-- getting system product name (machine serial no.):

     os.execute('wmic csproduct get uuid,name')


-- getting bios name and version:

    os.execute('wmic bios get name,version')


-- getting IPv4 Address:

   os.ececute([[for /f "tokens=2 delims=:" %i  in ('ipconfig ^| findstr "IPv4" ^| findstr [0-9]') do echo %i]])

-- or you can try each command via command prompt.



In another way, we also possible to get UUID using Lua script:

Code:
function all_trim(s)
  return s:match"^%s*(.*)":match"(.-)%s*$"
end

local fh = assert(io.popen'wmic csproduct get uuid')
result = fh:read'*a'
fh:close()
result = string.gsub(result,'UUID',"")
result = all_trim(result)
--result = string.sub(result,5)
print(result)


The last code above will give you UUID unique info as a variable which you can use as filtering users machine.
If you want to use another elegant way, you can use Advapi32.dll.GetCurrentHwProfileA function call using CE Lua executeCodeLocalEx().

Anyhow, thought you able to get user Computer ID, it should be useless if you don't have a user database. It is not usually if ask the user to send you an email contains their user ID, which this user ID contains personal computer ID. You need to retrieve that user ID (such as user HWID, UUID, etc) by back door.
So, my suggestion is to make a user database that contains username, password, email address, etc and your app. will store the user data automatically when they sign in or sign up on your app.

To create a users authentication system is not too difficult. You can use Lua script (CE Lua) and MySQL Server such as LuaSql, SQLite, etc. I am personally using Microsoft
SQL Server to create a database. Microsoft SQL Server already exists as a default from Visual Studio 2015 and later version, if I am not mistaken. Once you make your user authentification system with your own database then just connect it to your CE Trainer, etc.

Good luck

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Wed Feb 12, 2020 1:36 pm    Post subject: Reply with quote

this code reflects the result I am looking for. Thank you.

Code:
function all_trim(s)
  return s:match"^%s*(.*)":match"(.-)%s*$"
end

local fh = assert(io.popen'wmic csproduct get uuid')
result = fh:read'*a'
fh:close()
result = string.gsub(result,'UUID',"")
result = all_trim(result)
--result = string.sub(result,5)
print(result)


It will probably be difficult to read and test "UUID" from Google Docs.
I will skip numbers and characters and focus only on the letters.

Google Docs save: CDEACFEEFABEEB
Code:
 --result = C0D42EA6-C03F-5E5E-8F8A-373BEE14068B
rst = string.gsub(result,'%A','')
print(rst) --rst = CDEACFEEFABEEB


Note: I will not take this "UUID" without permission.
This will be given to me by the user.
So this is; The member will have a password for access to Trainer.

The question to be asked is:
1) This "UUID"; Does it remain the same until the PC is formatted?
2) Can't be changed?

If the answer cannot be changed and remains the same,
I will publish the project.

Thanks again @Corroder. You are very good at blending VB and Lua.
I owe you +2.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1668

PostPosted: Wed Feb 12, 2020 7:57 pm    Post subject: Reply with quote

Aylin :
The question to be asked is:
1) This "UUID"; Does it remain the same until the PC is formatted?
2) Can't be changed?

The answers:
It's depending on what UUIDs you retrieve. There are many UUID types. It's something like:

1. CSUUID = Customer Product ID or Machine Serial Number

This is mean a PC motherboard serial number (same as IMEI number on a mobile phone), store on SMBIOS. We can check this number by finding it when open the computer info on the PC BIOS menu. (generally press F1 or DEL Key when computer starts, F8 or F5 on a notebook). So, this number will remain not to change when an HDD formatted.

The CSUUID can change if reset by the factory, change PC motherboard, change PC ROM.

2. WINDOWS UUID = Windows key Identifier

This is a serial number of windows system (not a windows activation key). Will change if HDD formatted or change the operating system. Linux or IOS and MAC have their own UUID. This serial number stored on the HK_MACHINE registry key.

3. HDD UUID = HDDID

This is a Harddisk ID. The ID generated by the OS when the HDD installed on the PC. It changes when formatted, re-installed or change the OS.

4. Others, ask to Google...

Anyhow, if we need to prove the theories, especially if a hard disk formatted, then we need to be formatted our HDD and next check if CSUUID has changed or not, will you?

Laughing

EDIT:
I personally doesn't care if the user UUID has change by many reasons, because that is their own risks. If they change their UUID then according to use the apps we created, they just need doing register again as a new user and they will use our apps from the beginning. So, we need considering to make a unique license key for our apps and give it to each user (by paid or free) and generating time trial for our apps to give the users chance to try our apps.

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Thu Feb 13, 2020 1:13 am    Post subject: Reply with quote

Corroder wrote:

EDIT:
I personally doesn't care if the user UUID has change by many reasons, because that is their own risks. If they change their UUID then according to use the apps we created, they just need doing register again as a new user and they will use our apps from the beginning. So, we need considering to make a unique license key for our apps and give it to each user (by paid or free) and generating time trial for our apps to give the users chance to try our apps.


1) The method of giving the password for use;
Trainer and password can be distributed. This is risky.
2) use of "USERNAME";
The PC name can be changed and any PC Trainer with the same name can be used.
3) A unique and can not be copied;
I think "CSUUID" will be the final decision. Very Happy

I can now share the Project.
The information you provided will be the "Wiki" of the Project.
Useful information for CE, this is a nice archive subject. Wink

( Also @Corroder; No matter how crazy the idea is, thank you for your support. )

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Dark Byte
Site Admin
Reputation: 468

Joined: 09 May 2003
Posts: 25719
Location: The netherlands

PostPosted: Thu Feb 13, 2020 4:23 am    Post subject: Reply with quote

Alternatively you could also use ce's getInternet() and a permanent cookie on a website that you get from logging in.
The website can then check if the cookie is valid, has permission to use specific apps, and monitor the number of different ip addresses that use it and then delete the cookie requiring the user to log in again

_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
AylinCE
Grandmaster Cheater Supreme
Reputation: 36

Joined: 16 Feb 2017
Posts: 1499

PostPosted: Thu Feb 13, 2020 4:50 am    Post subject: Reply with quote

Dark Byte wrote:
Alternatively you could also use ce's getInternet() and a permanent cookie on a website that you get from logging in.
The website can then check if the cookie is valid, has permission to use specific apps, and monitor the number of different ip addresses that use it and then delete the cookie requiring the user to log in again


Unfortunately, it is not easy for me to code what you say. Smile

But the above development (Project) I published.
Here it is:
..
Take control of your trainer + Register VIP members

This simple coding is enough to get started. Wink

EDIT :
I made a similar Trainer.
But I couldn't do it with CE lua. Sad
Cheat Engine Trainer (VS Form: Opened trainer with online entry)

Link

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting 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