Skip to content

Instantly share code, notes, and snippets.

@shubs
Last active August 29, 2015 14:07
Show Gist options
  • Save shubs/a19bf52453f6ba2f5537 to your computer and use it in GitHub Desktop.
Save shubs/a19bf52453f6ba2f5537 to your computer and use it in GitHub Desktop.
Takes a csv file in argument and shows the spf records
> ./list_PH.sh PH.csv > output.csv
#!/bin/bash
while read ligne
do
USER=`echo $ligne | awk -F"," '{ print $2 }'`
NOM=`echo $ligne | awk -F"," '{ print $3 }'`
EMAIL=`echo $ligne | awk -F"," '{ print $4 }'`
DOMAIN=`echo $EMAIL | awk -F"@" '{ print $2 }'`
if [[ $DOMAIN != "gmail.com" && $DOMAIN != "hotmail.fr" && $DOMAIN != "yahoo.fr" && $DOMAIN != "free.fr" ]]
then
SPF=`dig -t txt $DOMAIN | grep spf | awk -F"\t" '{ print $6 }'`
echo "$USER,$NOM,$EMAIL,$DOMAIN,$SPF"
fi
done < $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment