viper-framework / viper

Binary analysis and management framework
Other
1.54k stars 353 forks source link

update-modules fails when behind a http proxy #770

Closed Stean closed 4 years ago

Stean commented 4 years ago

When I tried to update the viper modules after a fresh installation in my 2019.3 Kali VM, viper failed with the error message FileNotFoundError: [Errno 2] No such file or directory: '/root/.viper/modules': '/root/.viper/modules'

Terminal-Output:

# viper -f my_file.pdf 
[*] Session opened on my_file.pdf
         _
        (_)
   _   _ _ ____  _____  ____
  | | | | |  _ \| ___ |/ ___)
   \ V /| | |_| | ____| |
    \_/ |_|  __/|_____)_| v2.0-rc6
          |_|

You have 0 files in your default repository.

You do not have any modules installed!
If you wish to download community modules from GitHub run:
    update-modules
viper my_file.pdf [not stored] > update-modules
[*] Updating modules...
Klone nach 'modules' ...
ssh: Could not resolve hostname github.com: Name or service not known
fatal: Konnte nicht vom Remote-Repository lesen.

Bitte stellen Sie sicher, dass die korrekten Zugriffsberechtigungen bestehen
und das Repository existiert.
[!] The command update-modules raised an exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/viper/core/ui/console.py", line 315, in start
    self.cmd.commands[root]["obj"](*args)
  File "/usr/local/lib/python3.7/dist-packages/viper/core/ui/cmd/update-modules.py", line 36, in run
    p = subprocess.Popen(["git", "submodule", "init"], cwd=dot_viper_modules)
  File "/usr/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/root/.viper/modules': '/root/.viper/modules'

When I looked into the source code I quickly found out the reason for this message: In viper/core/ui/cmd/update-modules.py the command git clone is being used in conjunction with SSH as transport protocol. https://github.com/viper-framework/viper/blob/dfadd1a8dfe429f450790f002dfb877e4d08c978/viper/core/ui/cmd/update-modules.py#L31

Since I'm sitting behind a corporate proxy, the SSH connection fails after some seconds. However, because the success of the command isn't checked, the following code will be executed, which assumes that the previous git clone command succeeded and thereby tries to execute git submodule init within the (non-existing) $HOME/.viper/modules directory, which fails with a FileNotFoundError.

Does something speak against simply using HTTP as transport protocol for the (read-only) git clone command?

botherder commented 4 years ago

Not at all. It was my overlook. I was just about to fix this myself. Thanks.