Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bryant1410/set-proxy
Script that sets env variables for proxy depending on the configured subnets
https://github.com/bryant1410/set-proxy
Last synced: 24 days ago
JSON representation
Script that sets env variables for proxy depending on the configured subnets
- Host: GitHub
- URL: https://github.com/bryant1410/set-proxy
- Owner: bryant1410
- License: apache-2.0
- Created: 2015-09-13T17:02:45.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-24T16:16:34.000Z (over 8 years ago)
- Last Synced: 2024-10-29T15:15:01.289Z (2 months ago)
- Language: Python
- Homepage:
- Size: 7.81 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# set-proxy
Script that sets env variables for proxy depending on the configured subnets.
## Installation
Thi script is for Linux. Python 3, pip and some Python packages are needed. You can install it in Ubuntu (or Debian based) running:
```bash
sudo apt-get install python3 python3-pip
sudo pip3 install netaddr netifaces
```In Fedora (or RedHat based) you need to run:
```bash
sudo yum install python3 python3-pip
sudo pip3 install netaddr netifaces
```To install the script just clone the repo in your home and add an alias for quick execution. Add it to `~/.bashrc` so it's ran at the beginning of every non-login interactive shell:
```bash
cd ~
git clone https://github.com/bryant1410/set-proxy.git .set-proxy
echo 'alias set-proxy="source $HOME/.set-proxy/set_proxy.sh"' >> ~/.bashrc
echo 'set-proxy' >> ~/.bashrc
```Start a new shell in order to see the changes.
To run it whenever you want, do:
```
set-proxy
```## Configuration
By default, it sets the proxy `proxy.fing.edu.uy:3128` if under subnet 164.0.0.0/8 in `eth0` or `wlan0`. You can change the subnets and interfaces in the file `check_subnet.py` and the proxy configuration in `set_proxy.sh`.
In order to keep these environment variables in sudo, run the following:
```bash
sudo visudo
```Then add the line:
```bash
Defaults env_keep += "ftp_proxy http_proxy https_proxy no_proxy"
```