Jump to content











Photo
- - - - -

how to use uuid in this code?


  • Please log in to reply
25 replies to this topic

#1 sara - pmedia

sara - pmedia

    Frequent Member

  • Lady
  • 184 posts
  • Location:tel aviv
  •  
    Israel

Posted 31 May 2011 - 03:55 PM

hi all :)

I want to give someone my special multiboot usb disk but I want to protect the disk from cloning (I know Technically it's impossible So I has an idea)

I will use Aeroboot graphic menu buttons with grub4dos commands for booting all my tools so no one can view or edit my g4d code becouse Aeroboot files canot be modify
also i will use "uuid" instad of "hd0,2" so even if someone will clone the disk, He would not boot anything.

It comes to Linux I was able to combine and it works very well (like this example) but with other tools i cant find the code

title full KUbuntu

kernel /boot/vmlinuz-2.6.35-22-generic [b]root=UUID=6e973ab9-9942-4b43-b5c2-5e28771343b6 [/b]ro   quiet splash

initrd /boot/initrd.img-2.6.35-22-generic

boot


Now I need your help, What is the correct syntax to replace <disk number> with <uuid> For example, this code


title Acronis True Image

map (hd0,3)/IMAGES/AcronisMedia.iso (hd32)

map --hook

chainloader (hd32)



or



title Acronis True Image

root (hd0,3)

map /IMAGES/AcronisMedia.iso (hd32)

map --hook

chainloader (hd32)

I tried this code but it dont works

title Acronis True Image

root UUID=6e973ab9-9942-4b43-b5c2-5e28771343b6 

map /IMAGES/AcronisMedia.iso (hd32)

map --hook

chainloader (hd32)


#2 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 31 May 2011 - 04:45 PM

help uuid
uuid: uuid [DEVICE] [UUID]
    If DEVICE is not specified, search for filesystem with UUID in all
    partitions and set the partition containing the filesystem as new
    root (if UUID is specified), or just list uuid's of all filesystems on
    all devices (if UUID is not specified). If DEVICE is specified, return
    true or false according to whether or not the DEVICE matches the
    specified UUID (if UUID is specified), or just the uuid of
    DEVICE (if UUID is not specified).


so maybe

title Acronis True Image
uuid (hd0,3) 6e973ab9-9942-4b43-b5c2-5e28771343b6 && root (hd0,3)
uuid (hd0,3) 6e973ab9-9942-4b43-b5c2-5e28771343b6 && map /IMAGES/AcronisMedia.iso (hd32)
uuid (hd0,3) 6e973ab9-9942-4b43-b5c2-5e28771343b6 && map --hook
uuid (hd0,3) 6e973ab9-9942-4b43-b5c2-5e28771343b6 && chainloader (hd32)

or just the last line would maybe do??

I have not tested this!


[Edit]
Now tested and it works fine (using grub4dos uuid of course)!
[/Edit]

#3 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 31 May 2011 - 04:46 PM

sara, you have it "wrong".

First thing HOW did you generate the UUID?

Re-read here:
http://reboot.pro/13801/
http://reboot.pro/13801/page__st__6

Use grub4dos to calculate the UUID.

Use the right syntax, example:
find --set-root UUID () 7f95820f-5e33-4e6c-8f50-0760bf06d79c

find --set-root uuid () 7f95820f-5e33-4e6c-8f50-0760bf06d79c
(corrected wrong UPPER CASE, see below post)

ALREADY given you in the linked to thread :P
http://reboot.pro/13801/page__st__4

BUT if you CLONE something, it is an EXACT copy (and will have the same UUID :)).
http://reboot.pro/13801/page__st__6

:cheers:
Wonko

#4 sara - pmedia

sara - pmedia

    Frequent Member

  • Lady
  • 184 posts
  • Location:tel aviv
  •  
    Israel

Posted 02 June 2011 - 12:07 PM

First thing HOW did you generate the UUID?
Use grub4dos to calculate the UUID.

Use the right syntax, example:

find --set-root UUID () 7f95820f-5e33-4e6c-8f50-0760bf06d79c

:innocent:
Wonko


i use g4d command-line to generate my uuid list.

Posted Image


i use your syntax example but i get error, what wrong?

title Acronis_True_Image

find --set-root UUID () BE7621D276218BE9

map /IMAGES/AcronisMedia.iso (hd32)

map --hook

chainloader (hd32)

boot

Posted Image


BUT if you CLONE something, it is an EXACT copy and will have the same UUID


I am sad to hear but it's still better than nothing

#5 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 June 2011 - 12:19 PM

My bad, typo, all grub4dos commands are lower case, try with uuid instead of UUID.

