This repository has been archived by the owner on Nov 29, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 36
Niceness #109
Merged
Merged
Niceness #109
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d2a1dc1
Add niceness argument.
jjnicola e852a70
Pass the niceness value to the OSPD base class.
jjnicola 9682ca6
Update ospd test.
jjnicola 2c782ac
Pass the niceness value to the OSPD SSH class.
jjnicola f6f4ad0
Update test
jjnicola 14c192c
Use default int type and remove the own define type 'niceness'.
jjnicola e1995b0
Make niceness an optional
jjnicola b9f5b5c
Use lowercase for _niceness variable.
jjnicola 9392f00
Make niceness optional in OSPDaemonSimpleSSH class.
jjnicola 96d409a
Update ospd/misc.py
jjnicola File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 | ||||
---|---|---|---|---|---|---|
|
@@ -200,7 +200,7 @@ class OSPDaemon(object): | |||||
specific options eg. the w3af profile for w3af wrapper. | ||||||
""" | ||||||
|
||||||
def __init__(self, certfile, keyfile, cafile, | ||||||
def __init__(self, certfile, keyfile, cafile, niceness, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personally I would make niceness optional
Suggested change
|
||||||
customvtfilter=None, wrapper_logger=None): | ||||||
""" Initializes the daemon's internal data. """ | ||||||
# @todo: Actually it makes sense to move the certificate params to | ||||||
|
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 | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -77,11 +77,13 @@ class OSPDaemonSimpleSSH(OSPDaemon): | |||||||
an array. | ||||||||
""" | ||||||||
|
||||||||
def __init__(self, certfile, keyfile, cafile): | ||||||||
def __init__(self, certfile, keyfile, cafile, niceness): | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just this single change is missing to make niceness optional here too
Suggested change
|
||||||||
""" Initializes the daemon and add parameters needed to remote SSH execution. """ | ||||||||
|
||||||||
super(OSPDaemonSimpleSSH, self).__init__(certfile=certfile, keyfile=keyfile, | ||||||||
cafile=cafile) | ||||||||
cafile=cafile, niceness=niceness) | ||||||||
|
||||||||
self.NICENESS = niceness | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any reason why self.NICENESS is all uppercase here? I would mark it as a private variable by using
Suggested change
|
||||||||
|
||||||||
if paramiko is None: | ||||||||
raise ImportError('paramiko needs to be installed in order to use' | ||||||||
|
@@ -140,6 +142,7 @@ def run_command(self, scan_id, host, cmd): | |||||||
self.add_scan_error(scan_id, host=host, value=str(err)) | ||||||||
return None | ||||||||
|
||||||||
cmd = "nice -n %s %s" % (self.NICENESS, cmd) | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
_, stdout, _ = ssh.exec_command(cmd) | ||||||||
result = stdout.readlines() | ||||||||
ssh.close() | ||||||||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any reason for defining an own type instead using the default int type https://docs.python.org/3/library/argparse.html#type ?