Skip to content

Instantly share code, notes, and snippets.

@cmaggiulli
Last active August 17, 2022 19:05
Show Gist options
  • Select an option

  • Save cmaggiulli/c4167390be1d5992b22d93f5dc2bf6e7 to your computer and use it in GitHub Desktop.

Select an option

Save cmaggiulli/c4167390be1d5992b22d93f5dc2bf6e7 to your computer and use it in GitHub Desktop.
A shell script to automated the creation of the XML and zip file as per the Chase Paymentech specification
#!/bin/bash
# Payment tech sftp password reset file.
# Script creates password and zip file based of PaymentTech specification
# Chase should be ashamed of themselves for this
# Author : Chris Maggiulli
FILENAME="password_`date +'%y%m%d'`000.xml"
ZIPNAME="password_`date +'%y%m%d'`000.zip"
# Not using /dev/random so this can be ran by less privileged users
PASSWORD=`openssl rand -base64 30 | tr -dc 'A-Z0-9' | fold -w 8 | head -n 1`
touch $FILENAME
echo "<passwordRequest>" >> $FILENAME
echo "<userID>REDACTED</userID>" >> $FILENAME
echo "<password>`echo $PASSWORD`</password>" >> $FILENAME
echo "</passwordRequest>" >> $FILENAME
zip $ZIPNAME $FILENAME
cat $FILENAME
rm -f $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment