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 9798 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
Re: Help with password in Batch
« Reply #15 on: August 24, 2009, 08:45:03 PM »
try this, i found it in the forums.

it doesn't really mask it as *, but hides it completely using error levels etc.

Ok. so i tried that, modified my code nd I got something saying that AUTOEXEC.NT is not suitable for running both MS-DOS and Windows applications. Would this have something to do with the ".com" portion of it? as i know those are compiled batch files, and I did work with some on my old tandy
The simplest solution is usually the correct one

BatchFileBasics



    Hopeful

    Thanked: 18
    Re: Help with password in Batch
    « Reply #16 on: August 24, 2009, 08:58:38 PM »
    this could most likely because by autoexec.nt is either corrupt...or missing all together.

    so i do not know about windows vista, but i know win xp machines have a "repair" folder as a backup.

    so navigate to the folder c:\windows\repair\
    copy autoexec.nt
    then navigate to c:\windows\system32\
    paste autoexec.nt inside
    re-run batch script
    When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

    Helpmeh



      Guru

    • Roar.
    • Thanked: 123
      • Yes
      • Yes
    • Computer: Specs
    • Experience: Familiar
    • OS: Windows 8
    Re: Help with password in Batch
    « Reply #17 on: August 24, 2009, 09:13:36 PM »
    go BC_programmer
    Every once and a while, BC does something that the world benefits from. This is one of those moments. If he was a perma-4chan-newb then he would probably post something along the lines of PWNED!!!1!!!shift!!!!one!!! Instead of gracing us with tar's "protected" script.
    Where's MagicSpeed?
    Quote from: 'matt'
    He's playing a game called IRL. Great graphics, *censored* gameplay.

    doubleriospy09

      Topic Starter


      Rookie
      • Yes
      • Computers: The Future of Mankind
    • Certifications: List
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Help with password in Batch
    « Reply #18 on: August 28, 2009, 12:13:31 AM »
    this could most likely because by autoexec.nt is either corrupt...or missing all together.

    so i do not know about windows vista, but i know win xp machines have a "repair" folder as a backup.

    so navigate to the folder c:\windows\repair\
    copy autoexec.nt
    then navigate to c:\windows\system32\
    paste autoexec.nt inside
    re-run batch script
    OK. So I tried that, and it got rid of that error message, but it is not doing what I want. When I run the script, it stops responding. Any ideas? btw: thanks for the help thus far!
    The simplest solution is usually the correct one

    BatchFileBasics



      Hopeful

      Thanked: 18
      Re: Help with password in Batch
      « Reply #19 on: August 28, 2009, 12:35:54 AM »
      when you say not responding, do you mean the command window shows the
      c:\windows\system32\ (not responding)

      or the script just does nothing?
      When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

      doubleriospy09

        Topic Starter


        Rookie
        • Yes
        • Computers: The Future of Mankind
      • Certifications: List
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7
      Re: Help with password in Batch
      « Reply #20 on: August 28, 2009, 11:58:26 AM »
      when you say not responding, do you mean the command window shows the
      c:\windows\system32\ (not responding)

      or the script just does nothing?
      When I say it stops responding, I mean the script hangs (does nothing) and I need to hit ctrl+alt+del. When I do that, it comes up as "Not Responding" and I need to end it.
      The simplest solution is usually the correct one

      BatchFileBasics



        Hopeful

        Thanked: 18
        Re: Help with password in Batch
        « Reply #21 on: August 28, 2009, 12:09:47 PM »
        this is strange, have you tried both of the codes?

        especially this one:
        Code: [Select]
        @echo off
        echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>hide.com

        :retry
        set /p userid=Enter UserId:
        set /p password=Enter password: <nul
        for /f "tokens=*" %%i in ('hide.com') do set password=%%i
        if /i %password%==password goto next
        cls
        echo Try again. You are not logged in!
        goto retry

        :next
        echo.
        echo You are logged in!
        del hide.com
        When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

        doubleriospy09

          Topic Starter


          Rookie
          • Yes
          • Computers: The Future of Mankind
        • Certifications: List
        • Computer: Specs
        • Experience: Experienced
        • OS: Windows 7
        Re: Help with password in Batch
        « Reply #22 on: August 28, 2009, 04:32:31 PM »
        this is strange, have you tried both of the codes?

        especially this one:
        Code: [Select]
        @echo off
        echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>hide.com

        :retry
        set /p userid=Enter UserId:
        set /p password=Enter password: <nul
        for /f "tokens=*" %%i in ('hide.com') do set password=%%i
        if /i %password%==password goto next
        cls
        echo Try again. You are not logged in!
        goto retry

        :next
        echo.
        echo You are logged in!
        del hide.com
        Ok. The 1st code did not work, but I tried this one, and it did work. Thanks! I did modify it to work with my needs though. I have attached my code.
        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
        @echo off
        echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>hide.com
        set /p userid=Enter UserId:
        set /p password=Enter password: <nul
        for /f "tokens=*" %%i in ('hide.com') do set password=%%i
        if /i %password%==Wizkid goto next
        cls
        goto error

        :next
        echo.
        echo You are logged in!
        del hide.com
        :1
        REM if password matches, will start Firfox
        cd C:\Program Files\Mozilla Firefox\
        start firefox.exe
        @cls
        end
        The simplest solution is usually the correct one

        BatchFileBasics



          Hopeful

          Thanked: 18
          Re: Help with password in Batch
          « Reply #23 on: August 28, 2009, 04:36:19 PM »
          im glad I helped  :)

          and welcome to the forums!
          When the power of love overcomes the love of power the world will know peace - Jimi Hendrix.

          doubleriospy09

            Topic Starter


            Rookie
            • Yes
            • Computers: The Future of Mankind
          • Certifications: List
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: Help with password in Batch
          « Reply #24 on: August 30, 2009, 08:30:03 PM »
          haha thanks
          The simplest solution is usually the correct one

          doubleriospy09

            Topic Starter


            Rookie
            • Yes
            • Computers: The Future of Mankind
          • Certifications: List
          • Computer: Specs
          • Experience: Experienced
          • OS: Windows 7
          Re: Help with password in Batch
          « Reply #25 on: September 03, 2009, 10:26:08 PM »
          ok. so i decided to expand on that script, and got kinda excited. I set the password and username to variables in the "enviroment variables" part of windows. (I figure it is a little more secure). Anyway, script works fine, but I have one small problem. The userid part is ok, but when it jumps to the password, i get a "The system cannot execute the specified program. goto was unexpected at this time. press any key..." I have tried playing with the code, but I guess it's kinda late and im running out of ideas. Any ideas? lol
          Code: [Select]

          @title Firefox Launcher by Matt Rania
          @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
          @echo off
          echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>hide.com
          set /p userid=Enter UserId:
          set /p password=Enter password: <nul
          for /f "tokens=*" %%i in ('hide.com') do set password=%%i
          if /i %password%==%realpass% goto z
          :z
          for /f "tokens=*" %%i in ('hide.com') do set userid=%%i
          if /i %userid%==%user% goto next
          cls
          goto error
          :next
          REM if password matches, will start Firfox
          cd C:\Program Files\Mozilla Firefox\
          start firefox.exe
          @cls
          del hide.com
          exit
          The simplest solution is usually the correct one

          Salmon Trout

          • Guest
          Re: Help with password in Batch
          « Reply #26 on: September 05, 2009, 01:03:42 AM »
          Sounds like one of your IF tests is trying to compare a string value with a null (an empty, zero-length string). (e.g. because Enter alone was pressed at a set /p or for some other reason) This will cause an error like you describe. The goto in the error message is the clue. To avoid this, enclose both sides in quotes, periods, curly or square brackets (or some other character pairs which are nonspecial in batch scripts) like this

          Code: [Select]
          if /i "%value1%"=="%value2%" goto label
          if /i {%value1%}=={%value2%} goto label
          if /i .%value1%.==.%value2%. goto label
          if /i [%value1%]==[%value2%] goto label

          That way when the variables are expanded at runtime a variable holding a null string becomes "" or {} or .. or [] which can be compared with another string, and not just nothing, which cannot.

          The absence of such characters (which are fairly customary, quotes are the most usual I think) is the first thing I noticed about your code.


          Helpmeh



            Guru

          • Roar.
          • Thanked: 123
            • Yes
            • Yes
          • Computer: Specs
          • Experience: Familiar
          • OS: Windows 8
          Re: Help with password in Batch
          « Reply #27 on: September 05, 2009, 06:13:19 AM »
          My piece of advice, always use quotes (or brackets, etc.) when comparing user input.
          Where's MagicSpeed?
          Quote from: 'matt'
          He's playing a game called IRL. Great graphics, *censored* gameplay.