Skip to content

Instantly share code, notes, and snippets.

@hoangdh
Last active May 25, 2019 02:24
Show Gist options
  • Save hoangdh/32bfbb5d432a7423d97911281ae1f5d8 to your computer and use it in GitHub Desktop.
Save hoangdh/32bfbb5d432a7423d97911281ae1f5d8 to your computer and use it in GitHub Desktop.
Script get MX records.
#!/bin/bash
FILE="$1"
data=`cat $FILE`
filename=$(echo kq-`date +%H:%M:%S-%d.%m-%Y`.txt)
touch $filename
for x in $data
do
mx_record=`dig +short mx $x | head -n1`
ip_mx=`dig +short a $mx_record | head -n1`
echo "$x, $mx_record, $ip_mx" >> $filename
done
@hoangdh
Copy link
Author

hoangdh commented Oct 18, 2018

Sử dụng:

  • Tải script về máy và phân quyền
wget https://gist.github.com/hoangdh/32bfbb5d432a7423d97911281ae1f5d8/raw/15edf94b986c446dca9307232bb72c2cbdba1040/get-mx-record.sh -O get-mx-record.sh
chmod +x get-mx-record.sh
  • Đặt file danh sách domain vào chung thư mục với script có tên là ds.txt. Ví dụ file danh sách ds.txt có nội dung:
tenten.vn
runsystem.net
z.com
  • Chạy script
./get-mx-record.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment