Skip to content

Commit

Permalink
* Refactor plugin base adding active ws name
Browse files Browse the repository at this point in the history
* Refactor plugins now all the command plugin do not delete the /data/ output file and we add the current workspace
  Plugin changes:
  amap
  dnsmap
  nmap
  sslcheck
  wcscan
  webfuzzer

Test #1487
  • Loading branch information
f-amato committed Dec 9, 2015
1 parent 98434f5 commit 4b8086c
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 23 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Project contributors
* Elian Gidoni
* Andres Tarantini
* Ezequiel Tavella
* Martin Tartarelli
9 changes: 9 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ New features in the latest update

TBA:
---
* Refactor plugin base adding active ws name
* Refactor plugins now all the command plugin do not delete the /data/ output file and we add the current workspace
Plugin changes:
amap
dnsmap
nmap
sslcheck
wcscan
webfuzzer
* Added parametrization for port configuration on APIs.
* Bug get_installed_distributions from handler exceptions
* Adding wiki information default faraday without couchdb configuration
Expand Down
1 change: 1 addition & 0 deletions plugins/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,7 @@ class PluginBase(object):
def __init__(self):

self.data_path = CONF.getDataPath()
self.ws = CONF.getLastWorkspace()
self.persistence_path = CONF.getPersistencePath()
# Must be unique. Check that there is not
# an existant plugin with the same id.
Expand Down
9 changes: 4 additions & 5 deletions plugins/repo/amap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Amap"
self.name = "Amap Output Plugin"
self.plugin_version = "0.0.2"
self.plugin_version = "0.0.3"
self.version = "5.4"
self.options = None
self._current_output = None
Expand Down Expand Up @@ -127,8 +127,6 @@ def parseOutputString(self, output, debug = False):
service = services.get(key)
s_id = self.createAndAddServiceToInterface(h_id, i_id, service[5], service[2], ports = [service[1]], status = service[3],description = service[6])

if not debug:
os.remove(self._file_output_path)
return True

file_arg_re = re.compile(r"^.*(-o \s*[^\s]+\s+(?:-m|)).*$")
Expand Down Expand Up @@ -179,8 +177,9 @@ def processCommandString(self, username, current_path, command_string):
parser.add_argument('-m')



self._file_output_path=os.path.join(self.data_path,"amap_output-%s.txt" % random.uniform(1,10))
self._output_file_path = os.path.join(self.data_path,"%s_%s_output-%s.xml" % (self.ws,
self.id,
random.uniform(1,10)))

