Last active
September 12, 2022 10:46
-
-
Save kwilson7770/457650ca951e9e2c67f982a0e7b7e5c5 to your computer and use it in GitHub Desktop.
Installing mitmproxy on CentOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install CentOS-7-x86_64-Minimal-1804.iso, log in, and run these commands: | |
echo "Installing updates and packages..." | |
yum install -y -q epel-release | |
yum install -y -q nload vim nano wget chrony open-vm-tools unzip tcpdump mlocate net-tools nmap bind-utils | |
yum update -y | |
echo "Finished installing updates and packages..." | |
echo "Setting important variables for these commands..." | |
hostname="mitmproxy" | |
pythonpackage="rh-python36.x86_64" | |
#******** note the pythonpackage name was found by searching for it (need SCL repo) ******* | |
# yum search all python | grep \.x86_64 | grep 3 | grep python | less | |
pippackage="rh-python36-python-pip.noarch" | |
pipversion=3.6 | |
#******** note the pippackage name was found by searching for it (need SCL repo) ******* | |
# yum search all pip | grep python | grep pip | less | |
#******** note the following path was found after installing the above package. Recommend finding the correct path before installing ******* | |
python3path="/opt/rh/rh-python36/root/usr/bin/" | |
echo "Finished setting important variables for these commands..." | |
echo "Quick host config..." | |
echo "$hostname" > /etc/hostname | |
echo "Adding The Software Collections ( SCL ) Repository for the latest version of python packages" | |
yum install -y -q centos-release-scl | |
echo "Finished quick host config..." | |
echo "Installing python and pip..." | |
yum install -y -q $pythonpackage | |
yum install -y -q $pippackage | |
echo "adding python safely and permanently to PATH environment variable" | |
echo "pathmunge $python3path" > /etc/profile.d/python36.sh | |
echo "Finished installing python and pip..." | |
echo "Installing updates to pip and mitmproxy..." | |
echo reloading profile scripts for path statement updates | |
su - | |
pip$pipversion --version | |
pip$pipversion install --upgrade pip | |
pip$pipversion install mitmproxy | |
echo "Finished installing updates to pip and mitmproxy..." | |
echo "Configuring the firewall..." | |
firewall-cmd --zone=public --add-port=8080/tcp --permanent | |
firewall-cmd --reload | |
firewall-cmd --list-ports | |
echo "Finished configuring the firewall..." | |
echo "Creating simple script to run proxy on loop..." | |
echo 'CMD="mitmdump --mode transparent --no-http2 --ssl-insecure"; until eval $CMD; do echo "Proxy crashed with exit code $?, restarting...">&2; sleep 1; done' > ~/runMITMProxy.sh | |
chmod +x ~/runMITMProxy.sh | |
echo "Finished creating simple script to run proxy on loop..." | |
echo "Updating bashrc with export command to enable ssl key log file..." | |
echo 'export SSLKEYLOGFILE="/root/.mitmproxy/sslkeylogfile.txt"' >> /root/.bashrc | |
echo "Finished updating bashrc with export command to enable ssl key log file..." | |
echo "Rebooting in 5 seconds" | |
sleep 5 | |
reboot now |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment