viper25

Secure Passwords on DOS

Apr 9th, 2018
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.66 KB | None | 0 0
  1. # Creates an empty file
  2. echo. 2> secret.txt
  3.  
  4. # Restricts access to the file to only the owner
  5. icacls secret.txt /remove "BUILTIN\Administrators" "NT AUTHORITY/SYSTEM" /inheritance:r  
  6.  
  7. # Redirects the keyboard to text file, suppressing prompt to overwrite
  8. copy con secret.txt /y
  9.  
  10. # Everything the user types from this point up to the CTRL-Z (^Z) is saved in the file
  11. THIS IS MY TOP SECRET PASSWORD^Z
  12.  
  13.  # The Secrets Manager command takes the --plain-text parameter from the contents of the file    
  14. aws secretsmanager put-secret --secret-id TestSecret --plain-text file://secret.txt
  15.  
  16. # The file is destroyed so it can no longer be accessed.
  17. sdelete secret.txt
Add Comment
Please, Sign In to add comment