Coloring Batch Files! – within one file!

I wanted colored batch files and I managed to achieve this with someones solution which I modified and made my own, it is now quite different to his but I cannot find who it was to give them credit, anyway, here is the code!

 

@echo off
SETLOCAL EnableDelayedExpansion
for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do (
set "DEL=%%a"
)
title Startup Assist - Handler
call :ColorText 08 "["
call :ColorText 08 "Service"
call :ColorText 08 "]"
call :ColorText 08 " Startup Assist - HANDLER - RUNNING "
echo.
call :ColorText 08 "["
call :ColorText 0E "WARNING"
call :ColorText 08 "]"
call :ColorText 08 " Startup Assist will stop if a server startup file is not found this is because of windows MS DOS functionality, Sorry "
echo.
call :ColorText 08 "["
call :ColorText 08 "Minecraft Service"
call :ColorText 08 "]"
call :ColorText 0A " Minecraft Server "
call :ColorText 0C " Nexion"
call :ColorText 0A " Started"
echo.
start "launch.bat" "C:UsersNexionDocumentsMinecraft ServersNexionlaunch.bat"
echo(
call :ColorText 79 "This window will now await user input!"
echo.
)
PAUSE
exit
goto :eof

:ColorText
echo off
“%~2”
findstr /v /a:%1 /R “^$” “%~2” nul
del “%~2” > nul 2>&1
goto :eof

which looks something like this

Capture

As you can tell, this is for my minecraft server 🙂 (Nexion.co.uk)

and that’s all there is to it! you can use any standard colors that you could already within batch files. (Note: When running without user, i.e. started by another process, the colors requite administrative privileges!)

edit: http://stackoverflow.com/questions/7290434/how-can-i-make-a-multi-functional-batch-program

Using Hashlib to Securely store user passwords and credentials.

What is hashing?

Hashing a password means that users cannot have their passwords compromised when a database engineer is reading cleartext in user databases (to a degree, the passwords could be decoded, but hashing them makes them illegible to someone who is not doing anything extensive). And also prevents hackers from reading passwords in plain text and can be compromised by collision attacks.

Additionally when hashing a password a salt may be added to the password, this prevents a database from being attacked by dictionary attacks.

Why Hash Passwords?

Storing User credentials in Plain Text is generally as bad practice as it allows anyone who reads the file (or computer) to see the password, username or any other credential without any sort of protection, In some cases it is against the law, such as PCI SSC Data Security Standards which handles debit and other card types. The solution to this is to Obfuscation in the form of hashing. Hashing a password makes a standard password seem completely random.

How hashing works

When a user signs up for a website or any other form that requires secure credentials, such as a password, username, email address or address, that user will fill in a form that will ask these credentials, then the web server will both hash and store the hash, the server will ‘throw away’ the original password and keep the hash. In a more secure environment the user may also be given a salt, this may be unique to the user or unique to the application (The user will not know the salt, the salt is owned by the server and will be kept secret.). When hashing both the password and salt will be combined and hashed.

How to hash a string in Python

This tutorial uses Hashlib as its hashing encoder which uses the ever bug free OpenSSL…

First we need to import hashlib and encode the input, then finally we need to check for a match.