Skip to main content

Spoof DNS queries over UDP

Project description

dns-spoofer

Send spoofed DNS queries over UDP.

Installation

pip install git+https://github.com/kimbo/dns-spoofer.git

That will install two scripts

  • dns-spoof - send DNS queries with a different source port and source IP address than your own.
  • dns-listen - listen for and print UDP packets (i.e. DNS queries) on a port and address

Quick example

This will be a little bit cooler if you have access to two different computers on the same network, but it'll work just the same on just one.

Step #1:

Open up a terminal and run:

$ dns-listen 53535
Listening on port 53535 and address ...

You can replace 53535 with whatever port number you want (I'd recommend one bigger than 1024).

Note that the address is blank (meaning we're listening on all addresses).

If you have two computers, take note of the first computer's IP address (look into ip addr, or ifconfig if you're on a Mac)

Step #2

If you have two computers, you'll need the IP address from your first machine here:

$ dns-spoof example.com 1.1.1.1 --sport 53535 --src-addr <IP-address-here>

Otherwise, if you're doing this on one computer, run:

$ dns-spoof example.com 1.1.1.1 --sport 53535

Your output after running dns-spoof should look something like this:

(query) 192.168.0.25#53535 --> 1.1.1.1#53, "example.com" type "A"

### QUERY TIME: 0.00028133392333984375

Soon after running dns-spoof, look at the terminal you were running dns-listen on. It should have printed out something like this:

Got 45 bytes from ('1.1.1.1', 53)
id 62725
opcode QUERY
rcode NOERROR
flags QR RD RA
;QUESTION
example.com. IN A
;ANSWER
example.com. 3574 IN A 93.184.216.34
;AUTHORITY
;ADDITIONAL

Congratulations! You just sent a spoofed DNS query :smile:

Usage for dns-spoof

$ dns-spoof -h
usage: dns-spoof [-h] [--dport DST_PORT] [--src-addr SRC_ADDR]
                 [--sport SRC_PORT] [-t RDTYPE] [-n NUM_QUERIES]
                 qname dst_addr

positional arguments:
  qname
  dst_addr              The address to send the DNS query to

optional arguments:
  -h, --help            show this help message and exit
  --dport DST_PORT, --destintaion-port DST_PORT
  --src-addr SRC_ADDR, --source-address SRC_ADDR
  --sport SRC_PORT, --source-port SRC_PORT
  -t RDTYPE, --rdtype RDTYPE
  -n NUM_QUERIES, --num-queries NUM_QUERIES

Usage for dns-listen

$ dns-listen -h
usage: dns-listen [-h] [--addr ADDRESS] port

positional arguments:
  port

optional arguments:
  -h, --help            show this help message and exit
  --addr ADDRESS, --address ADDRESS

Disclaimers

  • I've only tested this from behind a NAT
  • Only works with UDP and IPv4
  • I'm not responsible for what you do with this.

License

see LICENSE

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dns-spoofer-1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distributions

dns_spoofer-1.0-py3.7.egg (8.7 kB view details)

Uploaded Source

dns_spoofer-1.0-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

File details

Details for the file dns-spoofer-1.0.tar.gz.

File metadata

  • Download URL: dns-spoofer-1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for dns-spoofer-1.0.tar.gz
Algorithm Hash digest
SHA256 8681441b8544cca92c114558511a98b82762e08fbc4f21070296b7801285663a
MD5 96c942ac919d48ab905e9aef340b46cf
BLAKE2b-256 ef115df8c2a515c4bf491d9d5b718f5b527db4c550c029dbaac51240dfc12e91

See more details on using hashes here.

File details

Details for the file dns_spoofer-1.0-py3.7.egg.

File metadata

  • Download URL: dns_spoofer-1.0-py3.7.egg
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for dns_spoofer-1.0-py3.7.egg
Algorithm Hash digest
SHA256 f643afca3c8fe045052ba0a0564dd56a3aefa65488adc78d8355e3448fb60d7a
MD5 ada6765ee003fbdf3cf4179ef2e7919a
BLAKE2b-256 f5d83effebfed66b39408aaaff6f4ef5923291eca4ab6a2128dbbf913ecd6ddc

See more details on using hashes here.

File details

Details for the file dns_spoofer-1.0-py3-none-any.whl.

File metadata

  • Download URL: dns_spoofer-1.0-py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.0

File hashes

Hashes for dns_spoofer-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 271753be9bb36bb6275a63eef7a8c70e411a316afb0158e73b735d6079f2500b
MD5 3e7a842067bcb0ccd83a3d6953b225fa
BLAKE2b-256 1a2eb0c4e3b292b6ba711df2dc897bcfc6a55d0c1f1334537be9b01068996daa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page