Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#! /bin/sh
# gen_domains.sh output_dir
#
# Script to generate sorted lists of rendezvous domains used by the
# conficker.{a,b,c} worm.
#
# Requires:
#
# Downatool2 - http://net.cs.uni-bonn.de/wg/cs/applications/containing-conficker/
# - Place into same directory as this file
# wine - Tested with wine 1.1.32 from WineHQ
# Copyright (c) 2009 Terry Burton
#
# http://www.terryburton.co.uk
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
# THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
PATH='/usr/bin:/bin'
NUM_DAYS=14
DOMAIN_CMD="wine `dirname $0`/downatool2_01.exe"
DOMAINS_DIR=$1
[ -d "$DOMAINS_DIR" ] || { echo "Usage: `basename $0` output_dir"; exit 1; }
umask 007
seq -f "%.0f day" 0 $((NUM_DAYS-1)) | date -f - +%Y%m%d | while read DATE; do
$DOMAIN_CMD $DATE -a | sed 's/.$//' | grep '^[a-z]' | sort | uniq > $DOMAINS_DIR/$DATE.a.txt
$DOMAIN_CMD $DATE -b | sed 's/.$//' | grep '^[a-z]' | sort | uniq > $DOMAINS_DIR/$DATE.b.txt
$DOMAIN_CMD $DATE -c | sed 's/.$//' | grep '^[a-z]' | sort | uniq > $DOMAINS_DIR/$DATE.c.txt
cat $DOMAINS_DIR/$DATE.a.txt $DOMAINS_DIR/$DATE.b.txt $DOMAINS_DIR/$DATE.c.txt | sort | uniq > $DOMAINS_DIR/$DATE.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment