Skip to content

Instantly share code, notes, and snippets.

@juan157
Forked from xdavidhu/converter.sh
Created June 10, 2020 12:18
Show Gist options
  • Save juan157/43833a3dc332e6d9cb717d37ebe1a0e1 to your computer and use it in GitHub Desktop.
Save juan157/43833a3dc332e6d9cb717d37ebe1a0e1 to your computer and use it in GitHub Desktop.

Revisions

  1. @xdavidhu xdavidhu revised this gist May 31, 2018. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions converter.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    #!/bin/bash
    # Converter.sh by @xdavidhu
    # This is a script inspired by the Bug Hunter's Methodology 3 by @Jhaddix
    # With this script, you can convert domain lists to resolved IP lists without duplicates.
  2. @xdavidhu xdavidhu revised this gist May 27, 2018. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion converter.sh
    Original file line number Diff line number Diff line change
    @@ -1,10 +1,11 @@
    # Converter.sh by @xdavidhu
    # This is a script inspired by the Bug Hunter's Methodology 3 by @Jhaddix
    # With this script, you can convert domain lists to resolved IP lists without duplicates.
    # Usage: ./converter.sh [domain-list-file] [output-file]

    echo -e "[+] Converter.sh by @xdavidhu\n"
    if [ -z "$1" ] || [ -z "$2" ]; then
    echo "[!] Usage: converter.sh [domain-list-file] [output-file]"
    echo "[!] Usage: ./converter.sh [domain-list-file] [output-file]"
    exit 1
    fi
    echo "[+] Resolving domains to IPs..."
  3. @xdavidhu xdavidhu created this gist May 27, 2018.
    23 changes: 23 additions & 0 deletions converter.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # Converter.sh by @xdavidhu
    # This is a script inspired by the Bug Hunter's Methodology 3 by @Jhaddix
    # With this script, you can convert domain lists to resolved IP lists without duplicates.

    echo -e "[+] Converter.sh by @xdavidhu\n"
    if [ -z "$1" ] || [ -z "$2" ]; then
    echo "[!] Usage: converter.sh [domain-list-file] [output-file]"
    exit 1
    fi
    echo "[+] Resolving domains to IPs..."
    while read d || [[ -n $d ]]; do
    ip=$(dig +short $d|grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"|head -1)
    if [ -n "$ip" ]; then
    echo "[+] '$d' => $ip"
    echo $ip >> $2
    else
    echo "[!] '$d' => [RESOLVE ERROR]"
    fi
    done < $1
    echo -e "\n[+] Removing duplicates..."
    sort $2 | uniq > $2.new
    mv $2.new $2
    echo -e "\n[+] Done, IPs saved to '$2'."