asbru-cm/asbru-cm

can't connect to host using Socks Proxy

4mig4 opened this issue · 0 comments

Made a connection using connection to a host through a SOCKS Proxy on 127.0.0.1 port 7576

and I get this error:

/bin/bash: line 1: P: command not found
Ncat: You must specify a host to connect to. QUITTING.
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535

The error happen in this : lib/asbru_conn , here :

 869 sub _getProxyCmd {
 870     my ($proxy_type, $proxy_ip, $proxy_port, $proxy_user, $proxy_pass) = @_;
 871 
 872     if ($proxy_user ne '') {
 873         if (system("$ENV{'ASBRU_ENV_FOR_EXTERNAL'} which ncat 1>/dev/null 2>&1") eq 0) {
 874             return "ncat --proxy $proxy_ip:$proxy_port --proxy-type $proxy_type --proxy-auth $proxy_user:$proxy_pass";
 875         }
 876         print("$COLOR{'err'}ERROR$COLOR{'norm'}: ncat is required if using proxy user/password.\nncat is part of the nmap project (https://nmap.org/ncat/).\n");
 877         die();
 878     } else {
 879         return "nc -x $proxy_ip:$proxy_port";
 880     }
 881 }

here is the fix , I added \"$proxy_pass\" because yes passwords can and will contains funky characters

 869 sub _getProxyCmd {
 870     my ($proxy_type, $proxy_ip, $proxy_port, $proxy_user, $proxy_pass) = @_;
 871 
 872     if ($proxy_user ne '') {
 873         if (system("$ENV{'ASBRU_ENV_FOR_EXTERNAL'} which ncat 1>/dev/null 2>&1") eq 0) {
 874             return "ncat --proxy $proxy_ip:$proxy_port --proxy-type $proxy_type --proxy-auth $proxy_user:\"$proxy_pass\"";
 875         }
 876         print("$COLOR{'err'}ERROR$COLOR{'norm'}: ncat is required if using proxy user/password.\nncat is part of the nmap project (https://nmap.org/ncat/).\n");
 877         die();
 878     } else {
 879         return "nc -x $proxy_ip:$proxy_port";
 880     }
 881 }




 - OS: Ubuntu 22.04.3 LTS
 - Ásbrú Version 6.4.0