@@ -40,11 +40,11 @@ def initialize
40
40
OptBool . new ( 'DNSSEC' , [ false , "Add DNSsec to each question (UDP payload size, EDNS0, ...)" , false ] ) ,
41
41
OptBool . new ( 'TRAILINGNUL' , [ false , "NUL byte terminate DNS names" , true ] ) ,
42
42
OptBool . new ( 'RAWPADDING' , [ false , "Generate totally random data from STARTSIZE to ENDSIZE" , false ] ) ,
43
- OptString . new ( 'OPCODE' , [ false , "Comma separated list of opcodes to fuzz." , '' ] ) ,
43
+ OptString . new ( 'OPCODE' , [ false , "Comma separated list of opcodes to fuzz. Leave empty to fuzz all fields. " , '' ] ) ,
44
44
# OPCODE accepted values: QUERY,IQUERY,STATUS,UNASSIGNED,NOTIFY,UPDATE
45
- OptString . new ( 'CLASS' , [ false , "Comma separated list of classes to fuzz." , '' ] ) ,
45
+ OptString . new ( 'CLASS' , [ false , "Comma separated list of classes to fuzz. Leave empty to fuzz all fields. " , '' ] ) ,
46
46
# CLASS accepted values: IN,CH,HS,NONE,ANY
47
- OptString . new ( 'RR' , [ false , "Comma separated list of requests to fuzz." , '' ] )
47
+ OptString . new ( 'RR' , [ false , "Comma separated list of requests to fuzz. Leave empty to fuzz all fields. " , '' ] )
48
48
# RR accepted values: A,CNAME,MX,PTR,TXT,AAAA,HINFO,SOA,NS,WKS,RRSIG,DNSKEY,DS,NSEC,NSEC3,NSEC3PARAM
49
49
# RR accepted values: AFSDB,ISDN,RP,RT,X25,PX,SRV,NAPTR,MD,MF,MB,MG,MR,NULL,MINFO,NSAP,NSAP-PTR,SIG
50
50
# RR accepted values: KEY,GPOS,LOC,NXT,EID,NIMLOC,ATMA,KX,CERT,A6,DNAME,SINK,OPT,APL,SSHFP,IPSECKEY
@@ -329,6 +329,20 @@ def dns_send(data,method)
329
329
end
330
330
end
331
331
332
+ def fix_variables
333
+ @fuzz_opcode = datastore [ 'OPCODE' ] . blank? ? "QUERY,IQUERY,STATUS,UNASSIGNED,NOTIFY,UPDATE" : datastore [ 'OPCODE' ]
334
+ @fuzz_class = datastore [ 'CLASS' ] . blank? ? "IN,CH,HS,NONE,ANY" : datastore [ 'CLASS' ]
335
+ fuzz_rr_queries = "A,NS,MD,MF,CNAME,SOA,MB,MG,MR,NULL,WKS,PTR," <<
336
+ "HINFO,MINFO,MX,TXT,RP,AFSDB,X25,ISDN,RT," <<
337
+ "NSAP,NSAP-PTR,SIG,KEY,PX,GPOS,AAAA,LOC,NXT," <<
338
+ "EID,NIMLOC,SRV,ATMA,NAPTR,KX,CERT,A6,DNAME," <<
339
+ "SINK,OPT,APL,DS,SSHFP,IPSECKEY,RRSIG,NSEC," <<
340
+ "DNSKEY,DHCID,NSEC3,NSEC3PARAM,HIP,NINFO,RKEY," <<
341
+ "TALINK,SPF,UINFO,UID,GID,UNSPEC,TKEY,TSIG," <<
342
+ "IXFR,AXFR,MAILA,MAILB,*,TA,DLV,RESERVED"
343
+ @fuzz_rr = datastore [ 'RR' ] . blank ? fuzz_rr_queries : datastore [ 'RR' ]
344
+ end
345
+
332
346
def run_host ( ip )
333
347
msg = "#{ ip } :#{ rhost } - DNS -"
334
348
begin
@@ -347,6 +361,8 @@ def run_host(ip)
347
361
errorhdr = datastore [ 'ERRORHDR' ]
348
362
trailingnul = datastore [ 'TRAILINGNUL' ]
349
363
364
+ fix_variables
365
+
350
366
if !dns_alive ( @underlayerProtocol ) then return false end
351
367
352
368
print_status ( "#{ msg } Fuzzing DNS server, this may take a while." )
@@ -360,7 +376,7 @@ def run_host(ip)
360
376
if @domain == nil
361
377
print_status ( "DNS Fuzzer: DOMAIN could be set for health check but not mandatory." )
362
378
end
363
- nsopcode = datastore [ 'OPCODE' ] . split ( "," )
379
+ nsopcode = @fuzz_opcode . split ( "," )
364
380
opcode = setup_opcode ( nsopcode )
365
381
opcode . unpack ( "n*" ) . each do |dnsOpcode |
366
382
1 . upto ( iter ) do
@@ -393,11 +409,11 @@ def run_host(ip)
393
409
nsclass << req [ :class ]
394
410
nsentry << req [ :name ]
395
411
end
396
- nsopcode = datastore [ 'OPCODE' ] . split ( "," )
412
+ nsopcode = @fuzz_opcode . split ( "," )
397
413
else
398
- nsreq = datastore [ 'RR' ] . split ( "," )
399
- nsopcode = datastore [ 'OPCODE' ] . split ( "," )
400
- nsclass = datastore [ 'CLASS' ] . split ( "," )
414
+ nsreq = @fuzz_rr . split ( "," )
415
+ nsopcode = @fuzz_opcode . split ( "," )
416
+ nsclass = @fuzz_class . split ( "," )
401
417
begin
402
418
classns = setup_nsclass ( nsclass )
403
419
raise ArgumentError , "Invalid CLASS: #{ nsclass . inspect } " unless classns
0 commit comments