antisnatchor
8f4f51874d
Fixed issues with the DNS server RESTful API. Now it works.
2014-03-06 17:11:27 +00:00
bcoles
3494542b54
Make upstream DNS server configurable
2014-03-04 00:56:41 +10:30
antisnatchor
ec9cf4d460
Manually merged DNS extension code (pull request 967 from @soh-cah-toa)
2014-03-02 12:56:33 +00:00
soh_cah_toa
b2aed14234
Added regex support to #add_rule (tests included).
...
Due to strange behavior in Sourcify, the /.../ literal syntax cannot
be used as a parameter; only %r{} or Regexp::new. There is a note
for this in the documentation for #add_rule.
2013-07-22 22:37:39 -04:00
soh_cah_toa
6a62cf9eaa
Added public attributes 'address' and 'port' to Dns::Server.
...
This removes the need to search config.yaml for the address:port.
Also included unit tests.
2013-07-19 22:33:40 -04:00
soh_cah_toa
95d0ddbe87
Added new method #remove_ruleset that clears the entire DNS ruleset.
...
Included unit tests as well.
2013-07-17 18:16:46 -04:00
soh_cah_toa
ebbadba6dd
Improved #run_server to check if EM reactor is already running.
...
Also moved Thread creation to inside #run_server instead of
forcing caller to do so.
2013-07-14 23:27:21 -04:00
soh_cah_toa
89a5d6fdbb
Modified #remove_rule to return a boolean value.
...
This is will soon allow the DELETE handler to indicate success
or failure.
2013-06-05 18:20:48 -04:00
soh_cah_toa
2f5133e11a
Changed GET handlers to return recently fixed rule data.
...
Also wrapped all handlers in a begin/end block that catches
internal StandardError exceptions.
2013-06-05 15:56:33 -04:00
soh_cah_toa
44622345d0
s/DNS/Dns/g since that is the BeEF style convention.
2013-06-03 17:55:58 -04:00
soh_cah_toa
0f8221918b
Improved coding style (a la ruby-style-guide and rubocop).
...
Because I'm too tired to start testing and need a little victory. ;)
2013-06-03 00:11:41 -04:00
soh_cah_toa
27b1b530ef
Implemented POST handler for /api/dns/rule which adds a new rule.
...
A host of other changes got roped into this as well. #match now
silently handles blocks passed as a String in order to handle
the 'block' JSON parameter. This is because sourcify doesn't
work with eval'd data.
Rule id's are no longer incremental integers. It's now a 7-character
"token" generated from #secure_token and is managed by the RubyDNS
module.
2013-05-26 22:44:11 -04:00
soh_cah_toa
c6f38324d1
Refactored #get_ruleset to be part of RubyDNS.
...
All database logic should be inside RubyDNS since BeEF's DNS class
is mostly just a wrapper around it.
2013-05-18 21:00:22 -04:00
soh_cah_toa
054767c898
Added RESTful API route for /api/dns/rule/:id.
...
This will return a single rule given its unique id.
2013-05-17 23:02:40 -04:00
soh_cah_toa
702595c04c
Improved a lot of documentation for BeEF::Extension::DNS::DNS.
2013-05-17 19:12:05 -04:00
soh_cah_toa
c70037f9f4
Began adding support for RESTful API beginning with /api/dns/rules.
2013-05-17 18:25:22 -04:00
soh_cah_toa
35f25bbeb9
Removed load_rules() and parse_type() since they're unused.
2013-05-15 22:18:16 -04:00
soh_cah_toa
992e95f0d7
Added database support when adding/removing rules.
...
Needed to add 'sourcify' as a dependency in order to store code blocks
in the database.
2013-05-15 22:12:37 -04:00
soh_cah_toa
1f7e748afc
Removed parse_response() since it's no longer needed.
2013-05-14 19:23:08 -04:00
soh_cah_toa
ddcb040c40
Marked add_rule() and remove_rule() as critical sections.
...
Mutual exclusion is imperative here since other modules/extenions may
be simultaneously adding/removing rules, thus putting the value of
@next_id at risk of becoming inconsistent.
2013-05-14 19:12:23 -04:00
soh_cah_toa
e563a8946b
Began implementing new method of adding rules without periodic timer.
...
Also added improved documentation for add_rule() and remove_rule().
2013-05-14 18:47:51 -04:00
soh_cah_toa
86e01b1327
Documented run_server() and add_rule().
2013-05-10 23:19:58 -04:00
soh_cah_toa
d622bf3e5e
New DNS entries can now be added dynamically without a server restart.
...
Database is checked every five seconds and adds new rules if there
were any changes.
2013-05-10 23:01:10 -04:00
soh_cah_toa
c7eb1c7fc9
Added DNS database model to load resource records from.
...
Now modules/extensions can dynamically add new RR's. However, changes
don't take effect until BeEF restarts (fix incoming).
2013-05-08 00:03:08 -04:00
soh_cah_toa
c7981f3c0d
Demoted UPSTREAM from constant to local variable. Minimizes scope.
2013-05-07 22:40:26 -04:00
soh_cah_toa
493ed5182b
Made BeEF::Extension::DNS::DNS into a singleton object.
...
This ensures that all modules/extensions that add new RR's
refer to a single server instance.
2013-05-07 21:56:11 -04:00
soh_cah_toa
ceb55ef3df
Resolved DNS thread issue using EM::next_tick() instead of sleep().
2013-05-06 13:09:44 -04:00
soh_cah_toa
fdd1048f1a
Implemented basic nameserver and configured it to run on BeEF startup.
...
It's worth noting that RubyDNS currently displays a lot of messy
output. This needs to be addressed before moving any further.
2013-05-03 22:37:42 -04:00