if arg_match is None:
final= re.sub(r"(^.*?amap)",
Expand Down
9 changes: 5 additions & 4 deletions plugins/repo/dnsmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import re
import os
import sys
import random


current_path = os.path.abspath(os.getcwd())
Expand Down Expand Up @@ -59,7 +60,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Dnsmap"
self.name = "Dnsmap XML Output Plugin"
self.plugin_version = "0.0.1"
self.plugin_version = "0.0.2"
self.version = "0.30"
self._completition = {
"":"dnsmap <target-domain> [options]",
Expand All @@ -76,7 +77,9 @@ def __init__(self):
self._command_regex = re.compile(r'^(sudo dnsmap|dnsmap|\.\/dnsmap).*?')

global current_path
self._output_file_path = os.path.join(self.data_path, "dnsmap_output-%s.txt" % self._rid)
self._output_file_path = os.path.join(self.data_path,"%s_%s_output-%s.xml" % (self.ws,
self.id,
random.uniform(1,10)))

def canParseCommandString(self, current_input):
if self._command_regex.match(current_input.strip()):
Expand Down Expand Up @@ -109,8 +112,6 @@ def parseOutputString(self, output, debug=False):

del parser

if not debug:
os.remove(self._output_file_path)
return True

xml_arg_re = re.compile(r"^.*(-c\s*[^\s]+).*$")
Expand Down
6 changes: 4 additions & 2 deletions plugins/repo/nmap/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Nmap"
self.name = "Nmap XML Output Plugin"
self.plugin_version = "0.0.2"
self.plugin_version = "0.0.3"
self.version = "6.40"
self.framework_version = "1.0.0"
self.options = None
Expand Down Expand Up @@ -574,7 +574,9 @@ def processCommandString(self, username, current_path, command_string):
Adds the -oX parameter to get xml output to the command string that the
user has set.
"""
self._output_file_path = os.path.join(self.data_path,"nmap_output-%s.xml" % random.uniform(1,10))
self._output_file_path = os.path.join(self.data_path,"%s_%s_output-%s.xml" % (self.ws,
self.id,
random.uniform(1,10)))

arg_match = self.xml_arg_re.match(command_string)

Expand Down
9 changes: 5 additions & 4 deletions plugins/repo/sslcheck/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import re
import os
import sys
import random

try:
import xml.etree.cElementTree as ET
Expand Down Expand Up @@ -69,7 +70,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Sslcheck"
self.name = "Sslcheck XML Output Plugin"
self.plugin_version = "0.0.1"
self.plugin_version = "0.0.2"
self.version = "0.30"
self._completition = {
"":"ssl-check [-h] [-r {key,ren,sign,serv,cyph,forw,heart,crime,all} [{key,ren,sign,serv,cyph,forw,heart,crime,all} ...]] -host HOST [-port PORT] [--xml] [--version]",
Expand All @@ -87,7 +88,9 @@ def __init__(self):
self._command_regex = re.compile(r'^(sudo sslcheck|sslcheck|\.\/sslcheck).*?')

global current_path
self._output_file_path = os.path.join(self.data_path, "sslcheck_output-%s.xml" % self._rid)
self._output_file_path = os.path.join(self.data_path,"%s_%s_output-%s.xml" % (self.ws,
self.id,
random.uniform(1,10)))

def canParseCommandString(self, current_input):
if self._command_regex.match(current_input.strip()):
Expand Down Expand Up @@ -159,8 +162,6 @@ def parseOutputString(self, output, debug=False):

del parser

if not debug:
os.remove(self._output_file_path)
return True

xml_arg_re = re.compile(r"^.*(--xml\s*[^\s]+).*$")
Expand Down
10 changes: 6 additions & 4 deletions plugins/repo/wcscan/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import re
import os
import sys
import random

try:
import xml.etree.cElementTree as ET
Expand Down Expand Up @@ -77,7 +78,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Wcscan"
self.name = "Wcscan XML Output Plugin"
self.plugin_version = "0.0.1"
self.plugin_version = "0.0.2"
self.version = "0.30"
self._completition = {
"":"wcscan [-h] [-r] [-host HOST] [-port PORT] [--xml XMLOUTPUT] [--version] files [files ...]",
Expand All @@ -95,7 +96,10 @@ def __init__(self):
self._command_regex = re.compile(r'^(sudo wcscan|wcscan|\.\/wcscan).*?')

global current_path
self._output_file_path = os.path.join(self.data_path, "wcscan_output-%s.xml" % self._rid)
self._output_file_path = os.path.join(self.data_path,"%s_%s_output-%s.xml" % (self.ws,
self.id,
random.uniform(1,10)))


def canParseCommandString(self, current_input):
if self._command_regex.match(current_input.strip()):
Expand Down Expand Up @@ -152,8 +156,6 @@ def parseOutputString(self, output, debug=False):
severity=0)
del parser

if not debug:
os.remove(self._output_file_path)
return True

xml_arg_re = re.compile(r"^.*(--xml\s*[^\s]+).*$")
Expand Down
6 changes: 2 additions & 4 deletions plugins/repo/webfuzzer/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def __init__(self):
core.PluginBase.__init__(self)
self.id = "Webfuzzer"
self.name = "Webfuzzer Output Plugin"
self.plugin_version = "0.0.1"
self.plugin_version = "0.0.2"
self.version = "0.2.0"
self.options = None
self._current_output = None
Expand Down Expand Up @@ -149,9 +149,7 @@ def parseOutputString(self, output, debug = False):
n2_id = self.createAndAddNoteToNote(h_id,s_id,n_id,parser.hostname,"")

del parser

if not debug:
os.remove(self._output_path)

return True


Expand Down

0 comments on commit 4b8086c

Please sign in to comment.