Категория: Компьютерные сети

Кол-во просмотров: 1006

Теги: #linux


Создаем собственный приватный прокси сервер SOCKS5

proxy socks 5 python script install for server

видео:

 

python скрипт в github.com

https://github.com/hensly/socks5

1. referral link for DigitalOcean
         https://m.do.co/c/25a7f93236fc

2. create server Debian

3. upload file to server
         https://raw.githubusercontent.com/hensly/socks5/master/proxy.py

4.  run
          python proxy.py

5.  type your password for proxy
          wait for the installation to complete

Python скрипт установки 

# -*- coding: utf-8 -*-
# author Dinar Ahmetshin 
# site https://ahmetshin.com
import sys 
import os

def main():
    username="userproxy"
    try:
        password_proxy =raw_input("type your password here: ")
    except:
        password_proxy =input("type your password here: ")
    os.system("apt-get update")
    os.system("apt-get -y install build-essential libwrap0-dev libpam0g-dev libkrb5-dev libsasl2-dev")
    os.system("wget --no-check-certificate https://ahmetshin.com/static/dante.tgz")
    os.system("tar -xvpzf dante.tgz")
    os.system("apt-get -y install libwrap0 libwrap0-dev")
    os.system("apt-get -y install gcc make")
    os.system("mkdir /home/dante")
    os.system("""cd dante && ./configure --prefix=/home/dante && make && make install""")
    os.system("""
            echo '
            logoutput: syslog /var/log/danted.log
            internal: eth0 port = 1080
            external: eth0
             
            socksmethod: username
            user.privileged: root
            user.unprivileged: nobody
             
            client pass {
                from: 0.0.0.0/0 to: 0.0.0.0/0
                log: error
            }
             
            socks pass {
                from: 0.0.0.0/0 to: 0.0.0.0/0
                command: connect
                log: error
                method: username
            }' > /home/dante/danted.conf
                """)
    os.system("useradd --shell /usr/sbin/nologin -m %s" % username)
    os.system('echo "%s:%s" | chpasswd' % (username,password_proxy))
    os.system("apt-get -y install ufw")
    os.system("ufw status")
    os.system("ufw allow ssh")
    os.system("ufw allow proto tcp from any to any port 1080")
    os.system("ufw status numbered")
    os.system("echo 'y' | ufw enable")
    os.system("""
echo '#!/bin/sh -e
sleep 20
/home/dante/sbin/sockd -f /home/dante/danted.conf -D
exit 0
' > /etc/rc.local
""")
    os.system("chmod +x /etc/rc.local")
    os.system("chmod +x /home/dante/sbin/sockd")
    os.system("/home/dante/sbin/sockd -f /home/dante/danted.conf -D")
    os.system("echo 'proxy install success'")
    os.system("echo ' '")
    os.system("echo '________________________________'")
    os.system("echo ' '")
    os.system("echo \"YOUR IP ADDRESS: `hostname -I | awk '{print $1}'`\"")
    os.system("echo 'PORT: 1080'")
    os.system("echo 'LOGIN: %s'" % username)
    os.system("echo 'PASSWORD: %s'" % password_proxy)

if __name__ == "__main__":
    main()

 

Категория: Компьютерные сети

Кол-во просмотров: 1006

Дата создания: 12 декабря 2019 г.

Теги: #linux