Thread: password prog

  1. #1
    I'm Back
    Join Date
    Dec 2001
    Posts
    556

    Unhappy password prog

    I have made a password prog in c++ that when inputted with the correct pwd exits otherwise continues indefinately.

    My 2 questions are

    1. is there a way to automatically shut down the computer after say 3 wrong passwords are given. If yes how?

    2. i' have put the prog pathname in autoexec.bat and have disabled the boot from floppy option.

    What are other ways of bypassing the autoexec?


    Any help would be greatly appreciated (and before i forget i use win98.)

  2. #2
    Disagreeably Disagreeable
    Join Date
    Aug 2001
    Posts
    711
    If you are using this as some kind of security thing, remember that 'Ctrl + C' will (usually) break out of a DOS program.

    As for the shutting down the computer, of course there's a way. That way would be to study the BIOS, make sure it supports that kind of thing, then uh write the code. I have no idea how you'd go about doing that, though...

  3. #3
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    look up the ExitWindows() function

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The best way to secure Win9X is to use the msdos.sys file. Unhide the file using the attrib command. Edit the file with an editor and change BOOTGUI=1 to BOOTGUI=0. Then in your autoexec.bat file place a reference to your DOS password program prior to any other entries. At the end of the autoexec file place a reference to c:\windows\win.

    When the system boots, your code will be executed first. If the code is wrong, simply reboot the system and the whole process begins again. If the code is correct simply exit(0) and since you are in the autoexec shell, the autoexec will continue to execute and will run Windows when it is done because of the c:\windows\win.

    To disable other things like the F8 key prior to bootup use the switches command in your config.sys file. I'm sorry but I absolutely forget all the switch options and what they do. Make sure that your code is solid and has a backdoor. I used my password program at college to protect my system. One time the code failed due to a bug I had not detected and I was locked out of my system - I also disabled CTRL-C. So, I had to go and change the boot options in the BIOS so I could boot from A: - which was also password protected.

    For total security password protect your BIOS so they cannot get in there and change the boot from floppy option. Don't forget your password or you will have to clear the BIOS settings via a jumper on your motherboard. It's really embarassing to get locked out of your own system by your own code. Trust me I've been there.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    To reboot the system:

    outp(0x64,0xFE);

    This will only work if you are in pure DOS (Windows catches this) and if the keyboard buffer is not full. In DOS this will work 99% of the time since the keyboard buffer being full is a rare occurrence.

  6. #6
    Linguistic Engineer... doubleanti's Avatar
    Join Date
    Aug 2001
    Location
    CA
    Posts
    2,459
    to ensure the keyboard buffer isn't fully, make one call to kbhit (), and if it returns nonzero [true], then have a getch () [to no saved value] in order to get that one character out, yeilding an unfull keyboard buffer...

    and [for the sake of mentioning], to clear the keyboard buffer... make a loop polling kbhit() and returning getch () [to nowhere] until there is nothing left in the keyboard buffer...
    hasafraggin shizigishin oppashigger...

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    I don't think there's anyway of keeping out hackers perfectly. If someone wants to get in, they'll get in. There's no way of letting someone send you mail on a website, without somehow exposing your address. You can put it in a link, they just read the code. You use cgi, they just read the code. Windows 95 for example. You just press escape, and BINGO, you're in.

  8. #8
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Correction to the above: The best you can do is by changing the way your computer boots completely - make your own processor. Even so, there's still a way to stop the PC and look at the registers before that. HotMail tried doing something like that. One of my friends forgot their password, and as extra security, didn't enter a logical answer to their secret question. I was in after 2 minutes.

  9. #9
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The method I've shown will prevent people from getting into your system. The only way in is through the BIOS password or by clearing the CMOS via a jumper on the motherboard. For those that are paranoid or need a lot of security there are cases that are locked and some that have chassis intrusion alarms.

    If you place your file in autoexec.bat it will execute prior to Windows, prior to switching to protected-mode - still in pure DOS. If you remove the switches (F8, F5, etc) password protect the BIOS, set floppy drive seek at boot to NO then there is no way in. Even if you change out hard drives or put a new floppy drive in or attempt to boot from floppy, there is no way in.

    Another way that has been mentioned is to password protect the boot sequence via the BIOS, which is much easier since it does not require you to write any code.

    From what I've seen of professional back office security programs, Win9X cannot be made totally secure - there is always a wy in. That would require an OS like Windows NT or Win2000. Win9X was made for home users and therefore lacks a lot of security. Plus the more secure, the less friendly the OS and the less that it likes to run games. What fun would that be?


  10. #10
    I'm Back
    Join Date
    Dec 2001
    Posts
    556
    ... please explain (though it worked perfectly)

    outp(0x64,0xFE);

    and how can i get to know more about port numbers and what data to send them and what will they respond?

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Do a search for Ralph Brown's Interrupt Listing. Also when you get there, make sure you get the viewer for it - it's all on the page as you will see. Download the entire thing - about 9 files including the viewer. It is a list of interrupts, ports, memory areas, DMA, PIC, and just about everything else inside your PC. Awesome reference. It will never leave your drive.

    I sure post that a lot......perhaps I should get the address for it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem reading a password from a file.
    By medeshago in forum C Programming
    Replies: 15
    Last Post: 12-21-2008, 07:20 AM
  2. [Q]Hide Password
    By Yuri in forum C++ Programming
    Replies: 14
    Last Post: 03-02-2006, 03:42 AM
  3. Putting a password on the prog
    By Inferno in forum C++ Programming
    Replies: 24
    Last Post: 09-18-2004, 01:07 PM
  4. written command line password generator
    By lepricaun in forum C Programming
    Replies: 15
    Last Post: 08-17-2004, 08:42 PM
  5. password
    By hammers6 in forum C Programming
    Replies: 1
    Last Post: 10-10-2001, 12:14 AM