Friday, November 13, 2015

Dig Commands

Look up A record as seen by nameserver
dig @

Show the MX record for a yahoo domain
dig MX

Show the TTL for a given domain
dig TTL

Show the TXT record for an yahoo domain
dig TXT

Show only the answer
dig +nocomments +noquestion +noauthority +noadditional +nostats

All Records
dig @ ANY +noall +answer

Reverse Lookup
dig -x

Nice output that looks like the domain record
dig any +multiline +noall +answer

Find the authoritative nameserver for a domain:
dig -t ns +short

Find the SOA of the domain:
dig soa +noall +answer

dig soa

; <<>> DiG 9.10.3-P4-Ubuntu <<>> soa
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- 64217="" id:="" noerror="" opcode:="" p="" query="" status:="">;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 11
;; WARNING: recursion requested but not available

;; ANSWER SECTION: 86400 IN SOA joe\ 2014092859 14400 14400 1209600 86400

The presence "aa" indicates if the nameserver is the authoritative server.
The "2014092859" is the serial

Download a zone file (zone transfer):
dig axfr

Common Options:
  +short  = show only the results
  +[no]comments = show/hide the comments
  +[no]question = show/hide the question section
  +[no]authority = show/hide the authority section
  +[no]stats = show/hide the stats section
  +[no]answer = show/hide the answer section
  +[no]all = show/hide everything

Nice articles:


Create DNS Slave

Monday, November 02, 2015

Python Email Send

Simple email test from python

import smtplib
from email.mime.text import MIMEText
f = ""
t = ""
s = smtplib.SMTP('localhost')
msg = MIMEText("this is a test")
msg["Subject"] = "This is a test - ignore"
msg["To"] = t
msg["From"] = f
s.sendmail(f, [t], msg.as_string())