Skip to content

Commit

Permalink
Merge pull request #18 from doronz88/feature/commands
Browse files Browse the repository at this point in the history
Feature/commands
  • Loading branch information
doronz88 authored Jul 15, 2020
2 parents 0024d7d + 148f054 commit b62d306
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ optional arguments:
```
## function-lines
```
usage: function-lines [-h]
usage: function-lines [-h] [--after]
get all function's lines
Expand All @@ -301,6 +301,7 @@ EXAMPLE:
optional arguments:
-h, --help show this help message and exit
--after include only function lines which occur after currentresultset
```
## function-start
```
Expand Down
13 changes: 10 additions & 3 deletions fa/commands/function_lines.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,23 @@ def get_parser():
p = utils.ArgumentParserNoExit('function-lines',
description=DESCRIPTION,
formatter_class=RawTextHelpFormatter)
p.add_argument('--after', action='store_true',
help='include only function lines which occur after current'
'resultset')
return p


@context.ida_context
@utils.yield_unique
def function_lines(addresses):
def function_lines(addresses, after=False):
for address in addresses:
for item in idautils.FuncItems(address):
yield item
if not after:
yield item
else:
if item > address:
yield item


def run(segments, args, addresses, interpreter=None, **kwargs):
return list(function_lines(addresses))
return list(function_lines(addresses, args.after))
5 changes: 4 additions & 1 deletion scripts/git/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def main():
'stops parsing current SIG if current ' \
'resultset is empty\n'

for filename in os.listdir(COMMANDS_ROOT):
commands = os.listdir(COMMANDS_ROOT)
commands.sort()

for filename in commands:
if filename.endswith('.py') and \
filename not in ('__init__.py',):
command = os.path.splitext(filename)[0]
Expand Down

0 comments on commit b62d306

Please sign in to comment.