This is the actual snippet from grub4dos read me:
******************************************************************************

***              New command &#39;uuid&#39; to identify partitions                 ***

******************************************************************************



Usage:



	uuid [DEVICE] [UUID]



If DEVICE is not specified, search for filesystem with UUID in all partitions

and set the partition containing the filesystem as new root (if UUID is

specified), or just list uuid&#39;s of all filesystems on all devices (if UUID is

not specified). If DEVICE is specified, return true or false according to

whether or not the DEVICE matches the specified UUID (if UUID is specified),

or just list the uuid of DEVICE (if UUID is not specified).



Example 1:



	find --set-root uuid () 7f95820f-5e33-4e6c-8f50-0760bf06d79c



which will find a partition with uuid=7f95820f-5e33-4e6c-8f50-0760bf06d79c

and set the partition as root if found.


Try with:
title Acronis_True_Image

find --set-root uuid () BE7621D276218BE9

map /IMAGES/AcronisMedia.iso (hd32)

map --hook

chainloader (hd32)

Normally you DO NOT need the boot command in a menu.lst entry (whilst it is NEEDED on command line).


A good idea is to ALWAYS use command line when experimenting.

This:
root (hd0,0)

find --set-root uuid () BE7621D276218BE9

root

should quickly show you if the root has changed as expected.


:cheers:
Wonko

#6 sara - pmedia

sara - pmedia

    Frequent Member

  • Lady
  • 184 posts
  • Location:tel aviv
  •  
    Israel

Posted 02 June 2011 - 03:24 PM

Thanks wonko :cheers: you did it again :cheers:

Now it works :w00t:

Do you have another idea how to protect my disc from copying?

#7 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 02 June 2011 - 04:11 PM

Do you have another idea how to protect my disc from copying?

I usually have lots of ideas :w00t: , but simply there is NO way (or no viable ones :rofl: or I won't tell you because you might copy them ideas :cheers: :cheers: ).

It's just like the good ol' floppies, they may have been "copy protected", but very few were "cloning protected".

Of course one could probably use the same stoopid techniques of "weak sectors" or "sector relocation", but they would require firmware acces to the device in the case of a HD or USB stick.

Quite frankly I don't see the point, anyway.

It's a binary,0/1 or ON/OFF thing.

EITHER the contents of the disk are redistributable/legal OR they are NOT.

In first case, there is no need to copy/protect them, unless you are actually selling them, and then you can well use a Commercial protection system (that - should the actual disk contents have *any* value - will be cracked in no time).

In second case you shouldn't distribute illegally *anything*.

More generally, if you trust your someone (I presume a "friend"), you can give him/her a copy, if you don't trust him/her, don't give it to him/her.

The best way to keep a secret is not telling it to anyone...

;)
Wonko

#8 Aye Htay

Aye Htay

    Frequent Member

  • Advanced user
  • 163 posts
  •  
    Myanmar

Posted 02 June 2011 - 04:17 PM

Just a peny of idea. Not practically tested. :cheers:
1. hdd serial number = abcd1234efg
2. if hdd serial = abcd1234efg then boot unless exit
3. restart pc.

:w00t:

ah

#9 sara - pmedia

sara - pmedia

    Frequent Member

  • Lady
  • 184 posts
  • Location:tel aviv
  •  
    Israel

Posted 02 June 2011 - 04:35 PM

Just a peny of idea. Not practically tested. :cheers:
1. hdd serial number = abcd1234efg
2. if hdd serial = abcd1234efg then boot unless exit
3. restart pc.

:w00t:

ah



Is it possible to combine this style of code in g4d?

#10 Aye Htay

Aye Htay

    Frequent Member

  • Advanced user
  • 163 posts
  •  
    Myanmar

Posted 02 June 2011 - 04:47 PM

Nope, at the moment.
We need a hand from Tinybit :cheers:

:w00t:

ah

#11 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 02 June 2011 - 05:05 PM

