nexposecli 0.1.13 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/nexposecli +63 -262
- data/bin/nexposecli.test +11 -2
- data/lib/nexposecli/args.rb +232 -0
- data/lib/nexposecli/ops.rb +11 -0
- data/lib/nexposecli/role.rb +10 -0
- data/lib/nexposecli/scan.rb +10 -0
- data/lib/nexposecli/version.rb +1 -1
- data/lib/nexposecli.rb +4 -5
- data/nexposecli.gemspec +3 -3
- metadata +19 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 55304881a72629484ab8661e51fa5f7add72f67a
         | 
| 4 | 
            +
              data.tar.gz: c3b6bda8e98491d93e0e8f68fca7336ff999af7b
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7ed6b2f14f1aa74ee8d49a5c1424b5a88d680c4145200ee590ca26e1e31c9c905d8b10268076f73a4b4759c25db43543d136e9214591b9b6ac694c319c40c0de
         | 
| 7 | 
            +
              data.tar.gz: 9dfecc38b96235615560ae57897ba19495910481a6db43c2aed4ed7453f1d5610b9fbcb825cea0a8e13e959014a2643f313cab65cf3913794daf476de908d803
         | 
    
        data/bin/nexposecli
    CHANGED
    
    | @@ -1,20 +1,18 @@ | |
| 1 1 | 
             
            #!/usr/bin/env ruby
         | 
| 2 2 | 
             
            ##############################################################################
         | 
| 3 3 | 
             
            #
         | 
| 4 | 
            -
            # File:    	 | 
| 4 | 
            +
            # File:    	nexposecli
         | 
| 5 5 | 
             
            #
         | 
| 6 6 | 
             
            # Author:  	Erik Gomez <gomeze@pobox.com>
         | 
| 7 7 | 
             
            # 		Erik Gomez <erik_gomez@rapid7.com>
         | 
| 8 8 | 
             
            #
         | 
| 9 | 
            -
            # Purpose: 	 | 
| 9 | 
            +
            # Purpose: 	A command-line utility for the Rapid7 Nexpose Console 
         | 
| 10 10 | 
             
            #
         | 
| 11 | 
            -
            #  | 
| 12 | 
            -
            # Revision:	$Id:$ (20160426@1315.01)
         | 
| 13 | 
            -
            #
         | 
| 14 | 
            -
            #   Usage: ./evm.rb <action> <target> [<args>] 
         | 
| 11 | 
            +
            #   Usage: nexposecli <action> <target> [<args>] 
         | 
| 15 12 | 
             
            #
         | 
| 16 13 | 
             
            #   -v		verbose
         | 
| 17 14 | 
             
            #   --help	help
         | 
| 15 | 
            +
            #
         | 
| 18 16 | 
             
            #  ***NOTE*** This script is being refactored!!!
         | 
| 19 17 | 
             
            #  It is currently a shameless copy of my UF code and 
         | 
| 20 18 | 
             
            #  argparse.rb class code from Jim Hranicky (jfh@ufl.edu)
         | 
| @@ -30,29 +28,18 @@ require 'netaddr' | |
| 30 28 | 
             
            require 'logger'
         | 
| 31 29 | 
             
            require 'yaml'
         | 
| 32 30 | 
             
            require 'csv'
         | 
| 33 | 
            -
            require 'set'
         | 
| 34 31 | 
             
            # for debug, this dumps the ruby objects to STDOUT
         | 
| 35 32 | 
             
            require 'pp'
         | 
| 36 33 |  | 
| 37 34 | 
             
            ##############################################################################
         | 
| 38 | 
            -
            # Set Const
         | 
| 39 | 
            -
             | 
| 40 | 
            -
            # Allowed Ops by field, in Set form
         | 
| 41 | 
            -
            CVSS_SCORE_OPS = Set["IS", "IS_NOT", "IN_RANGE", "GREATER_THAN", "LESS_THAN"]
         | 
| 42 | 
            -
            IP_RANGE_OPS   = Set["IN", "NOT_IN"]
         | 
| 43 | 
            -
            OS_OPS         = Set["CONTAINS", "NOT_CONTAINS", "IS_EMPTY", "IS_NOT_EMPTY"]
         | 
| 44 | 
            -
            RISK_SCORE_OPS = Set["IS", "IS_NOT", "IN_RANGE", "GREATER_THAN", "LESS_THAN"]
         | 
| 45 | 
            -
            SITE_ID_OPS    = Set["IN", "NOT_IN"]
         | 
| 46 | 
            -
            SCAN_DATE_OPS  = Set["ON_OR_BEFORE", "ON_OR_AFTER", "BETWEEN", "EARLIER_THAN", "WITHIN_THE_LAST"]
         | 
| 47 | 
            -
             | 
| 48 35 | 
             
            # Set default var values
         | 
| 49 36 | 
             
            $debug = false
         | 
| 50 37 | 
             
            uf_scanners = ''
         | 
| 51 38 |  | 
| 52 | 
            -
            @logpath = "./ | 
| 39 | 
            +
            @logpath = "./"
         | 
| 53 40 | 
             
            @scanpath = "./"
         | 
| 54 41 | 
             
            # Attempting to use logfile per month: @logfile = "evm" + Time.now.strftime("%Y%m%d_%H%M%S") + ".log"
         | 
| 55 | 
            -
            @logfile = " | 
| 42 | 
            +
            @logfile = "nexposecli" + Time.now.strftime("%Y%m") + ".log"
         | 
| 56 43 | 
             
            @evm_reqid = SecureRandom.hex
         | 
| 57 44 | 
             
            @nsc_server = "<server>" 
         | 
| 58 45 | 
             
            @nsc_user   = "<user>"
         | 
| @@ -80,7 +67,7 @@ def upp( uobj ) | |
| 80 67 | 
             
              end
         | 
| 81 68 | 
             
            end
         | 
| 82 69 |  | 
| 83 | 
            -
            #  | 
| 70 | 
            +
            # bail vs exit
         | 
| 84 71 | 
             
            def ubail(retval, msg)
         | 
| 85 72 | 
             
              uputs("BAIL", msg.to_s)
         | 
| 86 73 | 
             
              exit(retval)
         | 
| @@ -225,14 +212,7 @@ def validate_searchstring(sfstr) | |
| 225 212 | 
             
              valid_search_field = nil
         | 
| 226 213 | 
             
              valid_search_op    = nil
         | 
| 227 214 |  | 
| 228 | 
            -
              # Valid search fields and operators | 
| 229 | 
            -
              # CVSS_SCORE = IS, IS_NOT, IN_RANGE, GREATER_THAN, LESS_THAN (Float 0.0-10.0)
         | 
| 230 | 
            -
              # IP_RANGE   = IN, NOT_IN (IPv4 dotted notation)
         | 
| 231 | 
            -
              # OS         = CONTAINS, NOT_CONTAINS, IS_EMPTY, IS_NOT_EMPTY
         | 
