├── 2.png
├── go.sh
├── nf.sh
├── ssrmu
├── wg.sh
├── xp.sh
├── bckp.sh
├── bot.zip
├── cek.sh
├── edu.sh
├── info.sh
├── mdns.sh
├── menu.sh
├── mss.sh
├── mssh.sh
├── mssr.sh
├── mwg.sh
├── ohp.sh
├── ssr.sh
├── strt.sh
├── vpn.sh
├── vpn.zip
├── about.sh
├── add-ss.sh
├── add-ssr.sh
├── add-tr.sh
├── add-wg.sh
├── add-ws.sh
├── backup.sh
├── cek-ss.sh
├── cek-tr.sh
├── cek-wg.sh
├── cek-ws.sh
├── ceklim.sh
├── change.sh
├── del-ss.sh
├── del-ssr.sh
├── del-tr.sh
├── del-wg.sh
├── del-ws.sh
├── delete.sh
├── hapus.sh
├── ins-vt.sh
├── m-bot.zip
├── member.sh
├── mgrpc.sh
├── msystem.sh
├── mtrojan.sh
├── mvless.sh
├── mvmess.sh
├── mxtls.sh
├── port-tr.sh
├── port-wg.sh
├── port-ws.sh
├── renew.sh
├── restart.sh
├── restore.sh
├── set-br.sh
├── setup.sh
├── sodosok.sh
├── ssh-vpn.sh
├── ssrmu.sh
├── status.sh
├── tendang.sh
├── trial.sh
├── usernew.sh
├── webmin.sh
├── add-grpc.sh
├── add-host.sh
├── add-vless.sh
├── add-xtls.sh
├── autokill.sh
├── cek-grpc.sh
├── cek-vless.sh
├── cek-xtls.sh
├── del-grpc.sh
├── del-vless.sh
├── del-xtls.sh
├── mxraycore.sh
├── ohpserver.sh
├── port-grpc.sh
├── port-ovpn.sh
├── port-ssl.sh
├── port-xtls.sh
├── renew-ss.sh
├── renew-ssr.sh
├── renew-tr.sh
├── renew-wg.sh
├── renew-ws.sh
├── websocket.sh
├── add-rvless.sh
├── add-xvless.sh
├── add-xvmess.sh
├── autobackup.sh
├── badvpn-udpgw64
├── cek-xvless.sh
├── cek-xvmess.sh
├── checksystem.sh
├── del-xvless.sh
├── del-xvmess.sh
├── install-xray.sh
├── limit-speed.sh
├── mv2raycore.sh
├── port-squid.sh
├── port-vless.sh
├── port-xvless.sh
├── port-xvmess.sh
├── renew-grpc.sh
├── renew-vless.sh
├── renew-xtls.sh
├── renew-xvless.sh
├── renew-xvmess.sh
├── autobackupmenu.sh
├── portsshnontls.sh
├── setbackuptime.sh
├── speedtest_cli.py
├── change_timezone.sh
├── reboot_sys_auto.sh
├── recert-xrayv2ray.sh
├── ddos-deflate-master.zip
├── rclone.conf
├── vps.conf
├── issue.net
├── squid3.conf
├── nginx.conf
├── password
├── README.md
├── ws-stunnel
├── proxy-template.py
├── edu-op.py
└── ram.sh
/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/2.png
--------------------------------------------------------------------------------
/go.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/go.sh
--------------------------------------------------------------------------------
/nf.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/nf.sh
--------------------------------------------------------------------------------
/ssrmu:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ssrmu
--------------------------------------------------------------------------------
/wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/wg.sh
--------------------------------------------------------------------------------
/xp.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/xp.sh
--------------------------------------------------------------------------------
/bckp.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/bckp.sh
--------------------------------------------------------------------------------
/bot.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/bot.zip
--------------------------------------------------------------------------------
/cek.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek.sh
--------------------------------------------------------------------------------
/edu.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/edu.sh
--------------------------------------------------------------------------------
/info.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/info.sh
--------------------------------------------------------------------------------
/mdns.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mdns.sh
--------------------------------------------------------------------------------
/menu.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/menu.sh
--------------------------------------------------------------------------------
/mss.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mss.sh
--------------------------------------------------------------------------------
/mssh.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mssh.sh
--------------------------------------------------------------------------------
/mssr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mssr.sh
--------------------------------------------------------------------------------
/mwg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mwg.sh
--------------------------------------------------------------------------------
/ohp.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ohp.sh
--------------------------------------------------------------------------------
/ssr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ssr.sh
--------------------------------------------------------------------------------
/strt.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/strt.sh
--------------------------------------------------------------------------------
/vpn.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/vpn.sh
--------------------------------------------------------------------------------
/vpn.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/vpn.zip
--------------------------------------------------------------------------------
/about.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/about.sh
--------------------------------------------------------------------------------
/add-ss.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-ss.sh
--------------------------------------------------------------------------------
/add-ssr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-ssr.sh
--------------------------------------------------------------------------------
/add-tr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-tr.sh
--------------------------------------------------------------------------------
/add-wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-wg.sh
--------------------------------------------------------------------------------
/add-ws.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-ws.sh
--------------------------------------------------------------------------------
/backup.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/backup.sh
--------------------------------------------------------------------------------
/cek-ss.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-ss.sh
--------------------------------------------------------------------------------
/cek-tr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-tr.sh
--------------------------------------------------------------------------------
/cek-wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-wg.sh
--------------------------------------------------------------------------------
/cek-ws.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-ws.sh
--------------------------------------------------------------------------------
/ceklim.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ceklim.sh
--------------------------------------------------------------------------------
/change.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/change.sh
--------------------------------------------------------------------------------
/del-ss.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-ss.sh
--------------------------------------------------------------------------------
/del-ssr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-ssr.sh
--------------------------------------------------------------------------------
/del-tr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-tr.sh
--------------------------------------------------------------------------------
/del-wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-wg.sh
--------------------------------------------------------------------------------
/del-ws.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-ws.sh
--------------------------------------------------------------------------------
/delete.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/delete.sh
--------------------------------------------------------------------------------
/hapus.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/hapus.sh
--------------------------------------------------------------------------------
/ins-vt.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ins-vt.sh
--------------------------------------------------------------------------------
/m-bot.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/m-bot.zip
--------------------------------------------------------------------------------
/member.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/member.sh
--------------------------------------------------------------------------------
/mgrpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mgrpc.sh
--------------------------------------------------------------------------------
/msystem.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/msystem.sh
--------------------------------------------------------------------------------
/mtrojan.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mtrojan.sh
--------------------------------------------------------------------------------
/mvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mvless.sh
--------------------------------------------------------------------------------
/mvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mvmess.sh
--------------------------------------------------------------------------------
/mxtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mxtls.sh
--------------------------------------------------------------------------------
/port-tr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-tr.sh
--------------------------------------------------------------------------------
/port-wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-wg.sh
--------------------------------------------------------------------------------
/port-ws.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-ws.sh
--------------------------------------------------------------------------------
/renew.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew.sh
--------------------------------------------------------------------------------
/restart.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/restart.sh
--------------------------------------------------------------------------------
/restore.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/restore.sh
--------------------------------------------------------------------------------
/set-br.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/set-br.sh
--------------------------------------------------------------------------------
/setup.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/setup.sh
--------------------------------------------------------------------------------
/sodosok.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/sodosok.sh
--------------------------------------------------------------------------------
/ssh-vpn.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ssh-vpn.sh
--------------------------------------------------------------------------------
/ssrmu.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ssrmu.sh
--------------------------------------------------------------------------------
/status.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/status.sh
--------------------------------------------------------------------------------
/tendang.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/tendang.sh
--------------------------------------------------------------------------------
/trial.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/trial.sh
--------------------------------------------------------------------------------
/usernew.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/usernew.sh
--------------------------------------------------------------------------------
/webmin.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/webmin.sh
--------------------------------------------------------------------------------
/add-grpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-grpc.sh
--------------------------------------------------------------------------------
/add-host.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-host.sh
--------------------------------------------------------------------------------
/add-vless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-vless.sh
--------------------------------------------------------------------------------
/add-xtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-xtls.sh
--------------------------------------------------------------------------------
/autokill.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/autokill.sh
--------------------------------------------------------------------------------
/cek-grpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-grpc.sh
--------------------------------------------------------------------------------
/cek-vless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-vless.sh
--------------------------------------------------------------------------------
/cek-xtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-xtls.sh
--------------------------------------------------------------------------------
/del-grpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-grpc.sh
--------------------------------------------------------------------------------
/del-vless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-vless.sh
--------------------------------------------------------------------------------
/del-xtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-xtls.sh
--------------------------------------------------------------------------------
/mxraycore.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mxraycore.sh
--------------------------------------------------------------------------------
/ohpserver.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ohpserver.sh
--------------------------------------------------------------------------------
/port-grpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-grpc.sh
--------------------------------------------------------------------------------
/port-ovpn.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-ovpn.sh
--------------------------------------------------------------------------------
/port-ssl.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-ssl.sh
--------------------------------------------------------------------------------
/port-xtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-xtls.sh
--------------------------------------------------------------------------------
/renew-ss.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-ss.sh
--------------------------------------------------------------------------------
/renew-ssr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-ssr.sh
--------------------------------------------------------------------------------
/renew-tr.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-tr.sh
--------------------------------------------------------------------------------
/renew-wg.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-wg.sh
--------------------------------------------------------------------------------
/renew-ws.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-ws.sh
--------------------------------------------------------------------------------
/websocket.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/websocket.sh
--------------------------------------------------------------------------------
/add-rvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-rvless.sh
--------------------------------------------------------------------------------
/add-xvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-xvless.sh
--------------------------------------------------------------------------------
/add-xvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/add-xvmess.sh
--------------------------------------------------------------------------------
/autobackup.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/autobackup.sh
--------------------------------------------------------------------------------
/badvpn-udpgw64:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/badvpn-udpgw64
--------------------------------------------------------------------------------
/cek-xvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-xvless.sh
--------------------------------------------------------------------------------
/cek-xvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/cek-xvmess.sh
--------------------------------------------------------------------------------
/checksystem.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/checksystem.sh
--------------------------------------------------------------------------------
/del-xvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-xvless.sh
--------------------------------------------------------------------------------
/del-xvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/del-xvmess.sh
--------------------------------------------------------------------------------
/install-xray.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/install-xray.sh
--------------------------------------------------------------------------------
/limit-speed.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/limit-speed.sh
--------------------------------------------------------------------------------
/mv2raycore.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/mv2raycore.sh
--------------------------------------------------------------------------------
/port-squid.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-squid.sh
--------------------------------------------------------------------------------
/port-vless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-vless.sh
--------------------------------------------------------------------------------
/port-xvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-xvless.sh
--------------------------------------------------------------------------------
/port-xvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/port-xvmess.sh
--------------------------------------------------------------------------------
/renew-grpc.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-grpc.sh
--------------------------------------------------------------------------------
/renew-vless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-vless.sh
--------------------------------------------------------------------------------
/renew-xtls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-xtls.sh
--------------------------------------------------------------------------------
/renew-xvless.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-xvless.sh
--------------------------------------------------------------------------------
/renew-xvmess.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/renew-xvmess.sh
--------------------------------------------------------------------------------
/autobackupmenu.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/autobackupmenu.sh
--------------------------------------------------------------------------------
/portsshnontls.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/portsshnontls.sh
--------------------------------------------------------------------------------
/setbackuptime.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/setbackuptime.sh
--------------------------------------------------------------------------------
/speedtest_cli.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/speedtest_cli.py
--------------------------------------------------------------------------------
/change_timezone.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/change_timezone.sh
--------------------------------------------------------------------------------
/reboot_sys_auto.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/reboot_sys_auto.sh
--------------------------------------------------------------------------------
/recert-xrayv2ray.sh:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/recert-xrayv2ray.sh
--------------------------------------------------------------------------------
/ddos-deflate-master.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/HEAD/ddos-deflate-master.zip
--------------------------------------------------------------------------------
/rclone.conf:
--------------------------------------------------------------------------------
1 | [dr]
2 | type = drive
3 | scope = drive
4 | token = {"access_token":"ya29.a0ARrdaM-z_wuw6FOhmYz9xDu-LftCZQBfjU6RTUR_AoyggaJIKqVKgEthWvRzeV1_LGj97ENJFX7p8RJGAFix8DVEmunm96xrp3qFWpTnDGWBJJ4_S7o3GxRQp6Bcmup3uj2z3YwVpVj-e7FdcTlp9VNFEMHEp9o","token_type":"Bearer","refresh_token":"1//0gkrI4gJCZwVgCgYIARAAGBASNwF-L9IriI_ksnYocfyC__n5XIlRxpn-YuyNA7gNNb22ktXea2D18f3NCaqFHc7U4CcA1G6h2RY","expiry":"2021-08-14T01:10:02.262236092+08:00"}
5 |
6 |
--------------------------------------------------------------------------------
/vps.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 81;
3 | server_name 127.0.0.1 localhost;
4 | access_log /var/log/nginx/vps-access.log;
5 | error_log /var/log/nginx/vps-error.log error;
6 | root /home/vps/public_html;
7 |
8 | location / {
9 | index index.html index.htm index.php;
10 | try_files $uri $uri/ /index.php?$args;
11 | }
12 |
13 | location ~ \.php$ {
14 | include /etc/nginx/fastcgi_params;
15 | fastcgi_pass 127.0.0.1:9000;
16 | fastcgi_index index.php;
17 | fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/issue.net:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | 🚀 WELCOME TO PREMIUM SERVER 🚀
6 |
7 |
8 | 🚀 NO DDOS 🚀
9 |
10 |
11 | 🚀 NO HACKING 🚀
12 |
13 |
14 | 🚀 NO TORRENT 🚀
15 |
16 |
17 | 🚀 NO SPAMMING 🚀
18 |
19 |
20 | 🚀 MAX LOG 2 DEVICE 🚀
21 |
22 |
23 | 🚀 MOHON PATUHI ATURANNYA 🚀
24 |
--------------------------------------------------------------------------------
/squid3.conf:
--------------------------------------------------------------------------------
1 | acl manager proto cache_object
2 | acl localhost src 127.0.0.1/32 ::1
3 | acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
4 | acl SSL_ports port 442
5 | acl Safe_ports port 80
6 | acl Safe_ports port 21
7 | acl Safe_ports port 443
8 | acl Safe_ports port 70
9 | acl Safe_ports port 210
10 | acl Safe_ports port 1025-65535
11 | acl Safe_ports port 280
12 | acl Safe_ports port 488
13 | acl Safe_ports port 591
14 | acl Safe_ports port 777
15 | acl CONNECT method CONNECT
16 | acl SSH dst xxxxxxxxx
17 | http_access allow SSH
18 | http_access allow manager localhost
19 | http_access deny manager
20 | http_access allow localhost
21 | http_access deny all
22 | http_port 8080
23 | http_port 3128
24 | coredump_dir /var/spool/squid3
25 | refresh_pattern ^ftp: 1440 20% 10080
26 | refresh_pattern ^gopher: 1440 0% 1440
27 | refresh_pattern -i (/cgi-bin/|\?) 0 0% 0
28 | refresh_pattern . 0 20% 4320
29 | visible_hostname Beginner
30 |
--------------------------------------------------------------------------------
/nginx.conf:
--------------------------------------------------------------------------------
1 | user www-data;
2 |
3 | worker_processes 1;
4 | pid /var/run/nginx.pid;
5 |
6 | events {
7 | multi_accept on;
8 | worker_connections 1024;
9 | }
10 |
11 | http {
12 | gzip on;
13 | gzip_vary on;
14 | gzip_comp_level 5;
15 | gzip_types text/plain application/x-javascript text/xml text/css;
16 |
17 | autoindex on;
18 | sendfile on;
19 | tcp_nopush on;
20 | tcp_nodelay on;
21 | keepalive_timeout 65;
22 | types_hash_max_size 2048;
23 | server_tokens off;
24 | include /etc/nginx/mime.types;
25 | default_type application/octet-stream;
26 | access_log /var/log/nginx/access.log;
27 | error_log /var/log/nginx/error.log;
28 | client_max_body_size 32M;
29 | client_header_buffer_size 8m;
30 | large_client_header_buffers 8 8m;
31 |
32 | fastcgi_buffer_size 8m;
33 | fastcgi_buffers 8 8m;
34 |
35 | fastcgi_read_timeout 600;
36 |
37 | set_real_ip_from 204.93.240.0/24;
38 | set_real_ip_from 204.93.177.0/24;
39 | set_real_ip_from 199.27.128.0/21;
40 | set_real_ip_from 173.245.48.0/20;
41 | set_real_ip_from 103.21.244.0/22;
42 | set_real_ip_from 103.22.200.0/22;
43 | set_real_ip_from 103.31.4.0/22;
44 | set_real_ip_from 141.101.64.0/18;
45 | set_real_ip_from 108.162.192.0/18;
46 | set_real_ip_from 190.93.240.0/20;
47 | set_real_ip_from 188.114.96.0/20;
48 | set_real_ip_from 197.234.240.0/22;
49 | set_real_ip_from 198.41.128.0/17;
50 | real_ip_header CF-Connecting-IP;
51 |
52 | include /etc/nginx/conf.d/*.conf;
53 | }
54 |
--------------------------------------------------------------------------------
/password:
--------------------------------------------------------------------------------
1 | #
2 | # /etc/pam.d/common-password - password-related modules common to all services
3 | #
4 | # This file is included from other service-specific PAM config files,
5 | # and should contain a list of modules that define the services to be
6 | # used to change user passwords. The default is pam_unix.
7 |
8 | # Explanation of pam_unix options:
9 | #
10 | # The "sha512" option enables salted SHA512 passwords. Without this option,
11 | # the default is Unix crypt. Prior releases used the option "md5".
12 | #
13 | # The "obscure" option replaces the old `OBSCURE_CHECKS_ENAB' option in
14 | # login.defs.
15 | #
16 | # See the pam_unix manpage for other options.
17 |
18 | # As of pam 1.0.1-6, this file is managed by pam-auth-update by default.
19 | # To take advantage of this, it is recommended that you configure any
20 | # local modules either before or after the default block, and use
21 | # pam-auth-update to manage selection of other modules. See
22 | # pam-auth-update(8) for details.
23 |
24 | # here are the per-package modules (the "Primary" block)
25 | password [success=1 default=ignore] pam_unix.so obscure sha512
26 | # here's the fallback if no module succeeds
27 | password requisite pam_deny.so
28 | # prime the stack with a positive return value if there isn't one already;
29 | # this avoids us returning an error just because nothing sets a success code
30 | # since the modules above will each just jump around
31 | password required pam_permit.so
32 | # and here are more per-package modules (the "Additional" block)
33 | # end of pam-auth-update config
34 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | VPS AutoScriptVPN-AIO 
2 |
3 | VPS AutoScriptVPN-AIO is made by PR Aiman for Virtual Private Network
4 |
5 |
6 |
7 | Supported Linux Distribution
8 |
9 |
10 |
11 |
12 |
13 |
14 | Services
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | Commands
34 |
35 |
36 |
37 |
38 | Screenshorts
39 |
40 |
41 |
42 |
43 |
44 | Requirements
45 |
46 | - please be sure to provide your own domain or subdomain
47 |
48 | - if you rebuilt your vps in 10 times or more while using this script and using the same domain. you will suffer damage so my advice please use a different domain if you rebuilt vps many times
49 |
50 | Installation
51 |
52 | ``` html
53 | apt install -y bzip2 gzip coreutils curl && wget https://raw.githubusercontent.com/praiman99/AutoScriptVPN-AIO/Beginner/setup.sh && chmod +x setup.sh && sed -i -e 's/\r$//' setup.sh && ./setup.sh
54 | ```
55 |
56 | Thanks To TEAM #G404 ❤️
57 |
58 | Additional Info
59 | Recommended OS :
60 |
61 | - Debian 9 & 10 x64 bit
62 |
63 | Credit To : https://t.me/horasss (Orignal Base Script)
64 |
65 | Report Bugs Contact : https://t.me/PR_Aiman
66 |
67 |
68 |
69 |
70 |
71 |
72 |
Thanks to ALLAH S.W.T alhamdulillah syukur kehadrat illahi atas kepandaian dan kebijaksanaan yang telah di berikan daripada maha pencipta. semoga segala urusan di masa akan datang dipermudahkan
73 |
74 |
75 |
76 |
77 |
78 |
79 |
--------------------------------------------------------------------------------
/ws-stunnel:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | import socket, threading, thread, select, signal, sys, time, getopt
3 |
4 | # Listen
5 | LISTENING_ADDR = '0.0.0.0'
6 | if sys.argv[1:]:
7 | LISTENING_PORT = sys.argv[1]
8 | else:
9 | LISTENING_PORT = 2053
10 |
11 | # Pass
12 | PASS = ''
13 |
14 | # CONST
15 | BUFLEN = 4096 * 4
16 | TIMEOUT = 60
17 | DEFAULT_HOST = '127.0.0.1:22'
18 | RESPONSE = 'HTTP/1.1 101 Setup By PR Aiman\r\n\r\nContent-Length: 104857600000\r\n\r\n'
19 |
20 | class Server(threading.Thread):
21 | def __init__(self, host, port):
22 | threading.Thread.__init__(self)
23 | self.running = False
24 | self.host = host
25 | self.port = port
26 | self.threads = []
27 | self.threadsLock = threading.Lock()
28 | self.logLock = threading.Lock()
29 |
30 | def run(self):
31 | self.soc = socket.socket(socket.AF_INET)
32 | self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
33 | self.soc.settimeout(2)
34 | intport = int(self.port)
35 | self.soc.bind((self.host, intport))
36 | self.soc.listen(0)
37 | self.running = True
38 |
39 | try:
40 | while self.running:
41 | try:
42 | c, addr = self.soc.accept()
43 | c.setblocking(1)
44 | except socket.timeout:
45 | continue
46 |
47 | conn = ConnectionHandler(c, self, addr)
48 | conn.start()
49 | self.addConn(conn)
50 | finally:
51 | self.running = False
52 | self.soc.close()
53 |
54 | def printLog(self, log):
55 | self.logLock.acquire()
56 | print log
57 | self.logLock.release()
58 |
59 | def addConn(self, conn):
60 | try:
61 | self.threadsLock.acquire()
62 | if self.running:
63 | self.threads.append(conn)
64 | finally:
65 | self.threadsLock.release()
66 |
67 | def removeConn(self, conn):
68 | try:
69 | self.threadsLock.acquire()
70 | self.threads.remove(conn)
71 | finally:
72 | self.threadsLock.release()
73 |
74 | def close(self):
75 | try:
76 | self.running = False
77 | self.threadsLock.acquire()
78 |
79 | threads = list(self.threads)
80 | for c in threads:
81 | c.close()
82 | finally:
83 | self.threadsLock.release()
84 |
85 |
86 | class ConnectionHandler(threading.Thread):
87 | def __init__(self, socClient, server, addr):
88 | threading.Thread.__init__(self)
89 | self.clientClosed = False
90 | self.targetClosed = True
91 | self.client = socClient
92 | self.client_buffer = ''
93 | self.server = server
94 | self.log = 'Connection: ' + str(addr)
95 |
96 | def close(self):
97 | try:
98 | if not self.clientClosed:
99 | self.client.shutdown(socket.SHUT_RDWR)
100 | self.client.close()
101 | except:
102 | pass
103 | finally:
104 | self.clientClosed = True
105 |
106 | try:
107 | if not self.targetClosed:
108 | self.target.shutdown(socket.SHUT_RDWR)
109 | self.target.close()
110 | except:
111 | pass
112 | finally:
113 | self.targetClosed = True
114 |
115 | def run(self):
116 | try:
117 | self.client_buffer = self.client.recv(BUFLEN)
118 |
119 | hostPort = self.findHeader(self.client_buffer, 'X-Real-Host')
120 |
121 | if hostPort == '':
122 | hostPort = DEFAULT_HOST
123 |
124 | split = self.findHeader(self.client_buffer, 'X-Split')
125 |
126 | if split != '':
127 | self.client.recv(BUFLEN)
128 |
129 | if hostPort != '':
130 | passwd = self.findHeader(self.client_buffer, 'X-Pass')
131 |
132 | if len(PASS) != 0 and passwd == PASS:
133 | self.method_CONNECT(hostPort)
134 | elif len(PASS) != 0 and passwd != PASS:
135 | self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n')
136 | elif hostPort.startswith('127.0.0.1') or hostPort.startswith('localhost'):
137 | self.method_CONNECT(hostPort)
138 | else:
139 | self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n')
140 | else:
141 | print '- No X-Real-Host!'
142 | self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n')
143 |
144 | except Exception as e:
145 | self.log += ' - error: ' + e.strerror
146 | self.server.printLog(self.log)
147 | pass
148 | finally:
149 | self.close()
150 | self.server.removeConn(self)
151 |
152 | def findHeader(self, head, header):
153 | aux = head.find(header + ': ')
154 |
155 | if aux == -1:
156 | return ''
157 |
158 | aux = head.find(':', aux)
159 | head = head[aux+2:]
160 | aux = head.find('\r\n')
161 |
162 | if aux == -1:
163 | return ''
164 |
165 | return head[:aux];
166 |
167 | def connect_target(self, host):
168 | i = host.find(':')
169 | if i != -1:
170 | port = int(host[i+1:])
171 | host = host[:i]
172 | else:
173 | if self.method=='CONNECT':
174 | port = 443
175 | else:
176 | port = sys.argv[1]
177 |
178 | (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0]
179 |
180 | self.target = socket.socket(soc_family, soc_type, proto)
181 | self.targetClosed = False
182 | self.target.connect(address)
183 |
184 | def method_CONNECT(self, path):
185 | self.log += ' - CONNECT ' + path
186 |
187 | self.connect_target(path)
188 | self.client.sendall(RESPONSE)
189 | self.client_buffer = ''
190 |
191 | self.server.printLog(self.log)
192 | self.doCONNECT()
193 |
194 | def doCONNECT(self):
195 | socs = [self.client, self.target]
196 | count = 0
197 | error = False
198 | while True:
199 | count += 1
200 | (recv, _, err) = select.select(socs, [], socs, 3)
201 | if err:
202 | error = True
203 | if recv:
204 | for in_ in recv:
205 | try:
206 | data = in_.recv(BUFLEN)
207 | if data:
208 | if in_ is self.target:
209 | self.client.send(data)
210 | else:
211 | while data:
212 | byte = self.target.send(data)
213 | data = data[byte:]
214 |
215 | count = 0
216 | else:
217 | break
218 | except:
219 | error = True
220 | break
221 | if count == TIMEOUT:
222 | error = True
223 | if error:
224 | break
225 |
226 |
227 | def print_usage():
228 | print 'Usage: proxy.py -p '
229 | print ' proxy.py -b -p '
230 | print ' proxy.py -b 0.0.0.0 -p 80'
231 |
232 | def parse_args(argv):
233 | global LISTENING_ADDR
234 | global LISTENING_PORT
235 |
236 | try:
237 | opts, args = getopt.getopt(argv,"hb:p:",["bind=","port="])
238 | except getopt.GetoptError:
239 | print_usage()
240 | sys.exit(2)
241 | for opt, arg in opts:
242 | if opt == '-h':
243 | print_usage()
244 | sys.exit()
245 | elif opt in ("-b", "--bind"):
246 | LISTENING_ADDR = arg
247 | elif opt in ("-p", "--port"):
248 | LISTENING_PORT = int(arg)
249 |
250 |
251 | def main(host=LISTENING_ADDR, port=LISTENING_PORT):
252 | print "\n:-------PythonProxy-------:\n"
253 | print "Listening addr: " + LISTENING_ADDR
254 | print "Listening port: " + str(LISTENING_PORT) + "\n"
255 | print ":-------------------------:\n"
256 | server = Server(LISTENING_ADDR, LISTENING_PORT)
257 | server.start()
258 | while True:
259 | try:
260 | time.sleep(2)
261 | except KeyboardInterrupt:
262 | print 'Stopping...'
263 | server.close()
264 | break
265 |
266 | ####### parse_args(sys.argv[1:])
267 | if __name__ == '__main__':
268 | main()
269 |
--------------------------------------------------------------------------------
/proxy-template.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/python
2 | import socket, threading, thread, select, signal, sys, time, getopt
3 |
4 | # Listen
5 | LISTENING_ADDR = '0.0.0.0'
6 | LISTENING_PORT = sys.argv[1]
7 |
8 | # Pass
9 | PASS = ''
10 |
11 | # CONST
12 | BUFLEN = 4096 * 4
13 | TIMEOUT = 60
14 | DEFAULT_HOST = '127.0.0.1:22'
15 | RESPONSE = 'HTTP/1.1 101 Setup By PR Aiman\r\n\r\nContent-Length: 104857600000\r\n\r\n'
16 |
17 | class Server(threading.Thread):
18 | def __init__(self, host, port):
19 | threading.Thread.__init__(self)
20 | self.running = False
21 | self.host = host
22 | self.port = port
23 | self.threads = []
24 | self.threadsLock = threading.Lock()
25 | self.logLock = threading.Lock()
26 |
27 | def run(self):
28 | self.soc = socket.socket(socket.AF_INET)
29 | self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
30 | self.soc.settimeout(2)
31 | intport = int(self.port)
32 | self.soc.bind((self.host, intport))
33 | self.soc.listen(0)
34 | self.running = True
35 |
36 | try:
37 | while self.running:
38 | try:
39 | c, addr = self.soc.accept()
40 | c.setblocking(1)
41 | except socket.timeout:
42 | continue
43 |
44 | conn = ConnectionHandler(c, self, addr)
45 | conn.start()
46 | self.addConn(conn)
47 | finally:
48 | self.running = False
49 | self.soc.close()
50 |
51 | def printLog(self, log):
52 | self.logLock.acquire()
53 | print log
54 | self.logLock.release()
55 |
56 | def addConn(self, conn):
57 | try:
58 | self.threadsLock.acquire()
59 | if self.running:
60 | self.threads.append(conn)
61 | finally:
62 | self.threadsLock.release()
63 |
64 | def removeConn(self, conn):
65 | try:
66 | self.threadsLock.acquire()
67 | self.threads.remove(conn)
68 | finally:
69 | self.threadsLock.release()
70 |
71 | def close(self):
72 | try:
73 | self.running = False
74 | self.threadsLock.acquire()
75 |
76 | threads = list(self.threads)
77 | for c in threads:
78 | c.close()
79 | finally:
80 | self.threadsLock.release()
81 |
82 |
83 | class ConnectionHandler(threading.Thread):
84 | def __init__(self, socClient, server, addr):
85 | threading.Thread.__init__(self)
86 | self.clientClosed = False
87 | self.targetClosed = True
88 | self.client = socClient
89 | self.client_buffer = ''
90 | self.server = server
91 | self.log = 'Connection: ' + str(addr)
92 |
93 | def close(self):
94 | try:
95 | if not self.clientClosed:
96 | self.client.shutdown(socket.SHUT_RDWR)
97 | self.client.close()
98 | except:
99 | pass
100 | finally:
101 | self.clientClosed = True
102 |
103 | try:
104 | if not self.targetClosed:
105 | self.target.shutdown(socket.SHUT_RDWR)
106 | self.target.close()
107 | except:
108 | pass
109 | finally:
110 | self.targetClosed = True
111 |
112 | def run(self):
113 | try:
114 | self.client_buffer = self.client.recv(BUFLEN)
115 |
116 | hostPort = self.findHeader(self.client_buffer, 'X-Real-Host')
117 |
118 | if hostPort == '':
119 | hostPort = DEFAULT_HOST
120 |
121 | split = self.findHeader(self.client_buffer, 'X-Split')
122 |
123 | if split != '':
124 | self.client.recv(BUFLEN)
125 |
126 | if hostPort != '':
127 | passwd = self.findHeader(self.client_buffer, 'X-Pass')
128 |
129 | if len(PASS) != 0 and passwd == PASS:
130 | self.method_CONNECT(hostPort)
131 | elif len(PASS) != 0 and passwd != PASS:
132 | self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n')
133 | elif hostPort.startswith('127.0.0.1') or hostPort.startswith('localhost'):
134 | self.method_CONNECT(hostPort)
135 | else:
136 | self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n')
137 | else:
138 | print '- No X-Real-Host!'
139 | self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n')
140 |
141 | except Exception as e:
142 | self.log += ' - error: ' + e.strerror
143 | self.server.printLog(self.log)
144 | pass
145 | finally:
146 | self.close()
147 | self.server.removeConn(self)
148 |
149 | def findHeader(self, head, header):
150 | aux = head.find(header + ': ')
151 |
152 | if aux == -1:
153 | return ''
154 |
155 | aux = head.find(':', aux)
156 | head = head[aux+2:]
157 | aux = head.find('\r\n')
158 |
159 | if aux == -1:
160 | return ''
161 |
162 | return head[:aux];
163 |
164 | def connect_target(self, host):
165 | i = host.find(':')
166 | if i != -1:
167 | port = int(host[i+1:])
168 | host = host[:i]
169 | else:
170 | if self.method=='CONNECT':
171 | port = 443
172 | else:
173 | port = sys.argv[1]
174 |
175 | (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0]
176 |
177 | self.target = socket.socket(soc_family, soc_type, proto)
178 | self.targetClosed = False
179 | self.target.connect(address)
180 |
181 | def method_CONNECT(self, path):
182 | self.log += ' - CONNECT ' + path
183 |
184 | self.connect_target(path)
185 | self.client.sendall(RESPONSE)
186 | self.client_buffer = ''
187 |
188 | self.server.printLog(self.log)
189 | self.doCONNECT()
190 |
191 | def doCONNECT(self):
192 | socs = [self.client, self.target]
193 | count = 0
194 | error = False
195 | while True:
196 | count += 1
197 | (recv, _, err) = select.select(socs, [], socs, 3)
198 | if err:
199 | error = True
200 | if recv:
201 | for in_ in recv:
202 | try:
203 | data = in_.recv(BUFLEN)
204 | if data:
205 | if in_ is self.target:
206 | self.client.send(data)
207 | else:
208 | while data:
209 | byte = self.target.send(data)
210 | data = data[byte:]
211 |
212 | count = 0
213 | else:
214 | break
215 | except:
216 | error = True
217 | break
218 | if count == TIMEOUT:
219 | error = True
220 | if error:
221 | break
222 |
223 |
224 | def print_usage():
225 | print 'Usage: proxy.py -p '
226 | print ' proxy.py -b -p '
227 | print ' proxy.py -b 0.0.0.0 -p 80'
228 |
229 | def parse_args(argv):
230 | global LISTENING_ADDR
231 | global LISTENING_PORT
232 |
233 | try:
234 | opts, args = getopt.getopt(argv,"hb:p:",["bind=","port="])
235 | except getopt.GetoptError:
236 | print_usage()
237 | sys.exit(2)
238 | for opt, arg in opts:
239 | if opt == '-h':
240 | print_usage()
241 | sys.exit()
242 | elif opt in ("-b", "--bind"):
243 | LISTENING_ADDR = arg
244 | elif opt in ("-p", "--port"):
245 | LISTENING_PORT = int(arg)
246 |
247 |
248 | def main(host=LISTENING_ADDR, port=LISTENING_PORT):
249 | print "\n:-------PythonProxy-------:\n"
250 | print "Listening addr: " + LISTENING_ADDR
251 | print "Listening port: " + str(LISTENING_PORT) + "\n"
252 | print ":-------------------------:\n"
253 | server = Server(LISTENING_ADDR, LISTENING_PORT)
254 | server.start()
255 | while True:
256 | try:
257 | time.sleep(2)
258 | except KeyboardInterrupt:
259 | print 'Stopping...'
260 | server.close()
261 | break
262 |
263 | ####### parse_args(sys.argv[1:])
264 | if __name__ == '__main__':
265 | main()
--------------------------------------------------------------------------------
/edu-op.py:
--------------------------------------------------------------------------------
1 | import socket, threading, thread, select, signal, sys, time, getopt
2 |
3 | # Listen
4 | LISTENING_ADDR = '0.0.0.0'
5 | if sys.argv[1:]:
6 | LISTENING_PORT = sys.argv[1]
7 | else:
8 | LISTENING_PORT = 80
9 | #Pass
10 | PASS = ''
11 |
12 | # CONST
13 | BUFLEN = 4096 * 4
14 | TIMEOUT = 60
15 | DEFAULT_HOST = '127.0.0.1:555'
16 | RESPONSE = 'HTTP/1.1 101 Switching Protocols\r\nContent-Length: 1048576000000\r\n\r\n'
17 | #RESPONSE = 'HTTP/1.1 200 Hello_World!\r\nContent-length: 0\r\n\r\nHTTP/1.1 200 Connection established\r\n\r\n' # lint:ok
18 |
19 | class Server(threading.Thread):
20 | def __init__(self, host, port):
21 | threading.Thread.__init__(self)
22 | self.running = False
23 | self.host = host
24 | self.port = port
25 | self.threads = []
26 | self.threadsLock = threading.Lock()
27 | self.logLock = threading.Lock()
28 |
29 | def run(self):
30 | self.soc = socket.socket(socket.AF_INET)
31 | self.soc.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
32 | self.soc.settimeout(2)
33 | intport = int(self.port)
34 | self.soc.bind((self.host, intport))
35 | self.soc.listen(0)
36 | self.running = True
37 |
38 | try:
39 | while self.running:
40 | try:
41 | c, addr = self.soc.accept()
42 | c.setblocking(1)
43 | except socket.timeout:
44 | continue
45 |
46 | conn = ConnectionHandler(c, self, addr)
47 | conn.start()
48 | self.addConn(conn)
49 | finally:
50 | self.running = False
51 | self.soc.close()
52 |
53 | def printLog(self, log):
54 | self.logLock.acquire()
55 | print log
56 | self.logLock.release()
57 |
58 | def addConn(self, conn):
59 | try:
60 | self.threadsLock.acquire()
61 | if self.running:
62 | self.threads.append(conn)
63 | finally:
64 | self.threadsLock.release()
65 |
66 | def removeConn(self, conn):
67 | try:
68 | self.threadsLock.acquire()
69 | self.threads.remove(conn)
70 | finally:
71 | self.threadsLock.release()
72 |
73 | def close(self):
74 | try:
75 | self.running = False
76 | self.threadsLock.acquire()
77 |
78 | threads = list(self.threads)
79 | for c in threads:
80 | c.close()
81 | finally:
82 | self.threadsLock.release()
83 |
84 |
85 | class ConnectionHandler(threading.Thread):
86 | def __init__(self, socClient, server, addr):
87 | threading.Thread.__init__(self)
88 | self.clientClosed = False
89 | self.targetClosed = True
90 | self.client = socClient
91 | self.client_buffer = ''
92 | self.server = server
93 | self.log = 'Connection: ' + str(addr)
94 |
95 | def close(self):
96 | try:
97 | if not self.clientClosed:
98 | self.client.shutdown(socket.SHUT_RDWR)
99 | self.client.close()
100 | except:
101 | pass
102 | finally:
103 | self.clientClosed = True
104 |
105 | try:
106 | if not self.targetClosed:
107 | self.target.shutdown(socket.SHUT_RDWR)
108 | self.target.close()
109 | except:
110 | pass
111 | finally:
112 | self.targetClosed = True
113 |
114 | def run(self):
115 | try:
116 | self.client_buffer = self.client.recv(BUFLEN)
117 |
118 | hostPort = self.findHeader(self.client_buffer, 'X-Real-Host')
119 |
120 | if hostPort == '':
121 | hostPort = DEFAULT_HOST
122 |
123 | split = self.findHeader(self.client_buffer, 'X-Split')
124 |
125 | if split != '':
126 | self.client.recv(BUFLEN)
127 |
128 | if hostPort != '':
129 | passwd = self.findHeader(self.client_buffer, 'X-Pass')
130 |
131 | if len(PASS) != 0 and passwd == PASS:
132 | self.method_CONNECT(hostPort)
133 | elif len(PASS) != 0 and passwd != PASS:
134 | self.client.send('HTTP/1.1 400 WrongPass!\r\n\r\n')
135 | elif hostPort.startswith('127.0.0.1') or hostPort.startswith('localhost'):
136 | self.method_CONNECT(hostPort)
137 | else:
138 | self.client.send('HTTP/1.1 403 Forbidden!\r\n\r\n')
139 | else:
140 | print '- No X-Real-Host!'
141 | self.client.send('HTTP/1.1 400 NoXRealHost!\r\n\r\n')
142 |
143 | except Exception as e:
144 | self.log += ' - error: ' + e.strerror
145 | self.server.printLog(self.log)
146 | pass
147 | finally:
148 | self.close()
149 | self.server.removeConn(self)
150 |
151 | def findHeader(self, head, header):
152 | aux = head.find(header + ': ')
153 |
154 | if aux == -1:
155 | return ''
156 |
157 | aux = head.find(':', aux)
158 | head = head[aux+2:]
159 | aux = head.find('\r\n')
160 |
161 | if aux == -1:
162 | return ''
163 |
164 | return head[:aux];
165 |
166 | def connect_target(self, host):
167 | i = host.find(':')
168 | if i != -1:
169 | port = int(host[i+1:])
170 | host = host[:i]
171 | else:
172 | if self.method=='CONNECT':
173 | port = 443
174 | else:
175 | port = sys.argv[1]
176 |
177 | (soc_family, soc_type, proto, _, address) = socket.getaddrinfo(host, port)[0]
178 |
179 | self.target = socket.socket(soc_family, soc_type, proto)
180 | self.targetClosed = False
181 | self.target.connect(address)
182 |
183 | def method_CONNECT(self, path):
184 | self.log += ' - CONNECT ' + path
185 |
186 | self.connect_target(path)
187 | self.client.sendall(RESPONSE)
188 | self.client_buffer = ''
189 |
190 | self.server.printLog(self.log)
191 | self.doCONNECT()
192 |
193 | def doCONNECT(self):
194 | socs = [self.client, self.target]
195 | count = 0
196 | error = False
197 | while True:
198 | count += 1
199 | (recv, _, err) = select.select(socs, [], socs, 3)
200 | if err:
201 | error = True
202 | if recv:
203 | for in_ in recv:
204 | try:
205 | data = in_.recv(BUFLEN)
206 | if data:
207 | if in_ is self.target:
208 | self.client.send(data)
209 | else:
210 | while data:
211 | byte = self.target.send(data)
212 | data = data[byte:]
213 |
214 | count = 0
215 | else:
216 | break
217 | except:
218 | error = True
219 | break
220 | if count == TIMEOUT:
221 | error = True
222 | if error:
223 | break
224 |
225 |
226 | def print_usage():
227 | print 'Usage: proxy.py -p '
228 | print ' proxy.py -b -p '
229 | print ' proxy.py -b 0.0.0.0 -p 80'
230 |
231 | def parse_args(argv):
232 | global LISTENING_ADDR
233 | global LISTENING_PORT
234 |
235 | try:
236 | opts, args = getopt.getopt(argv,"hb:p:",["bind=","port="])
237 | except getopt.GetoptError:
238 | print_usage()
239 | sys.exit(2)
240 | for opt, arg in opts:
241 | if opt == '-h':
242 | print_usage()
243 | sys.exit()
244 | elif opt in ("-b", "--bind"):
245 | LISTENING_ADDR = arg
246 | elif opt in ("-p", "--port"):
247 | LISTENING_PORT = int(arg)
248 |
249 |
250 | def main(host=LISTENING_ADDR, port=LISTENING_PORT):
251 | print "\n:-------PythonProxy-------:\n"
252 | print "Listening addr: " + LISTENING_ADDR
253 | print "Listening port: " + str(LISTENING_PORT) + "\n"
254 | print ":-------------------------:\n"
255 | server = Server(LISTENING_ADDR, LISTENING_PORT)
256 | server.start()
257 | while True:
258 | try:
259 | time.sleep(2)
260 | except KeyboardInterrupt:
261 | print 'Stopping...'
262 | server.close()
263 | break
264 |
265 | ####### parse_args(sys.argv[1:])
266 | if __name__ == '__main__':
267 | main()
268 |
--------------------------------------------------------------------------------
/ram.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 |
3 | # Try to determine how much RAM is currently being used per program.
4 | # Note per _program_, not per process. So for example this script
5 | # will report RAM used by all httpd process together. In detail it reports:
6 | # sum(private RAM for program processes) + sum(Shared RAM for program processes)
7 | # The shared RAM is problematic to calculate, and this script automatically
8 | # selects the most accurate method available for your kernel.
9 |
10 | # Licence: LGPLv2
11 | # Author: P@draigBrady.com
12 | # Source: http://www.pixelbeat.org/scripts/ps_mem.py
13 |
14 | # V1.0 06 Jul 2005 Initial release
15 | # V1.1 11 Aug 2006 root permission required for accuracy
16 | # V1.2 08 Nov 2006 Add total to output
17 | # Use KiB,MiB,... for units rather than K,M,...
18 | # V1.3 22 Nov 2006 Ignore shared col from /proc/$pid/statm for
19 | # 2.6 kernels up to and including 2.6.9.
20 | # There it represented the total file backed extent
21 | # V1.4 23 Nov 2006 Remove total from output as it's meaningless
22 | # (the shared values overlap with other programs).
23 | # Display the shared column. This extra info is
24 | # useful, especially as it overlaps between programs.
25 | # V1.5 26 Mar 2007 Remove redundant recursion from human()
26 | # V1.6 05 Jun 2007 Also report number of processes with a given name.
27 | # Patch from riccardo.murri@gmail.com
28 | # V1.7 20 Sep 2007 Use PSS from /proc/$pid/smaps if available, which
29 | # fixes some over-estimation and allows totalling.
30 | # Enumerate the PIDs directly rather than using ps,
31 | # which fixes the possible race between reading
32 | # RSS with ps, and shared memory with this program.
33 | # Also we can show non truncated command names.
34 | # V1.8 28 Sep 2007 More accurate matching for stats in /proc/$pid/smaps
35 | # as otherwise could match libraries causing a crash.
36 | # Patch from patrice.bouchand.fedora@gmail.com
37 | # V1.9 20 Feb 2008 Fix invalid values reported when PSS is available.
38 | # Reported by Andrey Borzenkov
39 | # V3.8 17 Jun 2016
40 | # http://github.com/pixelb/scripts/commits/master/scripts/ps_mem.py
41 |
42 | # Notes:
43 | #
44 | # All interpreted programs where the interpreter is started
45 | # by the shell or with env, will be merged to the interpreter
46 | # (as that's what's given to exec). For e.g. all python programs
47 | # starting with "#!/usr/bin/env python" will be grouped under python.
48 | # You can change this by using the full command line but that will
49 | # have the undesirable affect of splitting up programs started with
50 | # differing parameters (for e.g. mingetty tty[1-6]).
51 | #
52 | # For 2.6 kernels up to and including 2.6.13 and later 2.4 redhat kernels
53 | # (rmap vm without smaps) it can not be accurately determined how many pages
54 | # are shared between processes in general or within a program in our case:
55 | # http://lkml.org/lkml/2005/7/6/250
56 | # A warning is printed if overestimation is possible.
57 | # In addition for 2.6 kernels up to 2.6.9 inclusive, the shared
58 | # value in /proc/$pid/statm is the total file-backed extent of a process.
59 | # We ignore that, introducing more overestimation, again printing a warning.
60 | # Since kernel 2.6.23-rc8-mm1 PSS is available in smaps, which allows
61 | # us to calculate a more accurate value for the total RAM used by programs.
62 | #
63 | # Programs that use CLONE_VM without CLONE_THREAD are discounted by assuming
64 | # they're the only programs that have the same /proc/$PID/smaps file for
65 | # each instance. This will fail if there are multiple real instances of a
66 | # program that then use CLONE_VM without CLONE_THREAD, or if a clone changes
67 | # its memory map while we're checksumming each /proc/$PID/smaps.
68 | #
69 | # I don't take account of memory allocated for a program
70 | # by other programs. For e.g. memory used in the X server for
71 | # a program could be determined, but is not.
72 | #
73 | # FreeBSD is supported if linprocfs is mounted at /compat/linux/proc/
74 | # FreeBSD 8.0 supports up to a level of Linux 2.6.16
75 |
76 | import getopt
77 | import time
78 | import errno
79 | import os
80 | import sys
81 |
82 | # The following exits cleanly on Ctrl-C or EPIPE
83 | # while treating other exceptions as before.
84 | def std_exceptions(etype, value, tb):
85 | sys.excepthook = sys.__excepthook__
86 | if issubclass(etype, KeyboardInterrupt):
87 | pass
88 | elif issubclass(etype, IOError) and value.errno == errno.EPIPE:
89 | pass
90 | else:
91 | sys.__excepthook__(etype, value, tb)
92 | sys.excepthook = std_exceptions
93 |
94 | #
95 | # Define some global variables
96 | #
97 |
98 | PAGESIZE = os.sysconf("SC_PAGE_SIZE") / 1024 #KiB
99 | our_pid = os.getpid()
100 |
101 | have_pss = 0
102 | have_swap_pss = 0
103 |
104 | class Proc:
105 | def __init__(self):
106 | uname = os.uname()
107 | if uname[0] == "FreeBSD":
108 | self.proc = '/compat/linux/proc'
109 | else:
110 | self.proc = '/proc'
111 |
112 | def path(self, *args):
113 | return os.path.join(self.proc, *(str(a) for a in args))
114 |
115 | def open(self, *args):
116 | try:
117 | if sys.version_info < (3,):
118 | return open(self.path(*args))
119 | else:
120 | return open(self.path(*args), errors='ignore')
121 | except (IOError, OSError):
122 | val = sys.exc_info()[1]
123 | if (val.errno == errno.ENOENT or # kernel thread or process gone
124 | val.errno == errno.EPERM):
125 | raise LookupError
126 | raise
127 |
128 | proc = Proc()
129 |
130 |
131 | #
132 | # Functions
133 | #
134 |
135 | def parse_options():
136 | try:
137 | long_options = [
138 | 'split-args',
139 | 'help',
140 | 'total',
141 | 'discriminate-by-pid',
142 | 'swap'
143 | ]
144 | opts, args = getopt.getopt(sys.argv[1:], "shtdSp:w:", long_options)
145 | except getopt.GetoptError:
146 | sys.stderr.write(help())
147 | sys.exit(3)
148 |
149 | if len(args):
150 | sys.stderr.write("Extraneous arguments: %s\n" % args)
151 | sys.exit(3)
152 |
153 | # ps_mem.py options
154 | split_args = False
155 | pids_to_show = None
156 | discriminate_by_pid = False
157 | show_swap = False
158 | watch = None
159 | only_total = False
160 |
161 | for o, a in opts:
162 | if o in ('-s', '--split-args'):
163 | split_args = True
164 | if o in ('-t', '--total'):
165 | only_total = True
166 | if o in ('-d', '--discriminate-by-pid'):
167 | discriminate_by_pid = True
168 | if o in ('-S', '--swap'):
169 | show_swap = True
170 | if o in ('-h', '--help'):
171 | sys.stdout.write(help())
172 | sys.exit(0)
173 | if o in ('-p',):
174 | try:
175 | pids_to_show = [int(x) for x in a.split(',')]
176 | except:
177 | sys.stderr.write(help())
178 | sys.exit(3)
179 | if o in ('-w',):
180 | try:
181 | watch = int(a)
182 | except:
183 | sys.stderr.write(help())
184 | sys.exit(3)
185 |
186 | return (
187 | split_args,
188 | pids_to_show,
189 | watch,
190 | only_total,
191 | discriminate_by_pid,
192 | show_swap
193 | )
194 |
195 |
196 | def help():
197 | help_msg = 'Usage: ps_mem [OPTION]...\n' \
198 | 'Show program core memory usage\n' \
199 | '\n' \
200 | ' -h, -help Show this help\n' \
201 | ' -p [,pid2,...pidN] Only show memory usage PIDs in the '\
202 | 'specified list\n' \
203 | ' -s, --split-args Show and separate by, all command line'\
204 | ' arguments\n' \
205 | ' -t, --total Show only the total value\n' \
206 | ' -d, --discriminate-by-pid Show by process rather than by program\n' \
207 | ' -S, --swap Show swap information\n' \
208 | ' -w Measure and show process memory every'\
209 | ' N seconds\n'
210 |
211 | return help_msg
212 |
213 |
214 | # (major,minor,release)
215 | def kernel_ver():
216 | kv = proc.open('sys/kernel/osrelease').readline().split(".")[:3]
217 | last = len(kv)
218 | if last == 2:
219 | kv.append('0')
220 | last -= 1
221 | while last > 0:
222 | for char in "-_":
223 | kv[last] = kv[last].split(char)[0]
224 | try:
225 | int(kv[last])
226 | except:
227 | kv[last] = 0
228 | last -= 1
229 | return (int(kv[0]), int(kv[1]), int(kv[2]))
230 |
231 |
232 | #return Private,Shared
233 | #Note shared is always a subset of rss (trs is not always)
234 | def getMemStats(pid):
235 | global have_pss
236 | global have_swap_pss
237 | mem_id = pid #unique
238 | Private_lines = []
239 | Shared_lines = []
240 | Pss_lines = []
241 | Rss = (int(proc.open(pid, 'statm').readline().split()[1])
242 | * PAGESIZE)
243 | Swap_lines = []
244 | Swap_pss_lines = []
245 |
246 | Swap = 0
247 | Swap_pss = 0
248 |
249 | if os.path.exists(proc.path(pid, 'smaps')): # stat
250 | lines = proc.open(pid, 'smaps').readlines() # open
251 | # Note we checksum smaps as maps is usually but
252 | # not always different for separate processes.
253 | mem_id = hash(''.join(lines))
254 | for line in lines:
255 | if line.startswith("Shared"):
256 | Shared_lines.append(line)
257 | elif line.startswith("Private"):
258 | Private_lines.append(line)
259 | elif line.startswith("Pss"):
260 | have_pss = 1
261 | Pss_lines.append(line)
262 | elif line.startswith("Swap:"):
263 | Swap_lines.append(line)
264 | elif line.startswith("SwapPss:"):
265 | have_swap_pss = 1
266 | Swap_pss_lines.append(line)
267 | Shared = sum([int(line.split()[1]) for line in Shared_lines])
268 | Private = sum([int(line.split()[1]) for line in Private_lines])
269 | #Note Shared + Private = Rss above
270 | #The Rss in smaps includes video card mem etc.
271 | if have_pss:
272 | pss_adjust = 0.5 # add 0.5KiB as this avg error due to truncation
273 | Pss = sum([float(line.split()[1])+pss_adjust for line in Pss_lines])
274 | Shared = Pss - Private
275 | # Note that Swap = Private swap + Shared swap.
276 | Swap = sum([int(line.split()[1]) for line in Swap_lines])
277 | if have_swap_pss:
278 | # The kernel supports SwapPss, that shows proportional swap share.
279 | # Note that Swap - SwapPss is not Private Swap.
280 | Swap_pss = sum([int(line.split()[1]) for line in Swap_pss_lines])
281 | elif (2,6,1) <= kernel_ver() <= (2,6,9):
282 | Shared = 0 #lots of overestimation, but what can we do?
283 | Private = Rss
284 | else:
285 | Shared = int(proc.open(pid, 'statm').readline().split()[2])
286 | Shared *= PAGESIZE
287 | Private = Rss - Shared
288 | return (Private, Shared, mem_id, Swap, Swap_pss)
289 |
290 |
291 | def getCmdName(pid, split_args, discriminate_by_pid):
292 | cmdline = proc.open(pid, 'cmdline').read().split("\0")
293 | if cmdline[-1] == '' and len(cmdline) > 1:
294 | cmdline = cmdline[:-1]
295 |
296 | path = proc.path(pid, 'exe')
297 | try:
298 | path = os.readlink(path)
299 | # Some symlink targets were seen to contain NULs on RHEL 5 at least
300 | # https://github.com/pixelb/scripts/pull/10, so take string up to NUL
301 | path = path.split('\0')[0]
302 | except OSError:
303 | val = sys.exc_info()[1]
304 | if (val.errno == errno.ENOENT or # either kernel thread or process gone
305 | val.errno == errno.EPERM):
306 | raise LookupError
307 | raise
308 |
309 | if split_args:
310 | return " ".join(cmdline)
311 | if path.endswith(" (deleted)"):
312 | path = path[:-10]
313 | if os.path.exists(path):
314 | path += " [updated]"
315 | else:
316 | #The path could be have prelink stuff so try cmdline
317 | #which might have the full path present. This helped for:
318 | #/usr/libexec/notification-area-applet.#prelink#.fX7LCT (deleted)
319 | if os.path.exists(cmdline[0]):
320 | path = cmdline[0] + " [updated]"
321 | else:
322 | path += " [deleted]"
323 | exe = os.path.basename(path)
324 | cmd = proc.open(pid, 'status').readline()[6:-1]
325 | if exe.startswith(cmd):
326 | cmd = exe #show non truncated version
327 | #Note because we show the non truncated name
328 | #one can have separated programs as follows:
329 | #584.0 KiB + 1.0 MiB = 1.6 MiB mozilla-thunder (exe -> bash)
330 | # 56.0 MiB + 22.2 MiB = 78.2 MiB mozilla-thunderbird-bin
331 | if sys.version_info >= (3,):
332 | cmd = cmd.encode(errors='replace').decode()
333 | if discriminate_by_pid:
334 | cmd = '%s [%d]' % (cmd, pid)
335 | return cmd
336 |
337 |
338 | #The following matches "du -h" output
339 | #see also human.py
340 | def human(num, power="Ki", units=None):
341 | if units is None:
342 | powers = ["Ki", "Mi", "Gi", "Ti"]
343 | while num >= 1000: #4 digits
344 | num /= 1024.0
345 | power = powers[powers.index(power)+1]
346 | return "%.1f %sB" % (num, power)
347 | else:
348 | return "%.f" % ((num * 1024) / units)
349 |
350 |
351 | def cmd_with_count(cmd, count):
352 | if count > 1:
353 | return "%s (%u)" % (cmd, count)
354 | else:
355 | return cmd
356 |
357 | #Warn of possible inaccuracies
358 | #2 = accurate & can total
359 | #1 = accurate only considering each process in isolation
360 | #0 = some shared mem not reported
361 | #-1= all shared mem not reported
362 | def shared_val_accuracy():
363 | """http://wiki.apache.org/spamassassin/TopSharedMemoryBug"""
364 | kv = kernel_ver()
365 | pid = os.getpid()
366 | if kv[:2] == (2,4):
367 | if proc.open('meminfo').read().find("Inact_") == -1:
368 | return 1
369 | return 0
370 | elif kv[:2] == (2,6):
371 | if os.path.exists(proc.path(pid, 'smaps')):
372 | if proc.open(pid, 'smaps').read().find("Pss:")!=-1:
373 | return 2
374 | else:
375 | return 1
376 | if (2,6,1) <= kv <= (2,6,9):
377 | return -1
378 | return 0
379 | elif kv[0] > 2 and os.path.exists(proc.path(pid, 'smaps')):
380 | return 2
381 | else:
382 | return 1
383 |
384 | def show_shared_val_accuracy( possible_inacc, only_total=False ):
385 | level = ("Warning","Error")[only_total]
386 | if possible_inacc == -1:
387 | sys.stderr.write(
388 | "%s: Shared memory is not reported by this system.\n" % level
389 | )
390 | sys.stderr.write(
391 | "Values reported will be too large, and totals are not reported\n"
392 | )
393 | elif possible_inacc == 0:
394 | sys.stderr.write(
395 | "%s: Shared memory is not reported accurately by this system.\n" % level
396 | )
397 | sys.stderr.write(
398 | "Values reported could be too large, and totals are not reported\n"
399 | )
400 | elif possible_inacc == 1:
401 | sys.stderr.write(
402 | "%s: Shared memory is slightly over-estimated by this system\n"
403 | "for each program, so totals are not reported.\n" % level
404 | )
405 | sys.stderr.close()
406 | if only_total and possible_inacc != 2:
407 | sys.exit(1)
408 |
409 |
410 | def get_memory_usage(pids_to_show, split_args, discriminate_by_pid,
411 | include_self=False, only_self=False):
412 | cmds = {}
413 | shareds = {}
414 | mem_ids = {}
415 | count = {}
416 | swaps = {}
417 | shared_swaps = {}
418 | for pid in os.listdir(proc.path('')):
419 | if not pid.isdigit():
420 | continue
421 | pid = int(pid)
422 |
423 | # Some filters
424 | if only_self and pid != our_pid:
425 | continue
426 | if pid == our_pid and not include_self:
427 | continue
428 | if pids_to_show is not None and pid not in pids_to_show:
429 | continue
430 |
431 | try:
432 | cmd = getCmdName(pid, split_args, discriminate_by_pid)
433 | except LookupError:
434 | #operation not permitted
435 | #kernel threads don't have exe links or
436 | #process gone
437 | continue
438 |
439 | try:
440 | private, shared, mem_id, swap, swap_pss = getMemStats(pid)
441 | except RuntimeError:
442 | continue #process gone
443 | if shareds.get(cmd):
444 | if have_pss: #add shared portion of PSS together
445 | shareds[cmd] += shared
446 | elif shareds[cmd] < shared: #just take largest shared val
447 | shareds[cmd] = shared
448 | else:
449 | shareds[cmd] = shared
450 | cmds[cmd] = cmds.setdefault(cmd, 0) + private
451 | if cmd in count:
452 | count[cmd] += 1
453 | else:
454 | count[cmd] = 1
455 | mem_ids.setdefault(cmd, {}).update({mem_id: None})
456 |
457 | # Swap (overcounting for now...)
458 | swaps[cmd] = swaps.setdefault(cmd, 0) + swap
459 | if have_swap_pss:
460 | shared_swaps[cmd] = shared_swaps.setdefault(cmd, 0) + swap_pss
461 | else:
462 | shared_swaps[cmd] = 0
463 |
464 | # Total swaped mem for each program
465 | total_swap = 0
466 |
467 | # Total swaped shared mem for each program
468 | total_shared_swap = 0
469 |
470 | # Add shared mem for each program
471 | total = 0
472 |
473 | for cmd in cmds:
474 | cmd_count = count[cmd]
475 | if len(mem_ids[cmd]) == 1 and cmd_count > 1:
476 | # Assume this program is using CLONE_VM without CLONE_THREAD
477 | # so only account for one of the processes
478 | cmds[cmd] /= cmd_count
479 | if have_pss:
480 | shareds[cmd] /= cmd_count
481 | cmds[cmd] = cmds[cmd] + shareds[cmd]
482 | total += cmds[cmd] # valid if PSS available
483 | total_swap += swaps[cmd]
484 | if have_swap_pss:
485 | total_shared_swap += shared_swaps[cmd]
486 |
487 | sorted_cmds = sorted(cmds.items(), key=lambda x:x[1])
488 | sorted_cmds = [x for x in sorted_cmds if x[1]]
489 |
490 | return sorted_cmds, shareds, count, total, swaps, shared_swaps, \
491 | total_swap, total_shared_swap
492 |
493 |
494 | def print_header(show_swap, discriminate_by_pid):
495 | output_string = " Private + Shared = RAM used"
496 | if show_swap:
497 | if have_swap_pss:
498 | output_string += " " * 5 + "Shared Swap"
499 | output_string += " Swap used"
500 | output_string += "\tProgram"
501 | if discriminate_by_pid:
502 | output_string += "[pid]"
503 | output_string += "\n\n"
504 | sys.stdout.write(output_string)
505 |
506 |
507 | def print_memory_usage(sorted_cmds, shareds, count, total, swaps, total_swap,
508 | shared_swaps, total_shared_swap, show_swap):
509 | for cmd in sorted_cmds:
510 |
511 | output_string = "%9s + %9s = %9s"
512 | output_data = (human(cmd[1]-shareds[cmd[0]]),
513 | human(shareds[cmd[0]]), human(cmd[1]))
514 | if show_swap:
515 | if have_swap_pss:
516 | output_string += "\t%9s"
517 | output_data += (human(shared_swaps[cmd[0]]),)
518 | output_string += " %9s"
519 | output_data += (human(swaps[cmd[0]]),)
520 | output_string += "\t%s\n"
521 | output_data += (cmd_with_count(cmd[0], count[cmd[0]]),)
522 |
523 | sys.stdout.write(output_string % output_data)
524 |
525 | if have_pss:
526 | if show_swap:
527 | if have_swap_pss:
528 | sys.stdout.write("%s\n%s%9s%s%9s%s%9s\n%s\n" %
529 | ("-" * 61, " " * 24, human(total), " " * 7,
530 | human(total_shared_swap), " " * 3,
531 | human(total_swap), "=" * 61))
532 | else:
533 | sys.stdout.write("%s\n%s%9s%s%9s\n%s\n" %
534 | ("-" * 45, " " * 24, human(total), " " * 3,
535 | human(total_swap), "=" * 45))
536 | else:
537 | sys.stdout.write("%s\n%s%9s\n%s\n" %
538 | ("-" * 33, " " * 24, human(total), "=" * 33))
539 |
540 |
541 | def verify_environment():
542 | if os.geteuid() != 0:
543 | sys.stderr.write("Sorry, root permission required.\n")
544 | sys.stderr.close()
545 | sys.exit(1)
546 |
547 | try:
548 | kernel_ver()
549 | except (IOError, OSError):
550 | val = sys.exc_info()[1]
551 | if val.errno == errno.ENOENT:
552 | sys.stderr.write(
553 | "Couldn't access " + proc.path('') + "\n"
554 | "Only GNU/Linux and FreeBSD (with linprocfs) are supported\n")
555 | sys.exit(2)
556 | else:
557 | raise
558 |
559 | def main():
560 | split_args, pids_to_show, watch, only_total, discriminate_by_pid, \
561 | show_swap = parse_options()
562 |
563 | verify_environment()
564 |
565 | if not only_total:
566 | print_header(show_swap, discriminate_by_pid)
567 |
568 | if watch is not None:
569 | try:
570 | sorted_cmds = True
571 | while sorted_cmds:
572 | sorted_cmds, shareds, count, total, swaps, shared_swaps, \
573 | total_swap, total_shared_swap = \
574 | get_memory_usage(pids_to_show, split_args,
575 | discriminate_by_pid)
576 | if only_total and have_pss:
577 | sys.stdout.write(human(total, units=1)+'\n')
578 | elif not only_total:
579 | print_memory_usage(sorted_cmds, shareds, count, total,
580 | swaps, total_swap, shared_swaps,
581 | total_shared_swap, show_swap)
582 |
583 | sys.stdout.flush()
584 | time.sleep(watch)
585 | else:
586 | sys.stdout.write('Process does not exist anymore.\n')
587 | except KeyboardInterrupt:
588 | pass
589 | else:
590 | # This is the default behavior
591 | sorted_cmds, shareds, count, total, swaps, shared_swaps, total_swap, \
592 | total_shared_swap = get_memory_usage(pids_to_show, split_args,
593 | discriminate_by_pid)
594 | if only_total and have_pss:
595 | sys.stdout.write(human(total, units=1)+'\n')
596 | elif not only_total:
597 | print_memory_usage(sorted_cmds, shareds, count, total, swaps,
598 | total_swap, shared_swaps, total_shared_swap,
599 | show_swap)
600 |
601 | # We must close explicitly, so that any EPIPE exception
602 | # is handled by our excepthook, rather than the default
603 | # one which is reenabled after this script finishes.
604 | sys.stdout.close()
605 |
606 | vm_accuracy = shared_val_accuracy()
607 | show_shared_val_accuracy( vm_accuracy, only_total )
608 |
609 | if __name__ == '__main__': main()
610 |
611 |
--------------------------------------------------------------------------------