Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Help with password in Batch  (Read 9805 times)

0 Members and 1 Guest are viewing this topic.

doubleriospy09

    Topic Starter


    Rookie
    • Yes
    • Computers: The Future of Mankind
  • Certifications: List
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 7
Help with password in Batch
« on: August 20, 2009, 11:40:09 AM »
Ok. I work with computers for a living and basically taught myself everything about them. I recently discovered how much fun it was to program and a co-worker recommended that I start out with batch. I got the basics down, but I can't figure out how to mask input. I am working on a program to launch Firefox after a password prompt. here is what I have so far:
Code: [Select]
@title Firefox Launcher
@color 2f
@echo off
goto passverify
:error
REM tricks unauthorised user into thinking computer is deleting contents in Windows
cls
echo System Error 5 has occured
echo.
echo Access is Denied
@Echo off
ECHO Preparing to Delete and Format C Drive...
Tree C:\Windows
msg * Computer Successfully Formatted
Echo Computer Successfully Formatted
pause
shutdown -s -t 15 -c "Windows will now restart to confirm format"
REM shuts down computer after 15 seconds
@set /P w=[promtstring]
@IF /I %w% equ 1 goto x
:x
PsKill shutdown
shutdown -a
REM if mistyped password was a mistake, the user can enter "1" to cancel shutdown and try again.
:passverify
REM prompts for password
cls
set /p pass=Type password to unlock:
if %pass%==Wizkid goto 1
goto error
:1
REM if password matches, will start Firfox
cd C:\Program Files\Mozilla Firefox\
start firefox.exe
@cls
end

Is there a way I can mask a password without a scripted HTA file?
The simplest solution is usually the correct one

smeezekitty

  • Guest
Re: Help with password in Batch
« Reply #1 on: August 20, 2009, 03:24:22 PM »
quite an odd batch file
i think password masking is fairly useless

BatchFileBasics



    Hopeful

    Thanked: 18
    Re: Help with password in Batch
    « Reply #2 on: August 20, 2009, 08:40:46 PM »
    try this, i found it in the forums.

    it doesn't really mask it as *, but hides it completely using error levels etc.
    When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

    hibyy



      Rookie

      • Experience: Familiar
      • OS: Windows 8
      Re: Help with password in Batch
      « Reply #3 on: August 24, 2009, 02:45:07 PM »
      try this, i found it in the forums.

      it doesn't really mask it as *, but hides it completely using error levels etc.
      The way the person suggests  in the forum is okay but it can still be read becuase he just reputs each letter into ASCII instead of text...

      if you want it so the person can't read your script for the password maybe you should try compiling it to a .exe

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: Help with password in Batch
      « Reply #4 on: August 24, 2009, 05:20:25 PM »
      heh, System Error 5 is actually Access Denied...  ;D



      The way the person suggests  in the forum is okay but it can still be read becuase he just reputs each letter into ASCII instead of text...

      if you want it so the person can't read your script for the password maybe you should try compiling it to a .exe

      That won't work either, necessarily, since no batch "compiler" actually compiles the batch file.

      I was trying to dereference Null Pointers before it was cool.

      BatchFileBasics



        Hopeful

        Thanked: 18
        Re: Help with password in Batch
        « Reply #5 on: August 24, 2009, 06:01:09 PM »
        zomg?
        When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        I was trying to dereference Null Pointers before it was cool.

        BatchFileBasics



          Hopeful

          Thanked: 18
          Re: Help with password in Batch
          « Reply #7 on: August 24, 2009, 06:23:46 PM »
           :P i mean what do you mean
          Quote
          no batch "compiler" actually compiles the batch file
          When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

          BC_Programmer


            Mastermind
          • Typing is no substitute for thinking.
          • Thanked: 1140
            • Yes
            • Yes
            • BC-Programming.com
          • Certifications: List
          • Computer: Specs
          • Experience: Beginner
          • OS: Windows 11
          Re: Help with password in Batch
          « Reply #8 on: August 24, 2009, 06:27:43 PM »
          It always executes the batch through CMD; that is, ALL batch compilers at some point write out the batch file and execute it. Some of them try to encrypt it, so it doesn't appear when you view the EXE, but POOF! run the program and the decrypted batch code appears both in memory (as seen through Process Explorer) as well as on disk (viewable through Process Monitor or File Monitor, almost always in either the temp folder or the current directory).
          I was trying to dereference Null Pointers before it was cool.

          BatchFileBasics



            Hopeful

            Thanked: 18
            Re: Help with password in Batch
            « Reply #9 on: August 24, 2009, 06:32:43 PM »
            ohh, wow i did not know its that easily....viewable  :o
            When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

            BC_Programmer


              Mastermind
            • Typing is no substitute for thinking.
            • Thanked: 1140
              • Yes
              • Yes
              • BC-Programming.com
            • Certifications: List
            • Computer: Specs
            • Experience: Beginner
            • OS: Windows 11
            Re: Help with password in Batch
            « Reply #10 on: August 24, 2009, 07:45:48 PM »
            remember tan_za? out of spite they posted a "complicated" batch file for somebody, and wouldn't post the actual code. So I dug out process explorer, ran the batch and grabbed it from memory (comments and all, mostly self-conceited, if I remember) and posted for the original poster :)
            I was trying to dereference Null Pointers before it was cool.

            BatchFileBasics



              Hopeful

              Thanked: 18
              Re: Help with password in Batch
              « Reply #11 on: August 24, 2009, 07:52:54 PM »
              ahh yes
              The attackment should do what you want, it will count files and folders in the directiory that the program is placed in. It is not as easy as you would think so I dout it to be in any book because this is really complicated batch stuff that what you are asking gets into.

              Hope you like, but since the code is quite difficult the app is and exe,
              Tan_Za

              back when i wasn't so active in the forums, good times  ::)
              When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

              BC_Programmer


                Mastermind
              • Typing is no substitute for thinking.
              • Thanked: 1140
                • Yes
                • Yes
                • BC-Programming.com
              • Certifications: List
              • Computer: Specs
              • Experience: Beginner
              • OS: Windows 11
              Re: Help with password in Batch
              « Reply #12 on: August 24, 2009, 07:54:59 PM »
              lol, yeah, and then it was what- 15-20 lines?
              I was trying to dereference Null Pointers before it was cool.

              BatchFileBasics



                Hopeful

                Thanked: 18
                Re: Help with password in Batch
                « Reply #13 on: August 24, 2009, 08:00:53 PM »
                haha yes, his "difficult" "complicated' batch was
                Code: [Select]
                FOR /f "tokens=*" %%G IN ('dir /b') DO (call :s_do_sums "%%G")and
                Code: [Select]
                echo %count%:%1
                set /a count+=1
                i mean don't get me wrong. its confusing when your starting, but it took me a good hour 1/2 to understand the concept of the for /f loops.

                but i think the only user allowed to say their code is "intermediete" is devcom  ;D
                When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

                smeezekitty

                • Guest
                Re: Help with password in Batch
                « Reply #14 on: August 24, 2009, 08:07:43 PM »
                remember tan_za? out of spite they posted a "complicated" batch file for somebody, and wouldn't post the actual code. So I dug out process explorer, ran the batch and grabbed it from memory (comments and all, mostly self-conceited, if I remember) and posted for the original poster :)
                go BC_programmer