| 232 | 
            -
              # RISK_SCORE = IS, IS_NOT, IN_RANGE, GREATER_THAN, LESS_THAN (Fixnum)
         | 
| 233 | 
            -
              # SITE_ID    = IN, NOT_IN (Fixnum)
         | 
| 234 | 
            -
              # SCAN_DATE  = ON_OR_BEFORE, ON_OR_AFTER, BETWEEN (Value::ScanDate::FORMAT dates)
         | 
| 235 | 
            -
              # SCAN_DATE  = EARLIER_THAN, WITHIN_THE_LAST (Fixnum days)
         | 
| 215 | 
            +
              # Valid search fields and operators can be found in lib/nexposecli/ops.rb
         | 
| 236 216 |  | 
| 237 217 | 
             
              # Grab search field and op
         | 
| 238 218 | 
             
              search_field = sfstr.split(':').first.to_s
         | 
| @@ -242,17 +222,17 @@ def validate_searchstring(sfstr) | |
| 242 222 | 
             
              isValid = false
         | 
| 243 223 | 
             
              case search_field
         | 
| 244 224 | 
             
              when "CVSS_SCORE"
         | 
| 245 | 
            -
                 isValid = true if CVSS_SCORE_OPS.include?(search_op)
         | 
| 225 | 
            +
                 isValid = true if Nexposecli::CVSS_SCORE_OPS.include?(search_op)
         | 
| 246 226 | 
             
              when "IP_RANGE"
         | 
| 247 | 
            -
                 isValid = true if IP_RANGE_OPS.include?(search_op)
         | 
| 227 | 
            +
                 isValid = true if Nexposecli::IP_RANGE_OPS.include?(search_op)
         | 
| 248 228 | 
             
              when "OS"
         | 
| 249 | 
            -
                 isValid = true if OS_OPS.include?(search_op)
         | 
| 229 | 
            +
                 isValid = true if Nexposecli::OS_OPS.include?(search_op)
         | 
| 250 230 | 
             
              when "RISK_SCORE"
         | 
| 251 | 
            -
                 isValid = true if RISK_SCORE_OPS.include?(search_op)
         | 
| 231 | 
            +
                 isValid = true if Nexposecli::RISK_SCORE_OPS.include?(search_op)
         | 
| 252 232 | 
             
              when "SITE_ID"
         | 
| 253 | 
            -
                 isValid = true if SITE_ID_OPS.include?(search_op)
         | 
| 233 | 
            +
                 isValid = true if Nexposecli::SITE_ID_OPS.include?(search_op)
         | 
| 254 234 | 
             
              when "SCAN_DATE"
         | 
| 255 | 
            -
                 isValid = true if SCAN_DATE_OPS.include?(search_op)
         | 
| 235 | 
            +
                 isValid = true if Nexposecli::SCAN_DATE_OPS.include?(search_op)
         | 
| 256 236 | 
             
              else
         | 
| 257 237 | 
             
                 # Unsupported search field
         | 
| 258 238 | 
             
              end
         | 
| @@ -265,230 +245,13 @@ def validate_searchstring(sfstr) | |
| 265 245 | 
             
              end
         | 
| 266 246 | 
             
            end
         | 
| 267 247 |  | 
| 268 | 
            -
            ##############################################################################
         | 
| 269 | 
            -
            #
         | 
| 270 | 
            -
            # Conf
         | 
| 271 | 
            -
            #
         | 
| 272 | 
            -
            ##############################################################################
         | 
| 273 | 
            -
            # Parse cli and config options passed
         | 
