Use proxy with wget on the fly - proxy

I know that if I want to use a proxy with wget, I have to edit /etc/wgetrc or ~/.wgetrc file and set there the proxy address and port.
What I want to know if is there any option to use wget and use a proxy BUT without editing any config file.
That's all. Thanks.

You can pass the proxy settings via the environment, e.g.:
https_proxy=http://proxy.example.com:3128 wget http://www.example.com

Related

Programmatic ngrok tunnel url

I'm trying to get ngrok's dynamically generated IP address programmatically by using bash to set globals and env variables.
Below is what I have so far.
Run ngrok http {server url}
Inside your host root directory run:
curl http://localhost:4040/api/tunnels > ~/ngrok_tunnels.json;
Install jq
Brew install [jq](https://stedolan.github.io/jq/) (let's you access json through bash)
Afterwards you just need to access this json following jq's docs.
Inside the project root that is calling the dev URL. [0]=(http) [1]=(https)
echo “NGROK_TUNNEL=$(jq .tunnels[1].public_url ~/ngrok_tunnels.json
)" >> .env
Set all of your dev urls to process.env.NGROK_TUNNEL
So this works, but is it the "best way" to do this?
For people who want to get a url through ngrok using python there is the pyngrok library
from pyngrok import ngrok
#Open a HTTP tunnel on the default port 80
#<NgrokTunnel: "http://<public_sub>.ngrok.io" -> "http://localhost:80">
http_tunnel = ngrok.connect()
#Open a SSH tunnel
#<NgrokTunnel: "tcp://0.tcp.ngrok.io:12345" -> "localhost:22">
ssh_tunnel = ngrok.connect(22, "tcp")
it is also possible to do some things directly via the ngrok API. I didn't find the option to create a tunnel, but having a tunnel created you can restart it or update it
https://ngrok.com/docs/api#api-tunnel-sessions-list
The short answer is yes.
You can upgrade to a paid plan and use the --subdomain argument to get the same ngrok url every time. The next price level from that includes white labeling where you can use your own custom domain as well.

How to avoid storing proxy password in TortoiseHG configuration file?

Currently I have a Mercurial.ini configuration which contains the following http_proxy section:
[http_proxy]
host = proxy.example.com
user = john_doe
passwd = super_secure_password
Is there any way for TortoiseHG or Mercurial to prompt the user for the proxy credentials and then store them in a secure file? Something like the functionality of the mercurial keyring extension. We would prefer that the password super_secure_password not be stored in a human-readable file that anyone can open.
See https://stackoverflow.com/a/2061584/320456 which proposes installing the cntlm proxy locally as a workaround; Does git clone work through NTLM proxies? also mentions NTLM APS.

acess ftp with wget through proxy

i am currently stuck at a problem, that i think if i use a proxy, wget tries to connect to the server via http instead of ftp. Since i cannot post the full settings i will post an example of the behaviour I see:
Accessing the ftp server without a proxy works using the command:
wget -r --user=username --password=mypassord ftp://ftp.myadress.com/
works as expected.
Accessing the ftp server with
wget -r --ftp-user=username --ftp-password=mypassord ftp://ftp.myadress.com/
works too.
Accessing the server with proxy and
wget -r --ftp-user=username --ftp-password=mypassord ftp://ftp.myadress.com/
leads to a
401 Unauthorized
error.
Using
wget -r --user=username --password=mypassord ftp://ftp.myadress.com/
leads to an index.html to be created. Unfortunately, the ftp server does not have any index.html files in the folders. Accessing a file with its full path through the proxy via
wget --user=username --password=mypassord ftp://ftp.myadress.com/test/test.txt
downloads the file as expected.
Accessing a different ftp server through the same proxy, which has an index.html in every folder with the command:
wget -r --user=username2 --password=mypassord2 ftp://ftp.myadress2.com/
works fine.
So how can i force wget to use the ftp protocol through the proxy?
Thanks in advance
Have you tried to put the proxy settings into a .wgetrc file instead?
It should contain something similar:
use_proxy=yes
http_proxy=127.0.0.1:8080

Not able to connect to atom.io for themes and packages

I believe my work proxy is preventing me from being able to add themes and packages to Atom. From the preferences menu, I get:
Fetching featured packages and themes failed. Hide output…
tunneling socket could not be established, cause=140499728967552:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:766:
Is it possible to make it use my $https_proxy variable? Is there some way to configure it to not use https?
You can configure your proxy settings in ~/.atom/.apmrc (or Atom\resources\app\apm\node_modules\atom-package-manager\.apmrc in Windows). Per the apm README:
If you are using a proxy you can configure apm to use it by setting the https-proxy config in your ~/.atom/.apmrc file like so:
https-proxy = https://9.0.2.1:0
It seems that as of Atom 1.0, there are some components that respect the http-proxy and https-proxy variables, and others that don't. For example, the initial check for the version of Atom works, but the check for packages doesn't seem to respect the http-proxy or https-proxy settings.
I was able to get Atom working with Fiddler as my proxy (on 127.0.0.1:8888) by running the following commands (on Windows):
apm config set proxy http://127.0.0.1:8888
apm config set strict-ssl false
I did not need to set http-proxy or https-proxy. I don't know if these settings have been deprecated or not, but they don't seem to work reliably in 1.0. The setting proxy works (and upgrades itself to TLS 1.2 automatically).
The entirety of my %USERPROFILE%\.atom\.apmrc file is:
strict-ssl=false
proxy=http://127.0.0.1:8888/
I was getting this error on Windows 7 fro Atom 1.0, when trying to look up packages.
In my case the issue was resolved by setting https-proxy variable to use http protocole instead of https. so both of the following parameters have exact same value.
here are the values from ~.atom.apmrc file
proxy=http://[host]:[port]/
https-proxy=http://[host]:[port]/
the answer by #NYCdotNet below that suggested to use
strict-ssl=false
didn't work as i was able to lookup some packages but installation failed with timeout error from GIT.
Atom will use your shell's proxy variables (like $https_proxy) if you start Atom from a shell that has these variables set. You need to have the Atom command line tools installed for that to work.
From a shell, you can simply type atom to open the editor for the current directory. It will use all environment variables from this shell, including the proxy variables.
I find this a lot easier than setting the variables in the config file.
I edited the ~/.atom/.apmrc file to set my proxy as mentioned by #AlexMooney, but still got errors.
The solution was to write
proxy = http://host:port
strict-ssl = false
in that ~/.atom/.apmrc file.
For Windows you can easily configure the https-proxy via command line:
amd config set https-proxy https://9.0.2.1:0
It should be stored under C:\Users\...\.apm in file .apmrc
See userconfig with command
amd config list
To config Proxy for Atom to install new pakage, just open CMD and run these commands:
apm config set strict-ssl false
apm config set proxy your_proxy
apm config set your_proxy
I am working behind a proxy server and spent about half a day on this issue, setting https_proxy as well as http_proxy didn't make a difference.
What did it for me was setting the proxy from the cmd line like so:
apm config set proxy http://myproxyaddress:port
I still can't install packages through Atom's gui, but doing it through the cmd line works fine. That I'll take.
I later realised I could've switched to the wifi and got it to work immediately...

proxy and php scripts

It is probably a simple question but I dont know how to solve my problem.
There is a proxy on the network I am using. I execute php scripts on command line (composer.phar not to same the name). The script, using curl obviously, try to download file from http urls. I cannot download because of the proxy.
So my question is this one :
where should I configure proxy settings to use a tool like composer.phar ?
Maybe the command line is not the problem and I would have the same problem if I were using curl in an application.
Thank you
I have to add a HTTP_PROXY system environment variable to make it work

Resources