So, you would lock the "cd" (I'm guessing) or maybe flash drive to the serial number on the hard disk inside the system it going to boot on? Sounds like the same sorts of "ideas" our good friend Wonko was mentioning above...Maybe it is enough to keep noobs out, but if there is any real value, it would be easy to bypass...

Scott

#12 Henshaw

Henshaw

    Member

  • Advanced user
  • 68 posts
  •  
    Italy

Posted 03 June 2011 - 07:35 AM

Thanks wonko :thumbsup:  you did it again :cheers:

Now it works :juggler:

Do you have another idea how to protect my disc from copying?


One elementary disk-clone protection method is to open its image with a hex editor, augment its volume size then update its CRC!


Hope that helps!

#13 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 03 June 2011 - 07:43 AM

One elementary disk-clone protection method is to open its image with a hex editor, augment its volume size then update its CRC!

Care to detail what is the CRC (and the procedure connected to it) and how this will leave UUID unchanged? :thumbsup:

:juggler:
Wonko

#14 Henshaw

Henshaw

    Member

  • Advanced user
  • 68 posts
  •  
    Italy

Posted 04 June 2011 - 08:39 AM

Care to detail what is the CRC (and the procedure connected to it) and how this will leave UUID unchanged? :thumbsup:

:juggler:
Wonko


The CRC is the 4-byte code derived from its checksum. However, I never tried it with UUID in mind. I'll try it then give feed-backs.

#15 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 June 2011 - 10:11 AM

The CRC is the 4-byte code derived from its checksum. However, I never tried it with UUID in mind. I'll try it then give feed-backs.

Well, if you make the CRC, BTW 4 bytes? :thumbsup: should mean a CRC32:
http://www.lammertbi...alculation.html

(or you make a MD5 hash or compute the UUID) of a volume once the volume is CLONED, these will remain the same.
With the not-so-slight difference that whilst the UUID (or volume serial) will remain the same, the CRC32, MD5 or similar hashes of the contents of a volume will change as soon as *any* of it's contents will change.

It is perfectly possible to "link" an app to a "hardware serial" such as the hard disk serial and/or the MAC of the network card, but grub4dos has no provisions for it.

Anyway, I don't understand what you are suggesting with "open its image with a hex editor, augment its volume size". :juggler:

:cheers:
Wonko

#16 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2011 - 12:18 PM

Hi
It is perfectly possible to test for the MAC address or Mainboard Serial number (or any other DMI string) in memory using grub4dos

For instance, the MAC address of my EeePC is 00 23 54 58 32 6b

So I searched the memory by booting to DOS and using the debug Search command S F000:0 FFF0 00 23 54 58 32 6b
It returned F000:0757 - so I noted the 8 bytes at F000:0757

Next I made my menu.lst file

title TEST MAC
checkrange 0x58542300 read 0xf0757 && echo MAC PART 1 FOUND!
checkrange 0x05066b32 read 0xf075b && echo MAC PART 2 FOUND!

note that you need to look at 8 bytes (two are not part of the MAC address) in debug - in my case they were 05 and 06. Also you need to reverse the order!

If you like, you can test for the mainboard serial number (e.g. 58ABC123) in a similar way. You need to search in debug at D000:0 , E000:0 and F000:0 for MAC or serial numbers.

e.g.
S F000:0 FFFF "58ABC123"

S E000:0 FFFF "58ABC123"

S D000:0 FFFF "58ABC123"

then note the 8 or 12 or 16 hex values using debug d F000:xxxx and use them in the grub4dos menu.

#17 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 June 2011 - 12:31 PM

Sure, but are these memory addresses the same for "each and any" motherboard? :dubbio:

This approach needs a "search" or however a "custom install" on target machine.

If I got it right, Sara wanted to link to the actual hard disk or Usb stick media.

I don't think that hard disk serial is in memory at any time, not an USB stick serial. :unsure:

It can be retrieved later allright, example:
http://www.codeproje...k_serialno.aspx
but I think that the device needs to be "interrogated" by *something*...

:cheers:
Wonko

#18 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2011 - 12:44 PM

It depends what the objective is?
1. Lock software to mainboard (i.e. only works on one system and allow user to change HDD if they wish)
2. Lock software to hard disk in system (so if HDD is replaced they lose the software)
3. Lock software to USB drive (flash or HDD?) (so if USB drive breaks they lose the software)

Which do you want?
1 is possible as described.
2 is very difficult as not even BIOS calls read the HDD serial number so code will have to have an OS/driver for IDE and SATA
3. same as 2 but even more difficult as need USB driver + 'SCSI' USB driver.

#19 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 04 June 2011 - 02:01 PM

Let's see what Sara says. :dubbio:

OT, but not much, have a look at Memory Dump:
http://sta.c64.org/pcutils.html

Maybe the same can be done with grub4dos' dd (having an empty 1 Mb image), then review results with something more friendly than debug?

:unsure:
Wonko

#20 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 04 June 2011 - 02:29 PM

I wrote a DOS utility called ScanBIOS years ago which looks for strings in a BIOS area, but it does not search for bytes so can't be used for MAC address searches. It could be used to look for ASCII characters such as DMI strings (e.g. GUID, mainboard serial number, mbd manufacturer, etc.) and returns their starting memory address.

It would be nice if grub4dos (or a utility such as wenv) had a memory scan command ...Posted Image

e.g.
memscan 0xd0000 0xfffff Asus && echo FOUND an Asus PC!
or
memscan 0xd0000 0xfffff 0x23 0x45 0x99 0x33 0x23 0xbb && echo FOUND MAC ADDRESS!


then we could test for any BIOS string without having to know where exactly it is located (which in the case of DMI strings, could depend on the order they are written in, etc.).

#21 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 06 June 2011 - 10:34 PM

I have placed a DOS program SCANBIOH.exe on the Beta downloads page of the RMPrepUSB website. This lets you easily search any BIOS for byte sequences or strings so that you can then plug these into a grub4dos menu to lock the menu so that it only works on one PC.

1. Find MAC address of target system (e.g. under Windows use ipconfig /all or try a PXE boot and it will display the MAC address)
2. Boot to DOS and run SCANBIOH 0xaa 0xbb 0xcc 0xdd 0xee 0xff (where aa-ff are your MAC address bytes) - note the first 8 bytes displayed and their location

e.g.

LOOKING FOR: 00235458326B

F000:0757 ASCII ROM STRING= #TX2k....

00 23 54 32 6B 06 05 06 41 53 55 53 54 65 ...



3. Construct your grub4dos menu.lst to test for these 8 bytes, 4 bytes at a time - example below... (note that MAC address was at f0757 in this example and bytes were 00 23 54 58 32 6b, but these bytes must be reversed when used in a 4 byte dword in grub4dos!)

title Boot xxxx

#if not correct MAC address then reload menu

checkrange 0x58542300 read 0xf0757 || pause --wait=3 INCORRECT MAC ADDRESS! && configfile /menu.lst

checkrange 0x05066b32 read 0xf075b || pause --wait=3 INCORRECT MAC ADDRESS! && configfile /menu.lst

# carry on and boot OS here...



#22 ilko

ilko

    Silver Member

  • Advanced user
  • 500 posts
  •  
    Bulgaria

Posted 07 June 2011 - 02:22 AM

Thanks Steve, quite handy :cheers:

#23 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 20 June 2011 - 09:29 PM

Improvement - use calc to check 2 bytes and read to check 4 bytes, so only check 6 bytes (MAC address) and not extra 2 bytes which are not part of MAC address:

title Run MSSS only on my EeePC!
#prevent checkrange from printing contents on the screen so it looks neater!
debug off
#check for the MAC address in BIOS RAM area
checkrange 0x58542300 read 0xf0757 && checkrange 0x6b32 calc *0xf075b & 0xffff && echo OK - MAC ADDRESS 00:23:54:58:32:6b FOUND
#if not correct MAC address then reload menu
checkrange 0x58542300 read 0xf0757 || pause --wait=3 INCORRECT MAC ADDRESS! && configfile /menu.lst
checkrange 0x6b32 calc *0xf075b & 0xffff || pause --wait=3 INCORRECT MAC ADDRESS! && configfile /menu.lst
#now do any commands as normal
find --set-root /MSSS_Media32.iso
map /MSSS_Media32.iso (0xff) || map /MSSS_Media32.iso (0xff)
map --hook
chainloader (0xff)


#24 mjct

mjct
  • Members
  • 2 posts
  •  
    Philippines

Posted 10 August 2011 - 03:39 AM

Hi steve, I tried your nice program but I got an error like this:

Looking for: XXXXXXXXXXXX
ERROR - STRING NOT FOUND - ERRORLEVEL = 1


Note that I tried to another laptop but got the same error.
I also double/tripple checked the MAC address just to be sure that I didn't missed anything as per you instructions.
Also, all strings are typed in small letters(lower case), ie 0x

Please help.
Thank you.

Edited by mjct, 10 August 2011 - 03:41 AM.


#25 steve6375

steve6375

    Platinum Member

  • Developer
  • 7566 posts
  • Location:UK
  • Interests:computers, programming (masm,vb6,C,vbs), photography,TV,films
  •  
    United Kingdom

Posted 10 August 2011 - 10:14 AM

Hi steve, I tried your nice program but I got an error like this:

Looking for: XXXXXXXXXXXX
ERROR - STRING NOT FOUND - ERRORLEVEL = 1


Note that I tried to another laptop but got the same error.
I also double/tripple checked the MAC address just to be sure that I didn't missed anything as per you instructions.
Also, all strings are typed in small letters(lower case), ie 0x

Please help.
Thank you.



1. Does it find any string - e.g. 'ACPI' - if not are you running from MS-DOS or FreeDOS (does not work under XP/Vista/7/SVR2K8!)?
2. Can you find any part of the MAC address? - e.g. two bytes AA BB and also BB AA (reverse the order)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users