| 274 | 
            -
            ARGS = %q{ 
         | 
| 275 | 
            -
              - comment               : General Options
         | 
| 276 | 
            -
             | 
| 277 | 
            -
              - name                  : help
         | 
| 278 | 
            -
                desc                  : Print help
         | 
| 279 | 
            -
             | 
| 280 | 
            -
              - name                  : verbose
         | 
| 281 | 
            -
                short                 : v
         | 
| 282 | 
            -
                desc                  : Run verbosely
         | 
| 283 | 
            -
             | 
| 284 | 
            -
              - comment               : EVM Administrative Actions
         | 
| 285 | 
            -
             | 
| 286 | 
            -
              - name                  : create
         | 
| 287 | 
            -
                short                 : c
         | 
| 288 | 
            -
                desc                  : The create action is used for new objects
         | 
| 289 | 
            -
             | 
| 290 | 
            -
              - name                  : list
         | 
| 291 | 
            -
                short                 : l
         | 
| 292 | 
            -
                desc                  : The list action is used to list of objects of the same type
         | 
| 293 | 
            -
             | 
| 294 | 
            -
              - name                  : show
         | 
| 295 | 
            -
                short                 : s
         | 
| 296 | 
            -
                desc                  : The show action is used to display details of a single object
         | 
| 297 | 
            -
             | 
| 298 | 
            -
              - name                  : update
         | 
| 299 | 
            -
                short                 : u
         | 
| 300 | 
            -
                desc                  : The update action is used to change properties of a single object
         | 
| 301 | 
            -
             | 
| 302 | 
            -
              - name                  : delete
         | 
| 303 | 
            -
                short                 : d
         | 
| 304 | 
            -
                desc                  : The delete action is used to delete a single object
         | 
| 305 | 
            -
             | 
| 306 | 
            -
              - name                  : run
         | 
| 307 | 
            -
                desc                  : The run action is only used to issue commands to the COMMAND object
         | 
| 308 | 
            -
             | 
| 309 | 
            -
              - comment               : EVM Action Targets
         | 
| 310 | 
            -
             | 
| 311 | 
            -
              - name                  : USER
         | 
| 312 | 
            -
                short                 : U
         | 
| 313 | 
            -
                desc                  : The USER target is used to alter or create the USER object
         | 
| 314 | 
            -
             | 
| 315 | 
            -
              - name                  : ROLE
         | 
| 316 | 
            -
                short                 : L
         | 
| 317 | 
            -
                desc                  : The ROLE target is used to alter or create the ROLE object
         | 
| 318 | 
            -
             | 
| 319 | 
            -
              - name                  : ENGINE
         | 
| 320 | 
            -
                short                 : E
         | 
| 321 | 
            -
                desc                  : The ENGINE target is used to alter or create the SCAN ENGINE object
         | 
| 322 | 
            -
             | 
| 323 | 
            -
              - name                  : POOL
         | 
| 324 | 
            -
                short                 : P
         | 
| 325 | 
            -
                desc                  : The POOL target is used to alter or create the POOL object
         | 
| 326 | 
            -
             | 
| 327 | 
            -
              - name                  : SCAN
         | 
| 328 | 
            -
                short                 : S
         | 
| 329 | 
            -
                desc                  : The SCAN target is used to alter or create the SCAN object
         | 
| 330 | 
            -
             | 
| 331 | 
            -
              - name                  : SITE
         | 
| 332 | 
            -
                short                 : T
         | 
| 333 | 
            -
                desc                  : The SITE target is used to alter or create the SITE object
         | 
| 334 | 
            -
             | 
| 335 | 
            -
              - name                  : ASSET
         | 
| 336 | 
            -
                short                 : A
         | 
| 337 | 
            -
                desc                  : The ASSET target is used to alter or create the ASSET object
         | 
| 338 | 
            -
             | 
| 339 | 
            -
              - name                  : DASSET
         | 
| 340 | 
            -
                short                 : D
         | 
| 341 | 
            -
                desc                  : The DASSET target is used to alter or create the DASSET object
         | 
| 342 | 
            -
             | 
| 343 | 
            -
              - name                  : TAG
         | 
| 344 | 
            -
                short                 : G
         | 
| 345 | 
            -
                desc                  : The TAG target is used to alter or create the TAG object
         | 
| 346 | 
            -
             | 
| 347 | 
            -
              - name                  : REPORT
         | 
| 348 | 
            -
                short                 : R
         | 
| 349 | 
            -
                desc                  : The REPORT target is used to alter or create the REPORT object
         | 
| 350 | 
            -
             | 
| 351 | 
            -
              - name                  : VULN
         | 
| 352 | 
            -
                short                 : V
         | 
| 353 | 
            -
                desc                  : The VULN target is used to alter or create the VULN object
         | 
| 354 | 
            -
             | 
| 355 | 
            -
              - name                  : CONSOLE
         | 
| 356 | 
            -
                desc                  : The CONSOLE target is used to alter the CONSOLE nsc connection object
         | 
| 357 | 
            -
             | 
| 358 | 
            -
              - name                  : COMMAND
         | 
| 359 | 
            -
                short                 : C
         | 
| 360 | 
            -
                desc                  : The COMMAND target is only used in conjunction with the --run action
         | 
| 361 | 
            -
                required              : true
         | 
| 362 | 
            -
             | 
| 363 | 
            -
              - name                  : QUERY
         | 
| 364 | 
            -
                desc                  : The QUERY target is only used in conjunction with the --run action
         | 
| 365 | 
            -
             | 
| 366 | 
            -
              - comment               : EVM Action Argument Values
         | 
| 367 | 
            -
             | 
| 368 | 
            -
              - name                  : host
         | 
| 369 | 
            -
                short                 : h
         | 
| 370 | 
            -
                desc                  : The target ip or host to be acted upon by the action
         | 
| 371 | 
            -
                required              : true
         | 
| 372 | 
            -
             | 
| 373 | 
            -
              - name                  : port
         | 
| 374 | 
            -
                short                 : p
         | 
| 375 | 
            -
                desc                  : The target port to be acted upon by the action
         | 
| 376 | 
            -
                required              : true
         | 
| 377 | 
            -
             | 
| 378 | 
            -
              - name                  : name
         | 
| 379 | 
            -
                short                 : n
         | 
| 380 | 
            -
                desc                  : The target object name
         | 
| 381 | 
            -
                required              : true
         | 
| 382 | 
            -
             | 
| 383 | 
            -
              - name                  : fullname
         | 
| 384 | 
            -
                desc                  : The target object full name
         | 
| 385 | 
            -
                required              : true
         | 
| 386 | 
            -
             | 
| 387 | 
            -
              - name                  : newname
         | 
| 388 | 
            -
                desc                  : The target object new name
         | 
| 389 | 
            -
                required              : true
         | 
| 390 | 
            -
             | 
| 391 | 
            -
              - name                  : description
         | 
| 392 | 
            -
                short                 : t
         | 
| 393 | 
            -
                desc                  : The text based description of the object being acted upon
         | 
| 394 | 
            -
                required              : true
         | 
| 395 | 
            -
             | 
| 396 | 
            -
              - name                  : id
         | 
| 397 | 
            -
                short                 : i
         | 
| 398 | 
            -
                desc                  : The object id being acted upon
         | 
| 399 | 
            -
                required              : true
         | 
| 400 | 
            -
             | 
| 401 | 
            -
              - name                  : site
         | 
| 402 | 
            -
                desc                  : The site id of the object being acted upon
         | 
| 403 | 
            -
                required              : true
         | 
| 404 | 
            -
             | 
| 405 | 
            -
              - name                  : range
         | 
| 406 | 
            -
                short                 : r
         | 
| 407 | 
            -
                desc                  : The comma separated (begin,end) range of ip addresses to be acted upon
         | 
| 408 | 
            -
                required              : true
         | 
| 409 | 
            -
             | 
| 410 | 
            -
              - name                  : targets
         | 
| 411 | 
            -
                desc                  : The network block or ip addresses to be acted upon, in CIDRv4, dotted dashed, or ip format
         | 
| 412 | 
            -
                required              : true
         | 
| 413 | 
            -
             | 
| 414 | 
            -
              - name                  : argv
         | 
| 415 | 
            -
                short                 : g
         | 
| 416 | 
            -
                desc                  : Argument vector for the action, in the form key:value pairs
         | 
| 417 | 
            -
                required              : true
         | 
| 418 | 
            -
             | 
| 419 | 
            -
              - name                  : filter
         | 
| 420 | 
            -
                short                 : f
         | 
| 421 | 
            -
                desc                  : Filters which are applied to the action, in the form key:value pairs
         | 
| 422 | 
            -
                required              : true
         | 
| 423 | 
            -
             | 
| 424 | 
            -
              - name                  : filterv
         | 
| 425 | 
            -
                desc                  : Filter value which are applied to the action. Formate varies by filter type
         | 
| 426 | 
            -
                required              : true
         | 
| 427 | 
            -
             | 
| 428 | 
            -
              - name                  : action
         | 
| 429 | 
            -
                short                 : a
         | 
| 430 | 
            -
                desc                  : The subaction to be performed within the target action
         | 
| 431 | 
            -
                required              : true
         | 
| 432 | 
            -
             | 
| 433 | 
            -
              - name                  : sql
         | 
| 434 | 
            -
                desc                  : The sql query to be executed
         | 
| 435 | 
            -
                required              : true
         | 
| 436 | 
            -
             | 
| 437 | 
            -
              - name                  : sqlvar
         | 
| 438 | 
            -
                desc                  : The sql query to be executed
         | 
| 439 | 
            -
                required              : true
         | 
| 440 | 
            -
             | 
| 441 | 
            -
              - name                  : sqlfile
         | 
| 442 | 
            -
                desc                  : The file containing the sql query to be executed
         | 
| 443 | 
            -
                required              : true
         | 
| 444 | 
            -
             | 
| 445 | 
            -
              - name                  : timeout
         | 
| 446 | 
            -
                desc                  : The timeout value in seconds for certain actions, such as reporting
         | 
| 447 | 
            -
                required              : true
         | 
| 448 | 
            -
             | 
| 449 | 
            -
              - name                  : attempts
         | 
| 450 | 
            -
                desc                  : The max number of attempts for iterative actions
         | 
| 451 | 
            -
                required              : true
         | 
| 452 | 
            -
             | 
| 453 | 
            -
              - name                  : loop_sleep
         | 
| 454 | 
            -
                desc                  : The sleep interval in seconds between action iterations
         | 
| 455 | 
            -
                required              : true
         | 
| 456 | 
            -
             | 
| 457 | 
            -
              - comment               : Nexpose Console credentials
         | 
| 458 | 
            -
             | 
| 459 | 
            -
              - name                  : config
         | 
| 460 | 
            -
                desc                  : The config yaml file containing the connection details of the Nexpose Console Server
         | 
| 461 | 
            -
                required              : true
         | 
| 462 | 
            -
             | 
| 463 | 
            -
              - name                  : nsc_server
         | 
| 464 | 
            -
                desc                  : The ip or hostname of the Nexpose Console Server
         | 
| 465 | 
            -
                required              : true
         | 
| 466 | 
            -
             | 
| 467 | 
            -
              - name                  : nsc_user
         | 
| 468 | 
            -
                desc                  : The username to login to the Nexpose Console Server
         | 
| 469 | 
            -
                required              : true
         | 
| 470 | 
            -
             | 
| 471 | 
            -
              - name                  : nsc_pass
         | 
| 472 | 
            -
                desc                  : The password to login to the Nexpose Console Server
         | 
| 473 | 
            -
                required              : true
         | 
| 474 | 
            -
             | 
| 475 | 
            -
              - name                  : logpath
         | 
| 476 | 
            -
                desc                  : The path for writing the logs
         | 
| 477 | 
            -
                required              : true
         | 
| 478 | 
            -
             | 
| 479 | 
            -
              - name                  : scanpath
         | 
| 480 | 
            -
                desc                  : The path for exported/imported scans
         | 
| 481 | 
            -
                required              : true
         | 
| 482 | 
            -
            }
         | 
