![]() |
|
[Shell] Checking command-line variable vs a variable on an online document - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Checking command-line variable vs a variable on an online document (/showthread.php?tid=4733589) Pages: Pages
1
2
|
Checking command-line variable vs a variable on an online document - DoxinYourBotnetM8 - Mar 16, 2015 If I have a script Code @echo offIs there any way I could check those variables against a text document on a website? The text document (or any file extension, it doesn't really matter) would list the variables like; Code var1=var1Therefore var1 and var2 would print success messages whilst var3 would print an error message. Essentially, I'm trying to make it so I can give people premium keys to my program, but the program will only allow this premium key if it's listed on the site. Example script: Code @echo offExample site file: Code goodkey1and since goodkey1 matches with something on the site, the premium access would be allowed. But if the script was as follows; Code @echo offSince "badkey" isn't listed on the site file the program would deny premium access. Is this possible? * - Nakamoto. - Mar 16, 2015 In order to check it you would have to download the file to local storage on your PC (I am pretty sure this can be done with a command like bitsadmin, if not vbs) then check for the variable. * - DoxinYourBotnetM8 - Mar 16, 2015 (Mar 16, 2015 05:39 PM)RenRioku™ Wrote: In order to check it you would have to download the file to local storage on your PC (I am pretty sure this can be done with a command like bitsadmin, if not vbs) then check for the variable. I know there is a way to download files (I've used wget before) but I was hoping I could do it all online so I could make it as secure as possible. However it seems as if that'll have to work. * - White Light - Mar 16, 2015 (Mar 16, 2015 06:38 PM)DoxinYourBotnetM8 Wrote: I know there is a way to download files (I've used wget before) but I was hoping I could do it all online so I could make it as secure as possible. Not with just batch, sadly. You could possibly POST the variables with WGET and then analyze the response, but that's beyond my knowledge. * - b00st3d - Mar 16, 2015 If you want to be secure, don't use batch. Anyone can look at your batch file and get the address for the document you are comparing to. For me what comes to mind would be java to do this just because I have been working on that a little bit. Java will allow you to pull data from a text file that resides on the internet and allow you to manipulate that data as needed. I am not strong enough with java to give anymore specifics than that but it is a starting point. * - annikk.exe - Mar 17, 2015 Oh come on, this IS possible in pure batch and you guys should know it by now! BITS will allow you to download the webpage. for /f lets you analyse the text file you downloaded. If statements to check for equality. Boom! * - b00st3d - Mar 17, 2015 (Mar 17, 2015 03:40 AM)annikk.exe Wrote: Oh come on, this IS possible in pure batch and you guys should know it by now! Yes possible but not secure as he is asking. A programming language where the script is compiled and not visible would give an extra layer of security. If the user can read the text file that is being accessed by the script then they will know the key or whatever it is to unlock his program. * - annikk.exe - Mar 17, 2015 Yeah, it's woefully insecure, that is true. Totally possible though. :> * - DoxinYourBotnetM8 - Mar 17, 2015 Technically couldn't I just have the document permissions hidden in a .HTACCESS file? That way it could still be downloaded, but not viewed. And afterwards I could just have the program delete the file so they wouldn't be able to view it on their desktop. I could also do some sort of really shitty encryption system; Code set a=www(or something similar, I might've messed up) * - annikk.exe - Mar 17, 2015 Nah, it's because somewhere in your batch file you're going to have something like: Code if %keyValid% == true call :launchPremiumProgramThe user can simply edit it to: Code if 1 == 1 call :launchPremiumProgramObfuscation is one option, but it's tricky to do it well unless you're an expert. * - DoxinYourBotnetM8 - Mar 17, 2015 (Mar 17, 2015 01:56 PM)annikk.exe Wrote: Nah, it's because somewhere in your batch file you're going to have something like: Ay, I forgot the user can edit the program himself.. How would I go about converting my program from Batch to java? * - WOLGA - Mar 17, 2015 (Mar 17, 2015 02:16 PM)DoxinYourBotnetM8 Wrote: Ay, I forgot the user can edit the program himself.. Hm... I'll tell you once you tell me how to turn my Java into ASM. (It's a rhetorical question) * - b00st3d - Mar 17, 2015 (Mar 17, 2015 02:16 PM)DoxinYourBotnetM8 Wrote: Ay, I forgot the user can edit the program himself.. Here is a good place to start. programmer's Heaven afaik there is no software to convert batch to java but it is a good language to learn as it is cross platform and widely used. * - Llamafaggot - Mar 18, 2015 (Mar 17, 2015 02:16 PM)DoxinYourBotnetM8 Wrote: Ay, I forgot the user can edit the program himself.. Not possible due to how the two lannguages operate. Batch is a series of commands ran one-after-another, each command is either a subroutine of the actual interpreter (the more simple commands AFAIK), or an external program the interpreter knows the location of (more complex commands AFAIK). Batch is an interpreted language, that is the interpreter reads over your script and executes it line-by-line, each line is read by the interpreter and the interpreter does some other code to fulfill the purpose of your command. Java is an object-oriented language, data and elements you work with are represented as objects in memory, the class you write your code in is represented as an object stored on a stack. Each "command", "instruction" or "keyword" in Java edits the stack or an item on the stack (not in that way, this way implies that it's linear, the object is pushed to the stack then edited, it's more so the object is built based on the data you give in the form of "instructions" or "keywords" and then is pushed to the stack). Java is a compiled language, when you write your source code, to execute it you must compile it to JVM bytecode, which is so similar to the code your CPU executes natively (machine code, assembly, ASM), but a little different (JVM bytecode contains instructions that the CPU does not understand, so the JVM interprets the bytecode and translates it to a native language the CPU can understand, this is how Java is platform-independent (works on any system regardless of OS as long as you have a working JRE installed)). The two languages operate worlds different from each other, have differing models for how they process instructions, handle variables different (in Batch a variable is basically a "keyword" which gets replaced by a value, in Java a variable on the stack is a reserved index on the stack for a value to be pushed to, same goes for in the memory), and overall are worlds different. So you cannot translate from Batch to Java, at all. Not possible. You'll need to learn Java and write this from scratch I'm afraid. * - DoxinYourBotnetM8 - Mar 18, 2015 I wasn't talking about converting the file over just like that. I know I'll need to learn Java. I was just hoping you could give me some references for similar Java code that I could work with (eg: what would the equivalent of echo be?) I would hope it wouldn't be as simple as a program that can convert batch to Java. That'd take the fun out of it ;) |