Skip to content

Commit

Permalink
Merge pull request #129 from layderv/master
Browse files Browse the repository at this point in the history
#113 warn badbytes in input values
  • Loading branch information
sashs committed May 17, 2020
2 parents 75a9504 + 00e225d commit 11c3612
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ropper/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ def __printHelpText(self, cmd, desc):
def __printError(self, error):
self.__cprinter.printError(error)

def __printWarning(self, warning):
self.__cprinter.printWarning(warning)

def __printInfo(self, info):
self.__cprinter.printInfo(cstr(info))

Expand Down Expand Up @@ -344,6 +347,8 @@ def __search(self, filter, quality=None):

def __generateChain(self, command):
split = command.split(' ')
badbytes = self.__options.badbytes if self.__options.badbytes is not None else ''
value_with_badbytes = None
try:
old = self.__rs.options.color
generator = split[0]
Expand All @@ -354,6 +359,8 @@ def __generateChain(self, command):
raise RopperError('Wrong option format. An option has to be set in the following format: option=value')
key, value = option.split('=')
options[key] = value
if any(badbyte in value for badbyte in unhexlify(badbytes)):
value_with_badbytes = value
try:

self.__rs.options.color = False
Expand All @@ -366,6 +373,8 @@ def __generateChain(self, command):

self.__cprinter.println(chain)
# self.__printSeparator(before='\n\n')
if value_with_badbytes is not None:
self.__printWarning("The input value {} contains badbytes!".format(value_with_badbytes))
self.__printInfo('rop chain generated!')
except RopperError as e:
self.__rs.options.color = old
Expand Down Expand Up @@ -1146,6 +1155,9 @@ def printMessage(self, mtype, message):
def printError(self, message):
self.printMessage(cstr('[ERROR]', Color.RED), message)

def printWarning(self, message):
self.printMessage(cstr('[WARNING]', Color.YELLOW), message)

def printInfo(self, message):
self.printMessage(cstr('[INFO]', Color.GREEN), message)

Expand Down

0 comments on commit 11c3612

Please sign in to comment.