| 483 | 
            -
             | 
| 484 | 
            -
             | 
| 485 248 | 
             
            ##############################################################################
         | 
| 486 249 | 
             
            #
         | 
| 487 250 | 
             
            # Main
         | 
| 488 251 | 
             
            #
         | 
| 489 252 | 
             
            ##############################################################################
         | 
| 490 253 | 
             
            # Args parsing
         | 
| 491 | 
            -
            ap = Nexposecli::ArgParse.new( ARGS )
         | 
| 254 | 
            +
            ap = Nexposecli::ArgParse.new( Nexposecli::ARGS )
         | 
| 492 255 |  | 
| 493 256 | 
             
            begin
         | 
| 494 257 | 
             
              args = ap.parse
         | 
| @@ -508,6 +271,7 @@ end | |
| 508 271 | 
             
            uputs("LOG", "Automation tasks being run from: " + Socket.gethostname.to_s)
         | 
| 509 272 | 
             
            uputs("LOG", "Automation tasks being logged to: #{@logpath.to_s + @logfile.to_s}")
         | 
| 510 273 |  | 
| 274 | 
            +
            # Needs to move
         | 
| 511 275 | 
             
            if args.scanpath
         | 
| 512 276 | 
             
              # consider input validation, to avoid sec issues
         | 
| 513 277 | 
             
              @scanpath = args.scanpath.to_s
         | 
| @@ -517,6 +281,7 @@ $debug = TRUE if args.verbose | |
| 517 281 | 
             
            uputs("CLI", "Command-line args parsed for #{$0}")
         | 
| 518 282 | 
             
            uputs("CLI", "Args: #{args.inspect}")
         | 
| 519 283 |  | 
| 284 | 
            +
            # Needs to potentially move, based on TARGET help vs general usage
         | 
| 520 285 | 
             
            if args.help
         | 
| 521 286 | 
             
              uputs("CLI", "Help was requested, displaying usage and exiting")
         | 
| 522 287 | 
             
              puts ap.usage("#{$0} [options] (v #{Nexposecli::VERSION})")
         | 
| @@ -552,9 +317,12 @@ uputs("TARGET", "Checking for the requested target") | |
| 552 317 | 
             
            @target |= 4096  if args.TEMPLATE
         | 
| 553 318 | 
             
            @target |= 8192  if args.ROLE
         | 
| 554 319 | 
             
            @target |= 16384  if args.QUERY
         | 
| 320 | 
            +
            @target |= 32768  if args.AUTHSRC
         | 
| 555 321 | 
             
            uputs("TARGET", "The requested target value is: #{@target.to_s}")
         | 
| 556 | 
            -
            raise "You can only submit one target per task, see --help (#{@target})" unless [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384].include?(@target)
         | 
| 322 | 
            +
            raise "You can only submit one target per task, see --help (#{@target})" unless [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768].include?(@target)
         | 
| 557 323 |  | 
| 324 | 
            +
            # Needs to potentially move into TARGET object or module instance var
         | 
| 325 | 
            +
            ## First NSC Connection and Session creation
         | 
| 558 326 | 
             
            # nsc conn vars
         | 
