-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding sources to sumoapi and refactoring.
- Loading branch information
Aslan
committed
Jul 31, 2016
1 parent
cb43a85
commit 4130508
Showing
5 changed files
with
165 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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,35 @@ | ||
module ZAWS | ||
class Sumoapi | ||
class Data | ||
class Sources | ||
|
||
def initialize(shellout, sumoapi) | ||
@shellout=shellout | ||
@sumoapi=sumoapi | ||
@instance_hash=nil | ||
end | ||
|
||
def validJSON | ||
return (@instance_hash.nil?) | ||
end | ||
|
||
def load(data, verbose) | ||
@instance_raw_data = data | ||
verbose.puts(@instance_raw_data) if verbose | ||
@instance_hash=data | ||
end | ||
|
||
def view(verbose,sourceid) | ||
details = @sumoapi.filestore.retrieve("sources#{sourceid}") | ||
if details.nil? | ||
load(@sumoapi.resource_sources.list.execute(verbose,sourceid),verbose) | ||
@sumoapi.filestore.store("sources#{sourceid}",@instance_hash,Time.now + @sumoapi.filestore.timeout) | ||
else | ||
load(details,verbose) | ||
end | ||
return @instance_raw_data | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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,18 @@ | ||
module ZAWS | ||
class Sumoapi | ||
class Resources | ||
class Sources | ||
def initialize(shellout, nessusapi) | ||
@shellout=shellout | ||
@nessusapi=nessusapi | ||
end | ||
|
||
def list | ||
@_list ||= (ZAWS::Sumoapi::Resources::Sources::List.new(@shellout, @nessusapi)) | ||
return @_list | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains 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,20 @@ | ||
module ZAWS | ||
class Sumoapi | ||
class Resources | ||
class Sources | ||
class List | ||
|
||
def initialize(shellout,sumoapi) | ||
@shellout=shellout | ||
@sumoapi=sumoapi | ||
end | ||
|
||
def execute(verbose=nil,sourceid) | ||
@sumoapi.client.get("/api/v1/collectors/#{sourceid}/sources") | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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