soh_cah_toa
8270abd2d5
Added unit tests for Dns::Server public interface.
2013-07-15 02:12:31 -04:00
soh_cah_toa
3865aab7ee
Added unit tests for required config.yaml settings.
2013-07-15 02:07:26 -04:00
soh_cah_toa
123c3cdc04
FIXED UNIT TEST ISSUES!!! \(^o^)/
...
Load path and configuration setup belong in #startup along with any
required files. DataMapper adapter connections go in #setup. That's
the secret recipe.
2013-07-15 02:00:12 -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
d9f7af2721
Reference point for broken unit tests.
...
NoMethodError and NameError are present.
2013-06-22 03:32:42 -04:00
soh_cah_toa
d45bff3a59
Improved #check_dns_response to use config file for address/port.
2013-06-10 18:11:36 -04:00
soh_cah_toa
d2ac9e0f7a
Included broken DNS unit tests so others can help debug.
...
Temporary 'dns' and 'dns_rest' Rake tasks make it easier to run tests.
2013-06-08 23:25:23 -04:00
soh_cah_toa
9e1ec69e40
Added tests for GET /api/dns/ruleset handler.
2013-06-08 22:44:51 -04:00
soh_cah_toa
e775748603
Added more tests for GET /api/dns/rule/:id with invalid input.
...
Also changed handler to return 404 when rule isn't found.
2013-06-08 21:58:28 -04:00
soh_cah_toa
3b58518cfd
Added tests for GET /api/dns/rule/:id handler.
...
Fixed #parse_response so that these tests pass.
2013-06-08 19:04:42 -04:00
soh_cah_toa
b9d64f0b89
Significantly refactored code in #test_3_add_rule_types.
2013-06-07 23:56:19 -04:00
soh_cah_toa
e527f1ae09
Refactored redundant code in #test_1_add_rule_good.
2013-06-07 23:09:07 -04:00
soh_cah_toa
68e56fa8c0
Added tests for NS, PTR, SOA, TXT, WKS, and invalid RR types.
...
All RR's are now tested. Though the tests are yet to be optimized.
2013-06-07 23:03:10 -04:00
soh_cah_toa
eccbdd6958
Added tests for AAAA, CNAME, HINFO, MINFO, and MX RR types.
...
Also fixed #format_response to properly format MS records.
2013-06-07 18:32:29 -04:00
soh_cah_toa
019ec2f6ed
Added new test for attempting to add an existing rule.
2013-06-07 00:05:15 -04:00
soh_cah_toa
cfa9177af1
Added 4 new tests for bad POST /api/dns/rule requests.
2013-06-06 23:58:12 -04:00
soh_cah_toa
1f37ceec9f
Began first integration tests for DNS RESTful API interface.
...
First test is for POST /api/dns/rule handler.
2013-06-06 23:16:40 -04:00
soh_cah_toa
6901581ae7
Moved #format_response call to before when RR type is evaled.
...
Since #format_response throws an exception for unknown RR types,
calling it first will ensure bad Resolv::DNS::Resource names will
never be evaled.
2013-06-06 22:59:54 -04:00
soh_cah_toa
09ec09601e
Changed hash key syntax from previous commit.
...
Besides being consistent, Sinatra actually requires the string
syntax.
2013-06-05 18:33:08 -04:00
soh_cah_toa
fc6f0aface
Changed DELETE handler to return JSON "success" key.
...
Prior to this, nothing was returned. This will allow users to
determine whether or not a rule was removed as expected.
2013-06-05 18:29:18 -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
6c61b39d81
Changed 401 status to 403 in filter for non-permitted IP's.
...
403 Forbidden is more appropriate since 401 Unauthorized only
indicates that authentication is needed. In the case of a bad IP,
authentication will make no difference which is exactly what 403 is
meant for.
2013-06-05 17:09:09 -04:00
soh_cah_toa
80ab665054
Added new InvalidParamError class for handling bad named parameters.
...
Previously, InvalidJsonError was being used mistakenly for this which
is misleading considering no JSON was involved.
2013-06-05 16:56:05 -04:00
soh_cah_toa
e56494d486
Renamed /rules GET route to /ruleset for the sake of consistency.
...
Also added new "count" key to result that lists the number of rules.
2013-06-05 16:30:24 -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
fce4c9196d
Modified grep test case to allow #eval use in DNS extension.
...
Using #eval is necessary for normal functioning and is now used in
a safe manner.
2013-06-03 21:53:06 -04:00
soh_cah_toa
0af4029915
Added placeholders necessary to start DNS unit tests.
...
Currently does nothing but assert(true).
2013-06-03 21:42:34 -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
c8c9e1e139
Reimplemented POST handler to avoid unsafe use of #eval.
...
Now the desired response is passed an array. Each RR type is handled
specially to craft the necessary response.
2013-06-02 22:40:58 -04:00
soh_cah_toa
998980b566
Fixed case-statement in #match that prevented adding rules locally.
2013-06-02 22:23:27 -04:00
soh_cah_toa
7f4562945a
Added new InvalidJsonError class for handling errors in JSON input.
...
This is better practice than just (ab)using StandardError.
2013-05-26 23:46:37 -04:00
soh_cah_toa
38284d5eaa
Implemented DELETE handler for removing DNS rules.
2013-05-26 23:26:58 -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
13001b9642
Updated README.mkd to mention rubydns and sourcify dependencies.
...
This was forgettin in commit 872ce2e .
2013-05-16 23:24:23 -04:00
soh_cah_toa
18a78b57b2
Fixed load_rules() to rebuild 'pattern' and 'type' as an array.
...
This was forgotten in the previous commit.
2013-05-16 23:20:04 -04:00
soh_cah_toa
24f7e5b6cd
Separated 'pattern' and 'type' properties in DNS model.
...
This will expose the resource type to the RESTful API (coming soon).
2013-05-16 23:14:29 -04:00
soh_cah_toa
6d2a771084
Changed model name to BeEF::Core::Models::DNS::Rule.
...
This is more descriptive and follows the singular name convention.
2013-05-15 22:29:42 -04:00
soh_cah_toa
271b2b8e85
Removed RubyDNS::Server#rules attribute accessor since it's unused.
2013-05-15 22:19:58 -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
872ce2e92f
Updated README to mention rubydns and sourcify dependencies.
2013-05-15 22:15:50 -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