Using CPAU to execute scripts as Administrator hiding credentials

Ocasionally we need to execute orders or scripts as Administrator, and “runas” is not a valid option because users can read the script and find a super user password (No way). In this cases we can try with CPAU, with this free tool we can generate an scripted job that can be called from script secure. The job contains de execution command and the dessired credentials. Let’s prepare an example.

First of all we need to download CPAN.zip from it’s webpage http://www.joeware.net/freetools/tools/cpau/ after decompressing we wil get a CPAN.exe ready to use.

In this simple exercice we’ll see how to create an encrypted job and then execute.

Step 1 Generate a job

cpau -u domain\user -p password -ex "script" -enc -file filename.job

Example:

cpau -u ACME\Administrator -p MyPassword -ex "AddRegedit.cmd" -enc -file registerSome.job

This command will generate an encrypted file named registerSome.job, we can try to read this file en we will see some thing like this:

365363142212E40107110125110101101106A76E76102101120E73E71F70E73112111113107106110104103103102100104100F75A74C75115B77A70A67113113110110107105106103104105106123104C75A76C73D73D73A21E71112132107115133104105123103104121103103120101100112F73A76110115116131106114127106107126101102121C77101115101D76113C70D74114116114110107112105C34107101121100103121B77101115A71B76114120117135111114127111102102100100A77104D74A74101E77112E72F67112117107107110105104103106103C77101A76E75D76F74A77B74110C73117113116112107107111104110106101104104B76F25F77114113B67B67134113111130111105124102107125105101B76100102B74E77B77A71

Step 2 call CPAU job

cpau -dec -file registerSome.job -lwp

Hope this can help you

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.