| 559 327 | 
             
            unless (
         | 
| 560 328 | 
             
              (args.nsc_server && args.nsc_user && args.nsc_pass) || args.config
         | 
| @@ -609,26 +377,38 @@ when 1   # TARGET USER | |
| 609 377 | 
             
                uputs("ACTION", 'create USER action requested')
         | 
| 610 378 | 
             
                name = args.name
         | 
| 611 379 | 
             
                full_name = "#{args.fullname}"
         | 
| 612 | 
            -
                 | 
| 380 | 
            +
                email = "#{args.email}"
         | 
| 381 | 
            +
                role = "#{args.role}"
         | 
| 382 | 
            +
                password = "#{args.password}"
         | 
| 613 383 |  | 
| 614 384 | 
             
                user = Nexpose::User.new(name,
         | 
| 615 385 | 
             
                                         full_name, 
         | 
| 616 386 | 
             
                                         password, 
         | 
| 617 | 
            -
                                         role_name =  | 
| 387 | 
            +
                                         role_name = role,
         | 
| 618 388 | 
             
                                         id = -1, 
         | 
| 619 389 | 
             
                                         enabled = 1, 
         | 
| 620 | 
            -
                                         email =  | 
| 390 | 
            +
                                         email = email, 
         | 
| 621 391 | 
             
                                         all_sites = false, 
         | 
| 622 392 | 
             
                                         all_groups = false, 
         | 
| 623 393 | 
             
                                         token = nil)
         | 
| 624 | 
            -
                 | 
| 625 | 
            -
             | 
| 394 | 
            +
                if args.authsrc
         | 
| 395 | 
            +
                   user.authsrcid = args.authsrc
         | 
| 396 | 
            +
                   user.password = nil
         | 
| 397 | 
            +
                end
         | 
| 626 398 | 
             
                user.save(@nsc)
         | 
| 627 | 
            -
                 | 
| 399 | 
            +
                puts "The user: #{user.name} was created with id: #{user.id}"
         | 
| 400 | 
            +
                uputs("USER", "New user created: #{user.name} (id:#{user.id})")
         | 
| 401 | 
            +
                upp user
         | 
| 628 402 | 
             
              when 2   # list
         | 
| 629 403 | 
             
                uputs("ACTION", 'list USER action requested')
         | 
| 630 404 | 
             
                user_listing = @nsc.list_users
         | 
| 631 | 
            -
                 | 
| 405 | 
            +
                puts "Users:"
         | 
| 406 | 
            +
                puts " -  " + '%-6.6s' % 'Admin?' + " " + '%-15.15s' % 'Username' + " " + '%-25.25s' % 'Full Name' + " " + '%-30.30s' % 'Email' + " " + '%-25.25s' % "Role" + "\tAuth Module:Source"
         | 
| 407 | 
            +
                user_listing.each do |user|
         | 
| 408 | 
            +
                   role = Nexpose::User.load(@nsc, user.id).role_name
         | 
| 409 | 
            +
                   puts " -  " + '%-6.6s' % user.is_admin.to_s + " " + '%-15.15s' % user.name + " " + '%-25.25s' % user.full_name + " " + '%-30.30s' % user.email + " " + '%-25.25s' % role + "\t#{user.auth_module}:#{user.auth_source}"
         | 
| 410 | 
            +
                end
         | 
| 411 | 
            +
                upp user_listing
         | 
| 632 412 | 
             
              when 4   # show
         | 
| 633 413 | 
             
                uputs("ACTION", 'show USER action requested')
         | 
| 634 414 | 
             
                userid = args.id.to_str
         | 
| @@ -1705,6 +1485,11 @@ when 8192 # TARGET ROLE | |
| 1705 1485 | 
             
               when 2  # list
         | 
| 1706 1486 | 
             
                  uputs("ACTION", 'list ROLE action requested')
         | 
| 1707 1487 | 
             
                  postd = @nsc.roles
         | 
| 1488 | 
            +
                  puts "Roles:"
         | 
| 1489 | 
            +
                  puts " -  " + '%-6.6s' % 'Scope' + " " + '%-5.5s' % 'Id' + " " + '%-25.25s' % 'Username' + " " + '%-25.25s' % 'Full Name' + " " + '%-60.60s' % 'Description'
         | 
| 1490 | 
            +
                  postd.each do |role|
         | 
| 1491 | 
            +
                     puts " -  " + '%-6.6s' % role.scope + " " + '%-5.5s' % role.id + " " + '%-25.25s' % role.name + " " + '%-25.25s' % role.full_name + " " + '%-60.60s' % role.description 
         | 
| 1492 | 
            +
                  end
         | 
| 1708 1493 | 
             
                  upp postd
         | 
| 1709 1494 | 
             
                  puts "\n"
         | 
| 1710 1495 | 
             
               when 4 # show
         | 
| @@ -1762,8 +1547,24 @@ when 16384 # TARGET QUERY | |
| 1762 1547 |  | 
| 1763 1548 | 
             
                  puts csv_output
         | 
| 1764 1549 | 
             
               else
         | 
| 1765 | 
            -
                  uputs("ACTION", 'The action requested is not implemented for target:  | 
| 1766 | 
            -
                  puts 'The action requested is not implemented for target:  | 
| 1550 | 
            +
                  uputs("ACTION", 'The action requested is not implemented for target: QUERY')
         | 
| 1551 | 
            +
                  puts 'The action requested is not implemented for target: QUERY'
         | 
| 1552 | 
            +
               end
         | 
| 1553 | 
            +
            when 32768 # TARGET AUTHSRC
         | 
| 1554 | 
            +
               case @action
         | 
| 1555 | 
            +
               when 2  # list
         | 
| 1556 | 
            +
                  uputs("ACTION", 'list AUTHSRC action requested')
         | 
| 1557 | 
            +
                  authsrcs = Nexpose::UserAuthenticator.list(@nsc)
         | 
| 1558 | 
            +
                  puts "Authenticator Sources:"
         | 
| 1559 | 
            +
                  puts " -  " + '%-10.10s' % 'Auth Module' + " " + '%-5.5s' % 'Id' + " " + '%-40.40s' % 'Auth Source' + " " + '%-10.10s' % 'External?'
         | 
| 1560 | 
            +
                  authsrcs.each do |src|
         | 
| 1561 | 
            +
                     puts " -  " + '%-10.10s' % src.auth_module + " " + '%-5.5s' % src.id + " " + '%-40.40s' % src.auth_source + " " + '%-10.10s' % src.external.to_s 
         | 
| 1562 | 
            +
                  end
         | 
| 1563 | 
            +
                  upp authsrcs
         | 
| 1564 | 
            +
                  puts "\n"
         | 
| 1565 | 
            +
               else
         | 
| 1566 | 
            +
                  uputs("ACTION", 'The action requested is not implemented for target: AUTHSRC')
         | 
| 1567 | 
            +
                  puts 'The action requested is not implemented for target: AUTHSRC'
         | 
| 1767 1568 | 
             
               end
         | 
| 1768 1569 | 
             
            else
         | 
| 1769 1570 | 
             
               # there is no default target
         | 
    
        data/bin/nexposecli.test
    CHANGED
    
    | @@ -2,5 +2,14 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            require 'nexposecli'
         | 
| 4 4 |  | 
| 5 | 
            -
            chatter = Nexposecli::Chatter.new  
         | 
| 6 | 
            -
            chatter.say_hello  
         | 
| 5 | 
            +
            # chatter = Nexposecli::Chatter.new  
         | 
| 6 | 
            +
            # chatter.say_hello  
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            # nxclass = Nexposecli::Target.const_get("Role")
         | 
| 9 | 
            +
            nxclass = Nexposecli::Target.const_get("#{ARGV[0]}")
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            puts nxclass.new.list
         | 
| 12 | 
            +
            puts "and again but via const_get for method"
         | 
| 13 | 
            +
            puts nxclass.new.method("list").call("me")
         | 
| 14 | 
            +
            puts nxclass.new.method("list").call
         | 
| 15 | 
            +
            puts nxclass.new.method("list").call("Sarah")
         | 
| @@ -0,0 +1,232 @@ | |
| 1 | 
            +
            module Nexposecli
         | 
| 2 | 
            +
               ##############################################################################
         | 
| 3 | 
            +
               #
         | 
| 4 | 
            +
               # Conf
         | 
| 5 | 
            +
               #
         | 
| 6 | 
            +
               ##############################################################################
         | 
| 7 | 
            +
               # Parse cli and config options passed
         | 
| 8 | 
            +
               ARGS = %q{ 
         | 
| 9 | 
            +
                 - comment               : General Options
         | 
| 10 | 
            +
               
         | 
| 11 | 
            +
                 - name                  : help
         | 
| 12 | 
            +
                   desc                  : Print help
         | 
| 13 | 
            +
               
         | 
| 14 | 
            +
                 - name                  : verbose
         | 
| 15 | 
            +
                   short                 : v
         | 
| 16 | 
            +
                   desc                  : Run verbosely
         | 
| 17 | 
            +
               
         | 
| 18 | 
            +
                 - comment               : EVM Administrative Actions
         | 
| 19 | 
            +
               
         | 
| 20 | 
            +
                 - name                  : create
         | 
| 21 | 
            +
                   short                 : c
         | 
| 22 | 
            +
                   desc                  : The create action is used for new objects
         | 
| 23 | 
            +
               
         | 
| 24 | 
            +
                 - name                  : list
         | 
| 25 | 
            +
                   short                 : l
         | 
| 26 | 
            +
                   desc                  : The list action is used to list of objects of the same type
         | 
| 27 | 
            +
               
         | 
| 28 | 
            +
                 - name                  : show
         | 
| 29 | 
            +
                   short                 : s
         | 
| 30 | 
            +
                   desc                  : The show action is used to display details of a single object
         | 
| 31 | 
            +
               
         | 
| 32 | 
            +
                 - name                  : update
         | 
| 33 | 
            +
                   short                 : u
         | 
| 34 | 
            +
                   desc                  : The update action is used to change properties of a single object
         | 
| 35 | 
            +
               
         | 
| 36 | 
            +
                 - name                  : delete
         | 
| 37 | 
            +
                   short                 : d
         | 
| 38 | 
            +
                   desc                  : The delete action is used to delete a single object
         | 
| 39 | 
            +
               
         | 
| 40 | 
            +
                 - name                  : run
         | 
| 41 | 
            +
                   desc                  : The run action is only used to issue commands to the COMMAND object
         | 
| 42 | 
            +
               
         | 
| 43 | 
            +
                 - comment               : EVM Action Targets
         | 
| 44 | 
            +
               
         | 
| 45 | 
            +
                 - name                  : USER
         | 
| 46 | 
            +
                   short                 : U
         | 
| 47 | 
            +
                   desc                  : The USER target is used to alter or create the USER object
         | 
| 48 | 
            +
               
         | 
| 49 | 
            +
                 - name                  : ROLE
         | 
| 50 | 
            +
                   short                 : L
         | 
| 51 | 
            +
                   desc                  : The ROLE target is used to alter or create the ROLE object
         | 
| 52 | 
            +
               
         | 
| 53 | 
            +
                 - name                  : ENGINE
         | 
| 54 | 
            +
                   short                 : E
         | 
| 55 | 
            +
                   desc                  : The ENGINE target is used to alter or create the SCAN ENGINE object
         | 
| 56 | 
            +
               
         | 
| 57 | 
            +
                 - name                  : POOL
         | 
| 58 | 
            +
                   short                 : P
         | 
| 59 | 
            +
                   desc                  : The POOL target is used to alter or create the POOL object
         | 
| 60 | 
            +
               
         | 
| 61 | 
            +
                 - name                  : SCAN
         | 
| 62 | 
            +
                   short                 : S
         | 
| 63 | 
            +
                   desc                  : The SCAN target is used to alter or create the SCAN object
         | 
| 64 | 
            +
               
         | 
| 65 | 
            +
                 - name                  : SITE
         | 
| 66 | 
            +
                   short                 : T
         | 
| 67 | 
            +
                   desc                  : The SITE target is used to alter or create the SITE object
         | 
| 68 | 
            +
               
         | 
| 69 | 
            +
                 - name                  : ASSET
         | 
| 70 | 
            +
                   short                 : A
         | 
| 71 | 
            +
                   desc                  : The ASSET target is used to alter or create the ASSET object
         | 
| 72 | 
            +
               
         | 
| 73 | 
            +
                 - name                  : DASSET
         | 
| 74 | 
            +
                   short                 : D
         | 
| 75 | 
            +
                   desc                  : The DASSET target is used to alter or create the DASSET object
         | 
| 76 | 
            +
               
         | 
| 77 | 
            +
                 - name                  : TAG
         | 
| 78 | 
            +
                   short                 : G
         | 
| 79 | 
            +
                   desc                  : The TAG target is used to alter or create the TAG object
         | 
| 80 | 
            +
               
         | 
| 81 | 
            +
                 - name                  : REPORT
         | 
| 82 | 
            +
                   short                 : R
         | 
| 83 | 
            +
                   desc                  : The REPORT target is used to alter or create the REPORT object
         | 
| 84 | 
            +
               
         | 
| 85 | 
            +
                 - name                  : VULN
         | 
| 86 | 
            +
                   short                 : V
         | 
| 87 | 
            +
                   desc                  : The VULN target is used to alter or create the VULN object
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                 - name                  : AUTHSRC
         | 
| 90 | 
            +
                   desc                  : The AUTHSRC target is used to alter or list the AUTHSRC object
         | 
| 91 | 
            +
               
         | 
| 92 | 
            +
                 - name                  : CONSOLE
         | 
| 93 | 
            +
                   desc                  : The CONSOLE target is used to alter the CONSOLE nsc connection object
         | 
| 94 | 
            +
               
         | 
| 95 | 
            +
                 - name                  : COMMAND
         | 
| 96 | 
            +
                   short                 : C
         | 
| 97 | 
            +
                   desc                  : The COMMAND target is only used in conjunction with the --run action
         | 
| 98 | 
            +
                   required              : true
         | 
| 99 | 
            +
               
         | 
| 100 | 
            +
                 - name                  : QUERY
         | 
| 101 | 
            +
                   desc                  : The QUERY target is only used in conjunction with the --run action
         | 
| 102 | 
            +
               
         | 
| 103 | 
            +
                 - comment               : EVM Action Argument Values
         | 
| 104 | 
            +
               
         | 
| 105 | 
            +
                 - name                  : host
         | 
| 106 | 
            +
                   short                 : h
         | 
| 107 | 
            +
                   desc                  : The target ip or host to be acted upon by the action
         | 
| 108 | 
            +
                   required              : true
         | 
| 109 | 
            +
               
         | 
| 110 | 
            +
                 - name                  : port
         | 
| 111 | 
            +
                   short                 : p
         | 
| 112 | 
            +
                   desc                  : The target port to be acted upon by the action
         | 
| 113 | 
            +
                   required              : true
         | 
| 114 | 
            +
               
         | 
| 115 | 
            +
                 - name                  : authsrc
         | 
| 116 | 
            +
                   desc                  : The target authsrc id
         | 
| 117 | 
            +
                   required              : true
         | 
| 118 | 
            +
               
         | 
| 119 | 
            +
                 - name                  : role
         | 
| 120 | 
            +
                   desc                  : The target role name
         | 
| 121 | 
            +
                   required              : true
         | 
| 122 | 
            +
               
         | 
| 123 | 
            +
                 - name                  : email
         | 
| 124 | 
            +
                   desc                  : The target email address
         | 
| 125 | 
            +
                   required              : true
         | 
| 126 | 
            +
               
         | 
| 127 | 
            +
                 - name                  : name
         | 
| 128 | 
            +
                   short                 : n
         | 
| 129 | 
            +
                   desc                  : The target object name
         | 
| 130 | 
            +
                   required              : true
         | 
| 131 | 
            +
               
         | 
| 132 | 
            +
                 - name                  : fullname
         | 
| 133 | 
            +
                   desc                  : The target object full name
         | 
| 134 | 
            +
                   required              : true
         | 
| 135 | 
            +
               
         | 
| 136 | 
            +
                 - name                  : newname
         | 
| 137 | 
            +
                   desc                  : The target object new name
         | 
| 138 | 
            +
                   required              : true
         | 
| 139 | 
            +
               
         | 
| 140 | 
            +
                 - name                  : description
         | 
| 141 | 
            +
                   short                 : t
         | 
| 142 | 
            +
                   desc                  : The text based description of the object being acted upon
         | 
| 143 | 
            +
                   required              : true
         | 
| 144 | 
            +
               
         | 
| 145 | 
            +
                 - name                  : id
         | 
| 146 | 
            +
                   short                 : i
         | 
| 147 | 
            +
                   desc                  : The object id being acted upon
         | 
| 148 | 
            +
                   required              : true
         | 
| 149 | 
            +
               
         | 
| 150 | 
            +
                 - name                  : site
         | 
| 151 | 
            +
                   desc                  : The site id of the object being acted upon
         | 
| 152 | 
            +
                   required              : true
         | 
| 153 | 
            +
               
         | 
| 154 | 
            +
                 - name                  : range
         | 
| 155 | 
            +
                   short                 : r
         | 
| 156 | 
            +
                   desc                  : The comma separated (begin,end) range of ip addresses to be acted upon
         | 
| 157 | 
            +
                   required              : true
         | 
| 158 | 
            +
               
         | 
| 159 | 
            +
                 - name                  : targets
         | 
| 160 | 
            +
                   desc                  : The network block or ip addresses to be acted upon, in CIDRv4, dotted dashed, or ip format
         | 
| 161 | 
            +
                   required              : true
         | 
| 162 | 
            +
               
         | 
| 163 | 
            +
                 - name                  : argv
         | 
| 164 | 
            +
                   short                 : g
         | 
| 165 | 
            +
                   desc                  : Argument vector for the action, in the form key:value pairs
         | 
| 166 | 
            +
                   required              : true
         | 
| 167 | 
            +
               
         | 
| 168 | 
            +
                 - name                  : filter
         | 
| 169 | 
            +
                   short                 : f
         | 
| 170 | 
            +
                   desc                  : Filters which are applied to the action, in the form key:value pairs
         | 
| 171 | 
            +
                   required              : true
         | 
| 172 | 
            +
               
         | 
| 173 | 
            +
                 - name                  : filterv
         | 
| 174 | 
            +
                   desc                  : Filter value which are applied to the action. Formate varies by filter type
         | 
| 175 | 
            +
                   required              : true
         | 
| 176 | 
            +
               
         | 
| 177 | 
            +
                 - name                  : action
         | 
| 178 | 
            +
                   short                 : a
         | 
| 179 | 
            +
                   desc                  : The subaction to be performed within the target action
         | 
| 180 | 
            +
                   required              : true
         | 
| 181 | 
            +
               
         | 
| 182 | 
            +
                 - name                  : sql
         | 
| 183 | 
            +
                   desc                  : The sql query to be executed
         | 
| 184 | 
            +
                   required              : true
         | 
| 185 | 
            +
               
         | 
| 186 | 
            +
                 - name                  : sqlvar
         | 
| 187 | 
            +
                   desc                  : The sql query to be executed
         | 
| 188 | 
            +
                   required              : true
         | 
| 189 | 
            +
               
         | 
| 190 | 
            +
                 - name                  : sqlfile
         | 
| 191 | 
            +
                   desc                  : The file containing the sql query to be executed
         | 
| 192 | 
            +
                   required              : true
         | 
| 193 | 
            +
               
         | 
| 194 | 
            +
                 - name                  : timeout
         | 
| 195 | 
            +
                   desc                  : The timeout value in seconds for certain actions, such as reporting
         | 
| 196 | 
            +
                   required              : true
         | 
| 197 | 
            +
               
         | 
| 198 | 
            +
                 - name                  : attempts
         | 
| 199 | 
            +
                   desc                  : The max number of attempts for iterative actions
         | 
| 200 | 
            +
                   required              : true
         | 
| 201 | 
            +
               
         | 
| 202 | 
            +
                 - name                  : loop_sleep
         | 
| 203 | 
            +
                   desc                  : The sleep interval in seconds between action iterations
         | 
| 204 | 
            +
                   required              : true
         | 
| 205 | 
            +
               
         | 
| 206 | 
            +
                 - comment               : Nexpose Console credentials
         | 
| 207 | 
            +
               
         | 
| 208 | 
            +
                 - name                  : config
         | 
| 209 | 
            +
                   desc                  : The config yaml file containing the connection details of the Nexpose Console Server
         | 
| 210 | 
            +
                   required              : true
         | 
| 211 | 
            +
               
         | 
| 212 | 
            +
                 - name                  : nsc_server
         | 
| 213 | 
            +
                   desc                  : The ip or hostname of the Nexpose Console Server
         | 
| 214 | 
            +
                   required              : true
         | 
| 215 | 
            +
               
         | 
| 216 | 
            +
                 - name                  : nsc_user
         | 
| 217 | 
            +
                   desc                  : The username to login to the Nexpose Console Server
         | 
| 218 | 
            +
                   required              : true
         | 
| 219 | 
            +
               
         | 
| 220 | 
            +
                 - name                  : nsc_pass
         | 
| 221 | 
            +
                   desc                  : The password to login to the Nexpose Console Server
         | 
| 222 | 
            +
                   required              : true
         | 
| 223 | 
            +
               
         | 
| 224 | 
            +
                 - name                  : logpath
         | 
| 225 | 
            +
                   desc                  : The path for writing the logs
         | 
| 226 | 
            +
                   required              : true
         | 
| 227 | 
            +
               
         | 
| 228 | 
            +
                 - name                  : scanpath
         | 
| 229 | 
            +
                   desc                  : The path for exported/imported scans
         | 
| 230 | 
            +
                   required              : true
         | 
| 231 | 
            +
               }
         | 
| 232 | 
            +
            end   
         | 
| @@ -0,0 +1,11 @@ | |
| 1 | 
            +
            require 'set'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            module Nexposecli
         | 
| 4 | 
            +
               # Allowed Search and Filter Operators by field, in Set form
         | 
| 5 | 
            +
               CVSS_SCORE_OPS = Set["IS", "IS_NOT", "IN_RANGE", "GREATER_THAN", "LESS_THAN"]
         | 
| 6 | 
            +
               IP_RANGE_OPS   = Set["IN", "NOT_IN"]
         | 
| 7 | 
            +
               OS_OPS         = Set["CONTAINS", "NOT_CONTAINS", "IS_EMPTY", "IS_NOT_EMPTY"]
         | 
| 8 | 
            +
               RISK_SCORE_OPS = Set["IS", "IS_NOT", "IN_RANGE", "GREATER_THAN", "LESS_THAN"]
         | 
| 9 | 
            +
               SITE_ID_OPS    = Set["IN", "NOT_IN"]
         | 
| 10 | 
            +
               SCAN_DATE_OPS  = Set["ON_OR_BEFORE", "ON_OR_AFTER", "BETWEEN", "EARLIER_THAN", "WITHIN_THE_LAST"]
         | 
| 11 | 
            +
            end
         | 
    
        data/lib/nexposecli/version.rb
    CHANGED
    
    
    
        data/lib/nexposecli.rb
    CHANGED
    
    | @@ -1,10 +1,9 @@ | |
| 1 1 | 
             
            require "nexposecli/version"
         | 
| 2 2 | 
             
            require "nexposecli/argparse"
         | 
| 3 | 
            +
            require "nexposecli/args"
         | 
| 4 | 
            +
            require "nexposecli/ops"
         | 
| 5 | 
            +
            require "nexposecli/role"
         | 
| 6 | 
            +
            require "nexposecli/scan"
         | 
| 3 7 |  | 
| 4 8 | 
             
            module Nexposecli
         | 
| 5 | 
            -
              class Chatter
         | 
| 6 | 
            -
                def say_hello
         | 
| 7 | 
            -
                  puts 'This is nexposecli. Coming Soon.'
         | 
| 8 | 
            -
                end
         | 
| 9 | 
            -
              end
         | 
| 10 9 | 
             
            end
         | 
    
        data/nexposecli.gemspec
    CHANGED
    
    | @@ -10,7 +10,7 @@ Gem::Specification.new do |spec| | |
| 10 10 | 
             
              spec.summary       = 'Ruby command-line utility for Rapid7 Nexpose'
         | 
| 11 11 | 
             
              spec.description   = 'This experimental gem provides a Ruby command-line utility to the Nexpose vulnerability management product by Rapid7.'
         | 
| 12 12 | 
             
              spec.homepage      = 'https://github.com/frozenr7/nexposecli'
         | 
| 13 | 
            -
              spec.license       = 'BSD'
         | 
| 13 | 
            +
              spec.license       = 'BSD-3-Clause'
         | 
| 14 14 |  | 
| 15 15 | 
             
              spec.files         = `git ls-files`.split($\)
         | 
| 16 16 | 
             
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         | 
| @@ -18,8 +18,8 @@ Gem::Specification.new do |spec| | |
| 18 18 | 
             
              spec.require_paths = ["lib"]
         | 
| 19 19 |  | 
| 20 20 | 
             
              spec.required_ruby_version = '>= 2.1'
         | 
| 21 | 
            -
              spec.add_runtime_dependency "nexpose",  | 
| 22 | 
            -
              spec.add_runtime_dependency "netaddr",  | 
| 21 | 
            +
              spec.add_runtime_dependency "nexpose", '~> 4.0', '>= 4.0.4'
         | 
| 22 | 
            +
              spec.add_runtime_dependency "netaddr", '~> 1.5', '>= 1.5.1'
         | 
| 23 23 |  | 
| 24 24 | 
             
              spec.add_development_dependency "bundler", "~> 1.12"
         | 
| 25 25 | 
             
              spec.add_development_dependency "rake", "~> 10.0"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nexposecli
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1 | 
| 4 | 
            +
              version: 0.2.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Erik Gomez
         | 
| @@ -9,12 +9,15 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2016-06- | 
| 12 | 
            +
            date: 2016-06-16 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: nexpose
         | 
| 16 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                requirements:
         | 
| 18 | 
            +
                - - "~>"
         | 
| 19 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 20 | 
            +
                    version: '4.0'
         | 
| 18 21 | 
             
                - - ">="
         | 
| 19 22 | 
             
                  - !ruby/object:Gem::Version
         | 
| 20 23 | 
             
                    version: 4.0.4
         | 
| @@ -22,6 +25,9 @@ dependencies: | |
| 22 25 | 
             
              prerelease: false
         | 
| 23 26 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 24 27 | 
             
                requirements:
         | 
| 28 | 
            +
                - - "~>"
         | 
| 29 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 30 | 
            +
                    version: '4.0'
         | 
| 25 31 | 
             
                - - ">="
         | 
| 26 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 27 33 | 
             
                    version: 4.0.4
         | 
| @@ -29,6 +35,9 @@ dependencies: | |
| 29 35 | 
             
              name: netaddr
         | 
| 30 36 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 31 37 | 
             
                requirements:
         | 
| 38 | 
            +
                - - "~>"
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '1.5'
         | 
| 32 41 | 
             
                - - ">="
         | 
| 33 42 | 
             
                  - !ruby/object:Gem::Version
         | 
| 34 43 | 
             
                    version: 1.5.1
         | 
| @@ -36,6 +45,9 @@ dependencies: | |
| 36 45 | 
             
              prerelease: false
         | 
| 37 46 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 38 47 | 
             
                requirements:
         | 
| 48 | 
            +
                - - "~>"
         | 
| 49 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 50 | 
            +
                    version: '1.5'
         | 
| 39 51 | 
             
                - - ">="
         | 
| 40 52 | 
             
                  - !ruby/object:Gem::Version
         | 
| 41 53 | 
             
                    version: 1.5.1
         | 
| @@ -103,6 +115,10 @@ files: | |
| 103 115 | 
             
            - bin/setup
         | 
| 104 116 | 
             
            - lib/nexposecli.rb
         | 
| 105 117 | 
             
            - lib/nexposecli/argparse.rb
         | 
| 118 | 
            +
            - lib/nexposecli/args.rb
         | 
| 119 | 
            +
            - lib/nexposecli/ops.rb
         | 
| 120 | 
            +
            - lib/nexposecli/role.rb
         | 
| 121 | 
            +
            - lib/nexposecli/scan.rb
         | 
| 106 122 | 
             
            - lib/nexposecli/version.rb
         | 
| 107 123 | 
             
            - nexposecli-0.1.11.gem
         | 
| 108 124 | 
             
            - nexposecli.gemspec
         | 
| @@ -110,7 +126,7 @@ files: | |
| 110 126 | 
             
            - spec/spec_helper.rb
         | 
| 111 127 | 
             
            homepage: https://github.com/frozenr7/nexposecli
         | 
| 112 128 | 
             
            licenses:
         | 
| 113 | 
            -
            - BSD
         | 
| 129 | 
            +
            - BSD-3-Clause
         | 
| 114 130 | 
             
            metadata: {}
         | 
| 115 131 | 
             
            post_install_message: 
         | 
| 116 132 | 
             
            rdoc_options: []
         |