-
Notifications
You must be signed in to change notification settings - Fork 36
Conversation
Add the --niceness option. Each scan will be run with the set niceness. Default is 10.
Codecov Report
@@ Coverage Diff @@
## master #109 +/- ##
==========================================
+ Coverage 68.07% 68.19% +0.11%
==========================================
Files 8 8
Lines 1604 1610 +6
==========================================
+ Hits 1092 1098 +6
Misses 512 512
Continue to review full report at Codecov.
|
ospd/misc.py
Outdated
@@ -868,6 +878,9 @@ def filename(string): | |||
help='Path to the logging file.') | |||
parser.add_argument('--version', action='store_true', | |||
help='Print version then exit.') | |||
parser.add_argument('--niceness', default=NICENESS, type=niceness, |
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 ?
ospd/ospd.py
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Personally I would make niceness optional
def __init__(self, certfile, keyfile, cafile, niceness, | |
def __init__(self, certfile, keyfile, cafile, niceness=None, |
ospd/ospd_ssh.py
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
cmd = "nice -n %s %s" % (self.NICENESS, cmd) | |
if self.NICENESS is not None: | |
cmd = "nice -n %s %s" % (self.NICENESS, cmd) |
ospd/ospd_ssh.py
Outdated
cafile=cafile) | ||
cafile=cafile, niceness=niceness) | ||
|
||
self.NICENESS = niceness |
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.
Any reason why self.NICENESS is all uppercase here? I would mark it as a private variable by using
self.NICENESS = niceness | |
self._niceness = niceness |
ospd/ospd_ssh.py
Outdated
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Just this single change is missing to make niceness optional here too
def __init__(self, certfile, keyfile, cafile, niceness): | |
def __init__(self, certfile, keyfile, cafile, niceness=None): |
Co-Authored-By: Björn Ricks <[email protected]>
Add the --niceness option. Each scan will be run with the passed niceness.
Default is 10.