|
Post by Brandon Parker on Sept 3, 2021 22:38:04 GMT -5
Keep us informed of your progress and if we can help further...
{:0)
Brandon Parker
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Sept 4, 2021 0:37:49 GMT -5
I will do so... Lessons learnt so far and memory jogged 1. Use of ShellExecuteA instead of RUN 2. Use of ADVAPI and GetComputerNameA 3. Powerful use of functions!! 4. Memory jogged regarding the use of ">" in command lines Thanks Brandon! I am looking at the obsidium DLL suggested by Chris for encryption as well as John's idea of using a BMP to hide "things". I am also interested in your idea you mentioned of imbedding data in the LB EXE.
|
|
|
Post by Rod on Sept 4, 2021 2:11:00 GMT -5
I would be wary of encryption. Liberty can’t run encrypted it has to be in clear and is then vulnerable. Encrypting keys and Ids is fine but don’t think encrypting the whole program with a wrapper buys you much.
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Sept 4, 2021 6:47:20 GMT -5
I agree Rod. I am only encrypting data (protection keys,etc.). I have given up on the wrapper idea since there has been no response from the developers/suppliers of the "wrapping" software...
|
|
Dennis
Full Member
Old but still active
Posts: 147
|
Post by Dennis on Sept 5, 2021 7:49:20 GMT -5
Here is what I have done so far. It as a "proof of concept" program to see if I could identify certain system attributes. It is by no means elegant but it does prove the concept. The program is executable...
I was originally going to use a commercially available hardware extraction DLL but could not get it to "register" as a bought product. If I can eventually get it to work, I will replace some of the code in the program namely not using wmic and .bat files.
Because of not getting the DLL to work, I switched to a wmic/.bat file approach. Brendon's program makes use of the same technique which confirmed my approach. I also made use of Brendon's ShellExecute function, but a "RUN" command will also work.
Please read the comments in the program to get a better understanding of what it is trying to do.
Going to now figure out encryption (Thanks Chris!) and also figure out how to use everything to create some sort of a copy-protection system.
Thanks for all the comments and assistance - much appreciated!!
'nomainwin
'
' Author: Dennis Comninos with advice and functions obtained from from Brandon Parker
'
' The purpose of this program is to obtain the BIOS Serial number and the drive on which a USB flash drive is
' mounted. The USB flash drive is known. This is required for creating a "home-brew" copy protection system.
'
' Use is made of the Windows command line instructions specifically "wmic". The command line commands are written
' to a .bat file and then run with ShellExecuteA.
'
' This is a "proof of concept" program and is by no means meant to be elegant!
'
' The loops (which could be replaced by WHILE...WENDs) and the time delays are required to give Windows time to
' "sync" with the program. I suspect that the program "issues" instructions faster than the Windows "event stack"
' can handle.
'
' I originally used the clipboard to communicate between the command lines' output and the program but I could
' not get it to operate in a stable and predictible manner. Again I suspect it had something to do with the
' "event stack". Reading Brendon's code jogged my memory that you could redirect the output of command lines to
' a file and not just pipe them to the clipboard.
'
' For those who are interested, Brendon Parker's code uses the wmic's diskdrive alias which provides more information
' about a drive. Brendon's code is also a masterpiece on the use of functions!
DIM info$(10,10)
USBName$ = "MEMO09" ' USB name to look for
LoopAttempts = 5 ' Numer of attempts before declaring time out
TimeDelay = 500 ' Delay between attempts in milliseconds
LoopCount = 0
F$ = "x"
' Get the Serial Number
BatName$ = "silent.bat"
ProgName$ = DefaultDir$+"\"+BatName$
open ProgName$ for output as #tempbat
print #tempbat, "wmic bios get serialnumber /value /format:csv > "+chr$(34) + DefaultDir$ + "\x.txt" + chr$(34)
close #tempbat
result = ShellExecute(0, "Open", chr$(34)+ProgName$+chr$(34),"",chr$(34)+DefaultDir$+chr$(34),_SW_HIDE)
[LoopX]
if fileExists(DefaultDir$, "x.txt") = 0 then ' File x.txt does not exist
LoopCount = LoopCount + 1 ' Could be a timing issue so keep trying
If LoopCount > LoopAttempts then goto [TimeOut] ' If multiple attempts fail, then time out
sleep = Sleep(TimeDelay)
goto [LoopX]
end if
open DefaultDir$+"\"+"x.txt" for input as #xfile
while not(eof(#xfile))
line input #xfile, a$
a$ = trim$(replstr$(a$,chr$(0),"")) ' Output from command line has ch$(0) between characters
If len(trim$(a$)) > 4 then
if left$(a$,6)<> "Node,S" then ' Skip the heading line
gosub [GetParts] ' Get the serial number
SerialNumber$ = part2$
exit while
end if
end if
wend
close #xfile
print "BIOS Serial number is "+SerialNumber$
LoopCount = 0
F$ = "y"
MainCount = 0
' Look for the correct USB and get the USB drive
[LoopUSB]
BatName$ = "silent2.bat"
ProgName$ = DefaultDir$+"\"+BatName$
open ProgName$ for output as #tempbat
print #tempbat, "wmic logicaldisk get deviceid, volumename /format:csv > "+chr$(34) + DefaultDir$ + "\y.txt" + chr$(34)
close #tempbat
result = ShellExecute(0, "Open", chr$(34)+ProgName$+chr$(34),"",chr$(34)+DefaultDir$+chr$(34),_SW_HIDE)
[LoopY]
if fileExists(DefaultDir$, "y.txt") = 0 then ' File y.txt does not exist
LoopCount = LoopCount + 1 ' Could be a timing issue so keep trying
If LoopCount > LoopAttempts then goto [TimeOut] ' If multiple attempts fail, then time out
sleep = Sleep(TimeDelay)
goto [LoopY]
end if
F$ = "drive"
DriveN$ =""
open DefaultDir$+"\"+"y.txt" for input as #xfile
while not(eof(#xfile))
line input #xfile, a$
a$ = trim$(replstr$(a$,chr$(0),"")) ' Output fom command line has ch$(0) between characters
If len(trim$(a$)) > 4 then
if left$(a$,5) <> "Node,D" then ' Skip the heading line
if instr(a$,USBName$,1) <> 0 then ' Look for the USB name
DriveN$ = word$(a$,2,",") ' Extract the drive
exit while
end if
end if
end if
wend
close #xfile
MainCount = MainCount + 1
if MainCount <= 2 then ' Make sure that you have the latest disk drives
sleep = Sleep(TimeDelay)
goto [LoopUSB]
end if
print "Looking for USB named "+USBName$;" ";
If DriveN$ <> "" then
print " and found it on ";DriveN$
else
print "and it is not present"
end if
end
[TimeOut]
print "Search timeout for file ";F$
result = destroyFile(DefaultDir$+"\"+"x.txt")
result = destroyFile(DefaultDir$+"\"+"y.txt")
end
[GetParts]
part1$ = ""
part2$ = ""
xpart$ = a$
ppos = instr(xpart$,",",1)
plen = len(xpart$)
If ppos <> 0 then
part1$ = trim$(left$(xpart$,ppos-1))
part2$ = trim$(right$(xpart$,plen-ppos))
end if
return
function fileExists(path$, filename$)
files path$, filename$, info$()
fileExists = val(info$(0, 0)) 'non zero is true
end function
'=============================================================================================
' Functions from Brandon Parker
'=============================================================================================
function ShellExecute(hWnd, lpOperation$, lpFile$, lpParameters$, lpDirectory$, nShowCmd)
lpOperation$ = lpOperation$ + chr$(0) : lpFile$ = lpFile$ + chr$(0)
lpParameters$ = lpParameters$ + chr$(0) : lpDirectory$ = lpDirectory$ + chr$(0)
CallDLL #shell32, "ShellExecuteA", hWnd As ulong, _
lpOperation$ As ptr, _
lpFile$ As ptr, _
lpParameters$ As ptr, _
lpDirectory$ As ptr, _
nShowCmd As long, _
ShellExecute As ulong
end function
function destroyFile(file$)
On Error GoTo [Error]
Kill file$
destroyFile = True
[Error]
end function
function Sleep(milliseconds)
CallDLL #kernel32, "Sleep", milliseconds As ulong, Sleep As void
end function
|
|
zpq
New Member
Posts: 18
|
Post by zpq on Sept 23, 2021 11:35:50 GMT -5
Hi all, What I have done in the DOS days was to include a dummy file on the install disk and delete it by way of the install program. If the file was deleted the install would not work again. If you wanted to allow 2 installs have 2 dummy files. Another method I used was to modify the boot sector of a floppy so diskcopy would not work. I never tried that on a stick. Another idea is to require the original usb stick be attached to the computer that is running the program. One last idea is to have the program check the serial number of your software on your server when it is installed. Then delete that number from your online list so that it could not be installed again. I may come up with other ideas.
Response is welcome.
|
|
|
|
Post by atomose on Nov 28, 2022 11:03:24 GMT -5
Hi,
For my part, i use a simple keygen with personnal mail. If the key is steal you can block it with a update and easily found the stealer (with his mail adress)
1 - Gener the keys (100 000 is good but take time to gener) 2 - put the second code part in your .bas 3 - send the key by email after the download link (for your game or programm) 4 - when user use the first time the programm, this will check if the key is on the .tkn file if not, send a notice message to user. If they key is ok, then put a variable in your code with a saved file for not ask key every time.
If people send the programm they must send the same key. So you can know who send it and protect your programm with laws.
' goto [test] 'if you want to test the key you need to use it. If you dont you will have new keys everytimes ... ' ************************** Generator key
print "Key generator working. Pls wait ..."
keys = 20000 ' number of keys you want to creat number = int(rnd(1)*89999999999+10000000000) 'cryptage size, you can change it as well ligne$ = "";number ' first key for no space
for x = 1 to keys-1 number = int(rnd(1)*89999999999+10000000000) : ligne$ = ligne$ ; " " ; number next x
open "save.txt" for output as #save 'save keys on txt file for next users print #save ,ligne$ close #save print "Key generator finish !"
' ************************** testeur key
[test] print "Checking key. Pls wait ..."
'##### this part must be in your code for ckeck if the key is good ##################################################### keys = 20000 open "save.txt" for input as #keys : input #keys, sprites$ : close #keys ' load keys from txt file or by [key]...keys$... return
keyONfile$ = "48435763277" ' this line is the user key. You can give him by email, and put it on the program with box
for s = 1 to 20000 select case word$(sprites$,s) case keyONfile$ notice "OK" : wait ' when the good key found, put a unlock variable for program/game save file end select next '##########################################################################################
print "All key checked, no match." : wait
|
|