mandiant / flare-fakenet-ng

FakeNet-NG - Next Generation Dynamic Network Analysis Tool
Apache License 2.0
1.73k stars 357 forks source link

IP address not declared soon enough when DivertTraffic: No #167

Open thejoelpatrol opened 10 months ago

thejoelpatrol commented 10 months ago

OS: Ubuntu 20.04 Python: 3.8.10 VM: VMWare Workstation 16 Latest commit: ac33a706274d3e567080d261f7886fd472378ffa Steps to reproduce:

  1. Edit config to set DivertTraffic: No
  2. Launch Fakenet

This can be fixed by moving this to line 139: https://github.com/mandiant/flare-fakenet-ng/blob/ac33a706274d3e567080d261f7886fd472378ffa/fakenet/fakenet.py#L158

Note that the same bug also reproduces on Windows with an older version of Fakenet on Python 2.7, I just happened to trigger it on Ubuntu

  ______      _  ________ _   _ ______ _______     _   _  _____
 |  ____/\   | |/ /  ____| \ | |  ____|__   __|   | \ | |/ ____|
 | |__ /  \  | ' /| |__  |  \| | |__     | |______|  \| | |  __
 |  __/ /\ \ |  < |  __| | . ` |  __|    | |______| . ` | | |_ |
 | | / ____ \| . \| |____| |\  | |____   | |      | |\  | |__| |
 |_|/_/    \_\_|\_\______|_| \_|______|  |_|      |_| \_|\_____|

                        Version 3.0 (alpha)
  _____________________________________________________________
                   Developed by FLARE Team
    Copyright (C) 2016-2022 Mandiant, Inc. All rights reserved.
  _____________________________________________________________

08/18/23 09:39:50 AM [           FakeNet] Loaded configuration file: /usr/local/lib/python3.8/dist-packages/fakenet/configs/default.ini
Traceback (most recent call last):
  File "/usr/local/bin/fakenet", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/fakenet/fakenet.py", line 420, in main
    fakenet.start()
  File "/usr/local/lib/python3.8/dist-packages/fakenet/fakenet.py", line 213, in start
    listener_config['ipaddr'] = fn_addr
UnboundLocalError: local variable 'fn_addr' referenced before assignment