Skip to content

Commit

Permalink
Refactoring main() function
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Roth committed Feb 13, 2018
1 parent 538af8e commit dfa90d1
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions loki.py
Original file line number Diff line number Diff line change
Expand Up @@ -1389,18 +1389,11 @@ def signal_handler(signal_name, frame):
print 'LOKI\'s work has been interrupted by a human. Returning to Asgard.'
sys.exit(0)


# MAIN ################################################################
if __name__ == '__main__':

# Signal handler for CTRL+C
signal_module.signal(signal_module.SIGINT, signal_handler)

# Computername
if os_platform == "linux" or os_platform == "osx":
t_hostname = os.uname()[1]
else:
t_hostname = os.environ['COMPUTERNAME']
def main():
"""
Argument parsing function
:return:
"""

# Parse Arguments
parser = argparse.ArgumentParser(description='Loki - Simple IOC Scanner')
Expand Down Expand Up @@ -1430,6 +1423,17 @@ def signal_handler(signal_name, frame):

args = parser.parse_args()

return args

# MAIN ################################################################
if __name__ == '__main__':

# Signal handler for CTRL+C
signal_module.signal(signal_module.SIGINT, signal_handler)

# Argument parsing
args = main()

# Remove old log file
if os.path.exists(args.l):
os.remove(args.l)
Expand Down

0 comments on commit dfa90d1

Please sign in to comment.