├── 4012171442.docx ├── 5_6116109553504354307.xlsx ├── DenyHosts ├── Google drive无限网盘+离线下载+在线观看三部曲 _ 柠檬极客 _ lemongeek.pdf ├── README.md ├── Torrent_To_Google_Drive_Downloader.ipynb ├── aws-sources.list ├── az.ps1 ├── baiduip ├── docker ├── README.md └── daemon.json ├── hosts ├── orc-sources.list ├── photoshop ├── Photoshop.md ├── processing └── 插件 │ ├── SandStorm.atn │ └── processing晕染效果.rar ├── pic ├── AdobeStock_277208453.jpeg ├── AdobeStock_429138645.jpeg ├── Konachan.com_343571.jpg └── log1.jpg ├── shadowsocks ├── sources.list ├── sspanel ├── docker-compose(破解版后端镜像).yml └── install.sh ├── ssrlibev ├── ss-local ├── ss-redir └── 教程 ├── stopping服务器禁ping ├── swap 添加.md ├── vpsbanip ├── wls-sources.list ├── 双系统安装 ├── 合并txt.sh └── 端口转发 ├── iptables-pf.sh └── natcfg.sh /4012171442.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/4012171442.docx -------------------------------------------------------------------------------- /5_6116109553504354307.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/5_6116109553504354307.xlsx -------------------------------------------------------------------------------- /DenyHosts: -------------------------------------------------------------------------------- 1 | DenyHosts 2 | 3 | # DenyHosts 4 | 5 | dpkg --configure -a 6 | 7 | sudo apt-get install denyhosts 8 | 9 | 10 | service denyhosts start 11 | Usage: /etc/init.d/denyhosts {start|stop|restart|force-reload|status} 12 | 13 | 14 | 15 | 你可以前往官网http://sourceforge.net/projects/denyhost/ 选择一个你喜欢的版本下载,或者直接运行下面的命令下载。 16 | cd /tmp/ && wget http://jaist.dl.sourceforge.net/project/denyhost/denyhost-2.10/denyhosts-2.10.tar.gz 17 | #解压 18 | tar xzvf denyhosts-2.10.tar.gz 19 | #切换到目录 20 | cd denyhosts 21 | #安装 22 | sudo python setup.py install 23 | 配置 24 | 经过上面这几步,基本已经完成了denyhosts 的安装,下面我们还需要进行一些配置。 25 | #复制daemon文件到init.d 目录 26 | sudo cp /usr/local/bin/daemon-control-dist /etc/init.d/denyhosts 27 | sudo vim /etc/init.d/denyhosts 28 | #A:将打开的文件里面的DENYHOSTS_BIN 修改为你自己denyhosts的目录,一般应该是/usr/local/bin/denyhosts.py 29 | #B:或者是建立一个软连接 30 | ln -s /usr/local/bin/denyhosts.py /usr/sbin/denyhosts 31 | 32 | #注意:A或者B只需要执行一个就行了! 33 | 现在denyhosts 就已经安装配置好了,我们可以先把我们自己的IP加到系统的白名单里面 34 | #编辑白名单 35 | 36 | sudo vim /etc/hosts.allow 37 | 38 | #按下面的样例添加你的IP 39 | 40 | # /etc/hosts.allow: list of hosts that are allowed to access the system. 41 | # See the manual pages hosts_access(5) and hosts_options(5). 42 | # 43 | # Example: ALL: LOCAL @wangheng.org 44 | # ALL: .wangheng.org EXCEPT terminalserver.wangheng.org 45 | # 46 | # If you’re going to protect the portmapper use the name “rpcbind” for the 47 | # daemon name. See rpcbind(8) and rpc.mountd(8) for further information. 48 | # 49 | sshd: 123.123.123.123 50 | 编辑保存后,我们需要重启一下服务: 51 | 52 | sudo /etc/init.d/denyhosts restart 53 | 54 | 55 | 56 | 57 | 58 | 安装 59 | 60 | # aptitude install denyhosts 61 | 配置 62 | 63 | # vim /etc/denyhosts.conf 64 | # 用户登录的日志文件 65 | SECURE_LOG = /var/log/secure 66 | # 禁止登陆的主机文件 67 | HOSTS_DENY = /etc/hosts.deny 68 | # 清除已禁止主机的时间,y年,w星期,d天 69 | PURGE_DENY = 2w 70 | # 禁止的服务名 71 | BLOCK_SERVICE = sshd 72 | # 允许无效用户登录失败的次数 73 | DENY_THRESHOLD_INVALID = 1 74 | # 允许普通用户登陆失败的次数(root用户除外),用户数据文件/etc/passwd 75 | DENY_THRESHOLD_VALID = 2 76 | # 允许 root 用户登陆失败的次数 77 | DENY_THRESHOLD_ROOT = 1 78 | # 限制restricted-usernames文件列表中用户登录失败的次数 79 | DENY_THRESHOLD_RESTRICTED = 5 80 | # DenyHosts 数据保存目录 81 | WORK_DIR = /usr/share/denyhosts/data 82 | SUSPICIOUS_LOGIN_REPORT_ALLOWED_HOSTS=YES 83 | # 是否做域名反解 84 | HOSTNAME_LOOKUP=YES 85 | #程序的进程ID 当DenyHOts启动的时候写入 pid,已确保服务正确启动,防止同時启动多个服务 86 | LOCK_FILE = /var/run/denyhosts.pid 87 | # 管理员邮件地址 88 | ADMIN_EMAIL = admin@domain.com 89 | # 如果设置了 ADMIN_EMAIL 下面就要设置 smtp 的 host 90 | SMTP_HOST = localhost 91 | SMTP_PORT = 25 92 | # 发信的 header 93 | SMTP_FROM = DenyHosts 94 | # 发信标题 如果你有N台主机,需要修改发信标题,来识别来自那台机器的信 95 | SMTP_SUBJECT = DenyHosts Report 96 | # 用户的失败登录计数重置为0的时间(/etc/passwd) 97 | AGE_RESET_VALID=5d 98 | # root用户失败登录计数重置为0的时间 99 | AGE_RESET_ROOT=25d 100 | #用户的失败登录计数重置为0的时间(/usr/share/denyhosts/data/restricted-usernames) 101 | AGE_RESET_RESTRICTED=25d 102 | # 无效用户的失败登录计数重置为0的时间(/etc/passwd) 103 | AGE_RESET_INVALID=10d 104 | # DenyHosts 的日志文件 105 | DAEMON_LOG = /var/log/denyhosts 106 | 以上根据自己的需要修改即可,一般主要修改三种用户登录失败的次数,还有管理员的邮件地址即可,其他的使用系统默认就行。 107 | 配置完重启使服务生效 108 | /etc/init.d/denyhosts restart 109 | -------------------------------------------------------------------------------- /Google drive无限网盘+离线下载+在线观看三部曲 _ 柠檬极客 _ lemongeek.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/Google drive无限网盘+离线下载+在线观看三部曲 _ 柠檬极客 _ lemongeek.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # note 2 | 笔记 3 | 4 | #phostshop 5 | 6 | 风暴效果/破碎效果 动作 [ ](https://github.com/aiastia/note/blob/master/photoshop/Photoshop.md ) 7 | -------------------------------------------------------------------------------- /Torrent_To_Google_Drive_Downloader.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat": 4, 3 | "nbformat_minor": 0, 4 | "metadata": { 5 | "colab": { 6 | "name": "Torrent To Google Drive Downloader", 7 | "provenance": [], 8 | "collapsed_sections": [], 9 | "include_colab_link": true 10 | }, 11 | "kernelspec": { 12 | "display_name": "Python 3", 13 | "language": "python", 14 | "name": "python3" 15 | } 16 | }, 17 | "cells": [ 18 | { 19 | "cell_type": "markdown", 20 | "metadata": { 21 | "id": "view-in-github", 22 | "colab_type": "text" 23 | }, 24 | "source": [ 25 | "\"Open" 26 | ] 27 | }, 28 | { 29 | "cell_type": "markdown", 30 | "metadata": { 31 | "id": "aQuWDmfm9YOi", 32 | "colab_type": "text" 33 | }, 34 | "source": [ 35 | "# Torrent To Google Drive Downloader " 36 | ] 37 | }, 38 | { 39 | "cell_type": "markdown", 40 | "metadata": { 41 | "id": "qYk44mBwJf6E", 42 | "colab_type": "text" 43 | }, 44 | "source": [ 45 | "**Important Note:** To get more disk space:\n", 46 | "> Go to Runtime -> Change Runtime and give GPU as the Hardware Accelerator. You will get around 384GB to download any torrent you want." 47 | ] 48 | }, 49 | { 50 | "cell_type": "markdown", 51 | "metadata": { 52 | "id": "NaFa7M-e9YOr", 53 | "colab_type": "text" 54 | }, 55 | "source": [ 56 | "### Install libtorrent and Initialize Session" 57 | ] 58 | }, 59 | { 60 | "cell_type": "code", 61 | "metadata": { 62 | "colab_type": "code", 63 | "id": "m6hF0emftx4h", 64 | "colab": {} 65 | }, 66 | "source": [ 67 | "!apt install python3-libtorrent\n", 68 | "\n", 69 | "import libtorrent as lt\n", 70 | "\n", 71 | "ses = lt.session()\n", 72 | "ses.listen_on(6881, 6891)\n", 73 | "downloads = []" 74 | ], 75 | "execution_count": 0, 76 | "outputs": [] 77 | }, 78 | { 79 | "cell_type": "markdown", 80 | "metadata": { 81 | "id": "Uf90U73y9YOj", 82 | "colab_type": "text" 83 | }, 84 | "source": [ 85 | "### Mount Google Drive\n", 86 | "To stream files we need to mount Google Drive." 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "metadata": { 92 | "colab_type": "code", 93 | "id": "oWM9l2fvtuvO", 94 | "colab": {} 95 | }, 96 | "source": [ 97 | "from google.colab import drive\n", 98 | "\n", 99 | "drive.mount(\"/content/drive\")" 100 | ], 101 | "execution_count": 0, 102 | "outputs": [] 103 | }, 104 | { 105 | "cell_type": "markdown", 106 | "metadata": { 107 | "id": "R_1XuuIf9YOn", 108 | "colab_type": "text" 109 | }, 110 | "source": [ 111 | "### Add From Torrent File\n", 112 | "You can run this cell to add more files as many times as you want" 113 | ] 114 | }, 115 | { 116 | "cell_type": "code", 117 | "metadata": { 118 | "colab_type": "code", 119 | "id": "0et2A6N3udA0", 120 | "colab": {} 121 | }, 122 | "source": [ 123 | "from google.colab import files\n", 124 | "\n", 125 | "source = files.upload()\n", 126 | "params = {\n", 127 | " \"save_path\": \"/content/drive/My Drive/Torrent\",\n", 128 | " \"ti\": lt.torrent_info(list(source.keys())[0]),\n", 129 | "}\n", 130 | "downloads.append(ses.add_torrent(params))" 131 | ], 132 | "execution_count": 0, 133 | "outputs": [] 134 | }, 135 | { 136 | "cell_type": "markdown", 137 | "metadata": { 138 | "id": "WD-6M6eZyzmj", 139 | "colab_type": "text" 140 | }, 141 | "source": [ 142 | "### Add From Magnet Link\n", 143 | "You can run this cell to add more files as many times as you want" 144 | ] 145 | }, 146 | { 147 | "cell_type": "code", 148 | "metadata": { 149 | "id": "Cwi1GMlxy3te", 150 | "colab_type": "code", 151 | "colab": {} 152 | }, 153 | "source": [ 154 | "params = {\"save_path\": \"/content/drive/My Drive/Torrent\"}\n", 155 | "\n", 156 | "while True:\n", 157 | " magnet_link = input(\"Enter Magnet Link Or Type Exit: \")\n", 158 | " if magnet_link.lower() == \"exit\":\n", 159 | " break\n", 160 | " downloads.append(\n", 161 | " lt.add_magnet_uri(ses, magnet_link, params)\n", 162 | " )\n" 163 | ], 164 | "execution_count": 0, 165 | "outputs": [] 166 | }, 167 | { 168 | "cell_type": "markdown", 169 | "metadata": { 170 | "id": "m-a1CUP39YOu", 171 | "colab_type": "text" 172 | }, 173 | "source": [ 174 | "### Start Download\n", 175 | "Source: https://stackoverflow.com/a/5494823/7957705 and [#3 issue](https://github.com/FKLC/Torrent-To-Google-Drive-Downloader/issues/3) which refers to this [stackoverflow question](https://stackoverflow.com/a/6053350/7957705)" 176 | ] 177 | }, 178 | { 179 | "cell_type": "code", 180 | "metadata": { 181 | "colab_type": "code", 182 | "id": "DBNoYYoSuDBT", 183 | "colab": {} 184 | }, 185 | "source": [ 186 | "import time\n", 187 | "from IPython.display import display\n", 188 | "import ipywidgets as widgets\n", 189 | "\n", 190 | "state_str = [\n", 191 | " \"queued\",\n", 192 | " \"checking\",\n", 193 | " \"downloading metadata\",\n", 194 | " \"downloading\",\n", 195 | " \"finished\",\n", 196 | " \"seeding\",\n", 197 | " \"allocating\",\n", 198 | " \"checking fastresume\",\n", 199 | "]\n", 200 | "\n", 201 | "layout = widgets.Layout(width=\"auto\")\n", 202 | "style = {\"description_width\": \"initial\"}\n", 203 | "download_bars = [\n", 204 | " widgets.FloatSlider(\n", 205 | " step=0.01, disabled=True, layout=layout, style=style\n", 206 | " )\n", 207 | " for _ in downloads\n", 208 | "]\n", 209 | "display(*download_bars)\n", 210 | "\n", 211 | "while downloads:\n", 212 | " next_shift = 0\n", 213 | " for index, download in enumerate(downloads[:]):\n", 214 | " bar = download_bars[index + next_shift]\n", 215 | " if not download.is_seed():\n", 216 | " s = download.status()\n", 217 | "\n", 218 | " bar.description = \" \".join(\n", 219 | " [\n", 220 | " download.name(),\n", 221 | " str(s.download_rate / 1000),\n", 222 | " \"kB/s\",\n", 223 | " state_str[s.state],\n", 224 | " ]\n", 225 | " )\n", 226 | " bar.value = s.progress * 100\n", 227 | " else:\n", 228 | " next_shift -= 1\n", 229 | " ses.remove_torrent(download)\n", 230 | " downloads.remove(download)\n", 231 | " bar.close() # Seems to be not working in Colab (see https://github.com/googlecolab/colabtools/issues/726#issue-486731758)\n", 232 | " download_bars.remove(bar)\n", 233 | " print(download.name(), \"complete\")\n", 234 | " time.sleep(1)\n" 235 | ], 236 | "execution_count": 0, 237 | "outputs": [] 238 | } 239 | ] 240 | } -------------------------------------------------------------------------------- /aws-sources.list: -------------------------------------------------------------------------------- 1 | ## Note, this file is written by cloud-init on first boot of an instance 2 | ## modifications made here will not survive a re-bundle. 3 | ## if you wish to make changes you can: 4 | ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg 5 | ## or do the same in user-data 6 | ## b.) add sources in /etc/apt/sources.list.d 7 | ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl 8 | 9 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 10 | # newer versions of the distribution. 11 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal main restricted 12 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal main restricted 13 | 14 | ## Major bug fix updates produced after the final release of the 15 | ## distribution. 16 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates main restricted 17 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates main restricted 18 | 19 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 20 | ## team. Also, please note that software in universe WILL NOT receive any 21 | ## review or updates from the Ubuntu security team. 22 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal universe 23 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal universe 24 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates universe 25 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates universe 26 | 27 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 28 | ## team, and may not be under a free licence. Please satisfy yourself as to 29 | ## your rights to use the software. Also, please note that software in 30 | ## multiverse WILL NOT receive any review or updates from the Ubuntu 31 | ## security team. 32 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal multiverse 33 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal multiverse 34 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates multiverse 35 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-updates multiverse 36 | 37 | ## N.B. software from this repository may not have been tested as 38 | ## extensively as that contained in the main release, although it includes 39 | ## newer versions of some applications which may provide useful features. 40 | ## Also, please note that software in backports WILL NOT receive any review 41 | ## or updates from the Ubuntu security team. 42 | deb http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse 43 | # deb-src http://ap-northeast-1.ec2.archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse 44 | 45 | ## Uncomment the following two lines to add software from Canonical's 46 | ## 'partner' repository. 47 | ## This software is not part of Ubuntu, but is offered by Canonical and the 48 | ## respective vendors as a service to Ubuntu users. 49 | # deb http://archive.canonical.com/ubuntu focal partner 50 | # deb-src http://archive.canonical.com/ubuntu focal partner 51 | 52 | deb http://security.ubuntu.com/ubuntu focal-security main restricted 53 | # deb-src http://security.ubuntu.com/ubuntu focal-security main restricted 54 | deb http://security.ubuntu.com/ubuntu focal-security universe 55 | # deb-src http://security.ubuntu.com/ubuntu focal-security universe 56 | deb http://security.ubuntu.com/ubuntu focal-security multiverse 57 | # deb-src http://security.ubuntu.com/ubuntu focal-security multiverse 58 | -------------------------------------------------------------------------------- /az.ps1: -------------------------------------------------------------------------------- 1 | az ad sp create-for-rbac --role contributor --years 99 --scopes /subscriptions/$(az account list --query [].id -o tsv) >ls.txt 2 | -------------------------------------------------------------------------------- /baiduip: -------------------------------------------------------------------------------- 1 | 来自破娃酱的博客 自己留作备份 2 | 3 | 复制下面内容到host 4 | 5 | 1.0.0.1 api.map.baidu.com 6 | 7 | 1.0.0.1 ps.map.baidu.com 8 | 9 | 1.0.0.1 sv.map.baidu.com 10 | 11 | 1.0.0.1 offnavi.map.baidu.com 12 | 13 | 1.0.0.1 newvector.map.baidu.com 14 | 15 | 1.0.0.1 ulog.imap.baidu.com 16 | 17 | 1.0.0.1 newloc.map.n.shifen.com 18 | 19 | ::2 api.map.baidu.com 20 | 21 | ::2 ps.map.baidu.com 22 | 23 | ::2 sv.map.baidu.com 24 | 25 | ::2 offnavi.map.baidu.com 26 | 27 | ::2 newvector.map.baidu.com 28 | 29 | ::2 ulog.imap.baidu.com 30 | 31 | ::2 newloc.map.n.shifen.com 32 | 33 | 以上写法会让连接超时等待,如果你希望连接立即拒绝断开,那么把"1.0.0.1"改为"0.0.0.0",把"::2"改为"::"即可 34 | 35 | 如果你使用代理,那么在代理服务器及本地都最好设置一下 原链接 ——https://breakwa11.blogspot.com/2016/12/baidu.html 36 | -------------------------------------------------------------------------------- /docker/README.md: -------------------------------------------------------------------------------- 1 | sudo wget -O /etc/docker/daemon.json https://raw.githubusercontent.com/aiastia/note/master/docker/daemon.json 2 | -------------------------------------------------------------------------------- /docker/daemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "log-driver": "json-file", 3 | "log-opts": { 4 | "max-size": "20m", 5 | "max-file": "3" 6 | }, 7 | "ipv6": true, 8 | "experimental": true, 9 | "ip6tables": true, 10 | "dns": ["8.8.8.8", "1.1.1.1"] 11 | } 12 | -------------------------------------------------------------------------------- /hosts: -------------------------------------------------------------------------------- 1 | 2 | # Copyright (c) 1993-2009 Microsoft Corp. 3 | # 4 | # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. 5 | # 6 | # This file contains the mappings of IP addresses to host names. Each 7 | # entry should be kept on an individual line. The IP address should 8 | # be placed in the first column followed by the corresponding host name. 9 | # The IP address and the host name should be separated by at least one 10 | # space. 11 | # 12 | # Additionally, comments (such as these) may be inserted on individual 13 | # lines or following the machine name denoted by a '#' symbol. 14 | # 15 | # For example: 16 | # 17 | # 102.54.94.97 rhino.acme.com # source server 18 | # 38.25.63.10 x.acme.com # x client host 19 | 20 | # localhost name resolution is handled within DNS itself. 21 | # 127.0.0.1 localhost 22 | # ::1 localhost 23 | -------------------------------------------------------------------------------- /orc-sources.list: -------------------------------------------------------------------------------- 1 | ## Note, this file is written by cloud-init on first boot of an instance 2 | ## modifications made here will not survive a re-bundle. 3 | ## if you wish to make changes you can: 4 | ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg 5 | ## or do the same in user-data 6 | ## b.) add sources in /etc/apt/sources.list.d 7 | ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl 8 | 9 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 10 | # newer versions of the distribution. 11 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal main restricted 12 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal main restricted 13 | 14 | ## Major bug fix updates produced after the final release of the 15 | ## distribution. 16 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted 17 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates main restricted 18 | 19 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 20 | ## team. Also, please note that software in universe WILL NOT receive any 21 | ## review or updates from the Ubuntu security team. 22 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal universe 23 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal universe 24 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates universe 25 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates universe 26 | 27 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 28 | ## team, and may not be under a free licence. Please satisfy yourself as to 29 | ## your rights to use the software. Also, please note that software in 30 | ## multiverse WILL NOT receive any review or updates from the Ubuntu 31 | ## security team. 32 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal multiverse 33 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal multiverse 34 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates multiverse 35 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-updates multiverse 36 | 37 | ## N.B. software from this repository may not have been tested as 38 | ## extensively as that contained in the main release, although it includes 39 | ## newer versions of some applications which may provide useful features. 40 | ## Also, please note that software in backports WILL NOT receive any review 41 | ## or updates from the Ubuntu security team. 42 | deb http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse 43 | # deb-src http://phx-ad-3.clouds.ports.ubuntu.com/ubuntu-ports/ focal-backports main restricted universe multiverse 44 | 45 | ## Uncomment the following two lines to add software from Canonical's 46 | ## 'partner' repository. 47 | ## This software is not part of Ubuntu, but is offered by Canonical and the 48 | ## respective vendors as a service to Ubuntu users. 49 | # deb http://archive.canonical.com/ubuntu focal partner 50 | # deb-src http://archive.canonical.com/ubuntu focal partner 51 | 52 | deb http://ports.ubuntu.com/ubuntu-ports focal-security main restricted 53 | # deb-src http://ports.ubuntu.com/ubuntu-ports focal-security main restricted 54 | deb http://ports.ubuntu.com/ubuntu-ports focal-security universe 55 | # deb-src http://ports.ubuntu.com/ubuntu-ports focal-security universe 56 | deb http://ports.ubuntu.com/ubuntu-ports focal-security multiverse 57 | # deb-src http://ports.ubuntu.com/ubuntu-ports focal-security multiverse 58 | -------------------------------------------------------------------------------- /photoshop/Photoshop.md: -------------------------------------------------------------------------------- 1 | #准备工作 2 | 3 | 插件是国外的。所以载入之前要把ps改成英文版 4 | ps6&pscc改英文Adobe Photoshop CS6\Adobe Photoshop CS6\Locales\zh_CN\Support Files这是路径。 5 | 里面有一个tw10428.dat的文件重命名,在tw前面随便加上字母或数字就变成英文啦! 6 | 7 | 8 | 9 | 第一步:alt+F9调出动作 10 | 第二步:点击动作工具栏右上角的选项找到Load Actions. 11 | 第三步&第四部:找到下载好的动作载入 然后,你就会发现动作工具栏里多了一个SandStorm的组,里面的上下左右我相信你们能看懂。 12 | 最后, 13 | 选一张分辨率较大的图 14 | 用画笔画出需要改变的位置 15 | 选择一个方向 16 | 开始渲染 17 | 18 | 19 | 需要注意的是处理的图像长度和高度必须大于1500px 20 | 打开图片后使用快捷键ctrl+Alt+i调整图片宽高 21 | Width=宽度 22 | Height=宽度 23 | 紫色框框里的就是px了,只要两个大于1500即可。 24 | 25 | #开始 26 | 27 | 点击Layer--New--Layer from Background 28 | 29 | 然后命名为Background,大小写必须一样! 30 | 31 | 建立好后点击下面的那个新建图层图标 32 | 33 | 新建图层名为brush(必须小写) 34 | 35 | 然后用笔刷愉快的划上你想修改的区域吧 36 | 37 | 然后,有上下左右中间五个选项,点击你要的方向,然后点击下面的运行即可 38 | 39 | 40 | #补充 41 | 42 | PS动作使用方法: 43 | 准备: 44 | 45 | 1、最好使用英文版PS,版本要求Photoshop CS6以上 46 | 47 | 2、如果不能通过 编辑首选项—选项卡 来修改使用语言的话,可以尝试一下:找到安装目录如下:【X:\Adobe PhotoshopCS6\Locales\zh_CN\Support Files\tw10428.dat】把【tw10428.dat】文件重命名为【tw10428_bak.dat】即可,如果需要恢复中文版,把文件名修改回去即可。 48 | 49 | ▼使用: 50 | 1、打开一个图片,Layer(图层)-New(新建)-Background from layer 51 | 52 | 2、新建一空白图层,命名为“brush” 53 | 54 | 3、载入动作 55 | 56 | 4、点击动作运行(left right...想要那个方向爆破,就运行哪个。) 57 | 58 | -------------------------------------------------------------------------------- /photoshop/processing: -------------------------------------------------------------------------------- 1 | processing 制作灰飞烟灭的效果 2 | 3 | 4 | 5 | 用processing 2.2.1 6 | 7 | 分享一下之前在 openprocessing 网站上看到一个晕染效果的sketch,有水墨晕染的效果也有烟云缭绕的感觉,操作简单,效果很赞。 8 | (下载软件,直接将分享的文件打开,载入图片,就可以得到效果。最后附有下载地址,安装processing可以直接打开) 9 | 10 | 将图片载入processing软件里运行 11 | 不仅有烟云缭绕的感觉,而且体积感强,强调了烟云的镂空感,高光阴影很好保留。 12 | 下一步只需要在ps中再使用烟云画笔和颗粒画笔在边缘稍作修饰就可以。 13 | 前两种笔刷搜索smoke brush 就能找到, 第三种是ps中自带的笔刷 14 | 15 | # 讨论 16 | 17 | 18 | 在最后加一句 19 | void keyPressed(){ 20 | save("xx.jpg"); 21 | } 22 | 生成图像后 随意按下键盘的一个键 Ctrl+k 弹出文件夹,图像应该就保存在里边。 23 | 24 | 25 | 26 | 在前面代码中有 void keyPress() 27 | {background(bg);} 28 | 添加后 删掉这个就可以了 确认 29 | 30 | 31 | 32 | 如果跟上边有冲突,试下指定按键 33 | 34 | 35 | void keyPressed(){ 36 | if (key == 's') { 37 | save("xx.jpg"); 38 | } 39 | } 40 | 41 | 42 | 最终确认 43 | 44 | 45 | void keyPressed(){ 46 | if (key == 's') { 47 | save("xx.jpg"); 48 | } 49 | if (key == 'x') 50 | { background(bg); } 51 | } 52 | -------------------------------------------------------------------------------- /photoshop/插件/SandStorm.atn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/photoshop/插件/SandStorm.atn -------------------------------------------------------------------------------- /photoshop/插件/processing晕染效果.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/photoshop/插件/processing晕染效果.rar -------------------------------------------------------------------------------- /pic/AdobeStock_277208453.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/pic/AdobeStock_277208453.jpeg -------------------------------------------------------------------------------- /pic/AdobeStock_429138645.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/pic/AdobeStock_429138645.jpeg -------------------------------------------------------------------------------- /pic/Konachan.com_343571.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/pic/Konachan.com_343571.jpg -------------------------------------------------------------------------------- /pic/log1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/pic/log1.jpg -------------------------------------------------------------------------------- /shadowsocks: -------------------------------------------------------------------------------- 1 | ssr 客户端运行方法 2 | 3 | python版 4 | 5 | python local.py -c /home/aiastia/ss/shadowsocksr/config.json 6 | 7 | 8 | ss-local 9 | 10 | 11 | ss-redir -c /home/aiastia/ss/shadowsocksr/config.json 12 | -------------------------------------------------------------------------------- /sources.list: -------------------------------------------------------------------------------- 1 | ## Note, this file is written by cloud-init on first boot of an instance 2 | ## modifications made here will not survive a re-bundle. 3 | ## if you wish to make changes you can: 4 | ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg 5 | ## or do the same in user-data 6 | ## b.) add sources in /etc/apt/sources.list.d 7 | ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl 8 | 9 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 10 | # newer versions of the distribution. 11 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic main restricted 12 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic main restricted 13 | 14 | ## Major bug fix updates produced after the final release of the 15 | ## distribution. 16 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main restricted 17 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates main restricted 18 | 19 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 20 | ## team. Also, please note that software in universe WILL NOT receive any 21 | ## review or updates from the Ubuntu security team. 22 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic universe 23 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic universe 24 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe 25 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates universe 26 | 27 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 28 | ## team, and may not be under a free licence. Please satisfy yourself as to 29 | ## your rights to use the software. Also, please note that software in 30 | ## multiverse WILL NOT receive any review or updates from the Ubuntu 31 | ## security team. 32 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic multiverse 33 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic multiverse 34 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic-updates multiverse 35 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-updates multiverse 36 | 37 | ## N.B. software from this repository may not have been tested as 38 | ## extensively as that contained in the main release, although it includes 39 | ## newer versions of some applications which may provide useful features. 40 | ## Also, please note that software in backports WILL NOT receive any review 41 | ## or updates from the Ubuntu security team. 42 | deb http://azure.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 43 | # deb-src http://azure.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse 44 | 45 | ## Uncomment the following two lines to add software from Canonical's 46 | ## 'partner' repository. 47 | ## This software is not part of Ubuntu, but is offered by Canonical and the 48 | ## respective vendors as a service to Ubuntu users. 49 | # deb http://archive.canonical.com/ubuntu bionic partner 50 | # deb-src http://archive.canonical.com/ubuntu bionic partner 51 | 52 | deb http://security.ubuntu.com/ubuntu bionic-security main restricted 53 | # deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted 54 | deb http://security.ubuntu.com/ubuntu bionic-security universe 55 | # deb-src http://security.ubuntu.com/ubuntu bionic-security universe 56 | deb http://security.ubuntu.com/ubuntu bionic-security multiverse 57 | # deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse 58 | -------------------------------------------------------------------------------- /sspanel/docker-compose(破解版后端镜像).yml: -------------------------------------------------------------------------------- 1 | version: '2' 2 | 3 | services: 4 | v2ray: 5 | image: woaizyg/rico-free:v2ray 6 | restart: always 7 | network_mode: "host" 8 | extra_hosts: 9 | auth.rico93.com: 127.0.0.1 10 | environment: 11 | sspanel_url: "https://xxxx" 12 | key: "xxxx" 13 | docker: "true" 14 | speedtest: 6 15 | node_id: 10 16 | api_port: 2333 17 | downWithPanel: 1 18 | LDNS: "1.1.1.1" 19 | TZ: "Asia/Shanghai" 20 | MYSQLHOST: "https://bing.com" 21 | MYSQLDBNAME: "demo_dbname" 22 | MYSQLUSR: "demo_user" 23 | MYSQLPASSWD: "demo_dbpassword" 24 | MYSQLPORT: 3306 25 | PANELTYPE: 0 26 | usemysql: 0 27 | CF_Key: "bbbbbbbbbbbbbbbbbb" 28 | CF_Email: "getbackcn@gmail.com" 29 | volumes: 30 | - /etc/localtime:/etc/localtime:ro 31 | logging: 32 | options: 33 | max-size: "10m" 34 | max-file: "3" 35 | 36 | caddy: 37 | image: woaizyg/rico-free:caddy 38 | restart: always 39 | environment: 40 | - ACME_AGREE=true 41 | # if u want to use cloudflare (for DNS challenge authentication) 42 | # - CLOUDFLARE_EMAIL=xxxxxx@out.look.com 43 | # - CLOUDFLARE_API_KEY=xxxxxxx 44 | - V2RAY_DOMAIN=xxxx.com 45 | - V2RAY_PATH=/v2ray 46 | - V2RAY_EMAIL=xxxx@outlook.com 47 | - V2RAY_PORT=10550 48 | - V2RAY_OUTSIDE_PORT=443 49 | - TZ=Asia/Shanghai 50 | network_mode: "host" 51 | volumes: 52 | - ./.caddy:/root/.caddy 53 | - ./Caddyfile:/etc/Caddyfile -------------------------------------------------------------------------------- /sspanel/install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | 5 | # Current folder 6 | cur_dir=`pwd` 7 | # Color 8 | red='\033[0;31m' 9 | green='\033[0;32m' 10 | yellow='\033[0;33m' 11 | plain='\033[0m' 12 | software=(使用自签证书的WSS模式 使用CF证书的WSS模式 TCP模式且同时支持WS模式) 13 | operation=(全新安装 更新配置 更新镜像 查看日志) 14 | # Make sure only root can run our script 15 | [[ $EUID -ne 0 ]] && echo -e "[${red}Error${plain}] 你没权没势 请先获取ROOT权限!" && exit 1 16 | 17 | #Check system 18 | check_sys(){ 19 | local checkType=$1 20 | local value=$2 21 | 22 | local release='' 23 | local systemPackage='' 24 | 25 | if [[ -f /etc/redhat-release ]]; then 26 | release="centos" 27 | systemPackage="yum" 28 | elif grep -Eqi "debian|raspbian" /etc/issue; then 29 | release="debian" 30 | systemPackage="apt" 31 | elif grep -Eqi "ubuntu" /etc/issue; then 32 | release="ubuntu" 33 | systemPackage="apt" 34 | elif grep -Eqi "centos|red hat|redhat" /etc/issue; then 35 | release="centos" 36 | systemPackage="yum" 37 | elif grep -Eqi "debian|raspbian" /proc/version; then 38 | release="debian" 39 | systemPackage="apt" 40 | elif grep -Eqi "ubuntu" /proc/version; then 41 | release="ubuntu" 42 | systemPackage="apt" 43 | elif grep -Eqi "centos|red hat|redhat" /proc/version; then 44 | release="centos" 45 | systemPackage="yum" 46 | fi 47 | 48 | if [[ "${checkType}" == "sysRelease" ]]; then 49 | if [ "${value}" == "${release}" ]; then 50 | return 0 51 | else 52 | return 1 53 | fi 54 | elif [[ "${checkType}" == "packageManager" ]]; then 55 | if [ "${value}" == "${systemPackage}" ]; then 56 | return 0 57 | else 58 | return 1 59 | fi 60 | fi 61 | } 62 | 63 | # Get version 64 | getversion(){ 65 | if [[ -s /etc/redhat-release ]]; then 66 | grep -oE "[0-9.]+" /etc/redhat-release 67 | else 68 | grep -oE "[0-9.]+" /etc/issue 69 | fi 70 | } 71 | 72 | # CentOS version 73 | centosversion(){ 74 | if check_sys sysRelease centos; then 75 | local code=$1 76 | local version="$(getversion)" 77 | local main_ver=${version%%.*} 78 | if [ "$main_ver" == "$code" ]; then 79 | return 0 80 | else 81 | return 1 82 | fi 83 | else 84 | return 1 85 | fi 86 | } 87 | 88 | get_char(){ 89 | SAVEDSTTY=`stty -g` 90 | stty -echo 91 | stty cbreak 92 | dd if=/dev/tty bs=1 count=1 2> /dev/null 93 | stty -raw 94 | stty echo 95 | stty $SAVEDSTTY 96 | } 97 | error_detect_depends(){ 98 | local command=$1 99 | local depend=`echo "${command}" | awk '{print $4}'` 100 | echo -e "[${green}Info${plain}] 开始安装软件包 ${depend}" 101 | ${command} > /dev/null 2>&1 102 | if [ $? -ne 0 ]; then 103 | echo -e "[${red}Error${plain}] 软件包安装失败 ${red}${depend}${plain}" 104 | echo "请查看帮助网站: https://teddysun.com/486.html and contact." 105 | exit 1 106 | fi 107 | } 108 | 109 | # Pre-installation settings 110 | pre_install_docker_compose(){ 111 | # Set ssrpanel_url 112 | echo "请输入你SSP前端的网址" 113 | read -p "(http://xxx.com 有tls的换成https 注意网址最后不要有斜杠‘/’):" ssrpanel_url 114 | [ -z "${ssrpanel_url}" ] 115 | echo 116 | echo "---------------------------" 117 | echo "SSPanel网址 = ${ssrpanel_url}" 118 | echo "---------------------------" 119 | echo 120 | # Set ssrpanel key 121 | echo "你前端config文件里的Mukey值" 122 | read -p "(你网站目录/www/wwwroot/xxx/config.php 里面的mukey值 前后端要对应):" ssrpanel_key 123 | [ -z "${ssrpanel_key}" ] 124 | echo 125 | echo "---------------------------" 126 | echo "SSPanel通信密钥 = ${ssrpanel_key}" 127 | echo "---------------------------" 128 | echo 129 | 130 | # Set ssrpanel speedtest function 131 | echo "你打算隔多久进行一次节点网速测试" 132 | read -p "(多久一次: 回车默认6小时进行一次):" ssrpanel_speedtest 133 | [ -z "${ssrpanel_speedtest}" ] && ssrpanel_speedtest=6 134 | echo 135 | echo "---------------------------" 136 | echo "几小时一次 = ${ssrpanel_speedtest}" 137 | echo "---------------------------" 138 | echo 139 | 140 | # Set ssrpanel node_id 141 | echo "你前端节点信息里面的节点ID" 142 | read -p "(就你他妈前端添加节点后生成的ID 比如说是3这样子):" ssrpanel_node_id 143 | [ -z "${ssrpanel_node_id}" ] && ssrpanel_node_id=0 144 | echo 145 | echo "---------------------------" 146 | echo "SSPanel前端节点ID = ${ssrpanel_node_id}" 147 | echo "---------------------------" 148 | echo 149 | 150 | # Set V2ray backend API Listen port 151 | echo "请设置V2RAY的出口监听端口" 152 | read -p "(回车默认2333端口即可 如有多开合租请不要重复):" v2ray_api_port 153 | [ -z "${v2ray_api_port}" ] && v2ray_api_port=2333 154 | echo 155 | echo "---------------------------" 156 | echo "V2RAY出口监听端口 = ${v2ray_api_port}" 157 | echo "---------------------------" 158 | echo 159 | 160 | # Set Setting if the node go downwith panel 161 | echo "请问你前端面板是什么程序" 162 | read -p "(回车默认SSPANEL面板:1):" v2ray_downWithPanel 163 | [ -z "${v2ray_downWithPanel}" ] && v2ray_downWithPanel=1 164 | echo 165 | echo "---------------------------" 166 | echo "前端面板类型 = ${v2ray_downWithPanel}" 167 | echo "---------------------------" 168 | echo 169 | } 170 | 171 | pre_install_caddy(){ 172 | 173 | # Set caddy v2ray domain 174 | echo "请输入你解析到本节点服务器的域名" 175 | read -p "WS模式要求提供解析到本节点IP的网址:" v2ray_domain 176 | [ -z "${v2ray_domain}" ] 177 | echo 178 | echo "---------------------------" 179 | echo "伪装域名 = ${v2ray_domain}" 180 | echo "---------------------------" 181 | echo 182 | 183 | 184 | # Set caddy v2ray path 185 | echo "CADDY反代到V2RAY的虚拟目录" 186 | read -p "(务必于前端节点信息的Path值相同,回车默认: /v2ray):" v2ray_path 187 | [ -z "${v2ray_path}" ] && v2ray_path="/v2ray" 188 | echo 189 | echo "---------------------------" 190 | echo "伪装目录 = ${v2ray_path}" 191 | echo "---------------------------" 192 | echo 193 | 194 | # Set caddy v2ray tls email 195 | echo "前端获取TLS证书时登记的邮箱" 196 | read -p "直接回车默认即可(admin@admin.com):" v2ray_email 197 | [ -z "${v2ray_email}" ] && v2ray_email="admin@admin.com" 198 | echo 199 | echo "---------------------------" 200 | echo "证书邮箱 = ${v2ray_email}" 201 | echo "---------------------------" 202 | echo 203 | 204 | # Set Caddy v2ray listen port 205 | echo "V2RAY后端入口监听端口" 206 | read -p "(如多开合租注意请不要重复,回车默认端口: 10550):" v2ray_local_port 207 | [ -z "${v2ray_local_port}" ] && v2ray_local_port=10550 208 | echo 209 | echo "---------------------------" 210 | echo "V2RAY后端入口监听端口 = ${v2ray_local_port}" 211 | echo "---------------------------" 212 | echo 213 | 214 | # Set Caddy listen port 215 | echo "CADDY前端入口监听端口" 216 | read -p "(如多开合租注意请不要重复,回车默认端口: 443):" caddy_listen_port 217 | [ -z "${caddy_listen_port}" ] && caddy_listen_port=443 218 | echo 219 | echo "---------------------------" 220 | echo "CADDY前端入口监听端口 = ${caddy_listen_port}" 221 | echo "---------------------------" 222 | echo 223 | 224 | 225 | } 226 | 227 | # Config docker 228 | config_docker(){ 229 | echo "按任意键进行下一步...或者按 Ctrl+C 取消安装" 230 | char=`get_char` 231 | cd ${cur_dir} 232 | echo "开始安装软件包" 233 | install_dependencies 234 | echo "等待加载DOCKER配置文件" 235 | curl -L https://raw.githubusercontent.com/hulisang/v2ray-sspanel-v3-mod_Uim-plugin/master/Docker/V2ray/docker-compose.yml > docker-compose.yml 236 | sed -i "s|node_id:.*|node_id: ${ssrpanel_node_id}|" ./docker-compose.yml 237 | sed -i "s|sspanel_url:.*|sspanel_url: '${ssrpanel_url}'|" ./docker-compose.yml 238 | sed -i "s|key:.*|key: '${ssrpanel_key}'|" ./docker-compose.yml 239 | sed -i "s|speedtest:.*|speedtest: ${ssrpanel_speedtest}|" ./docker-compose.yml 240 | sed -i "s|api_port:.*|api_port: ${v2ray_api_port}|" ./docker-compose.yml 241 | sed -i "s|downWithPanel:.*|downWithPanel: ${v2ray_downWithPanel}|" ./docker-compose.yml 242 | } 243 | 244 | 245 | # Config caddy_docker 246 | config_caddy_docker(){ 247 | echo "按任意键进行下一步...或者按 Ctrl+C 取消安装" 248 | char=`get_char` 249 | cd ${cur_dir} 250 | echo "开始安装软件包" 251 | install_dependencies 252 | curl -L https://raw.githubusercontent.com/hulisang/v2ray-sspanel-v3-mod_Uim-plugin/master/Docker/Caddy_V2ray/Caddyfile > Caddyfile 253 | echo "等待加载DOCKER配置文件" 254 | curl -L https://raw.githubusercontent.com/hulisang/v2ray-sspanel-v3-mod_Uim-plugin/master/Docker/Caddy_V2ray/docker-compose.yml > docker-compose.yml 255 | sed -i "s|node_id:.*|node_id: ${ssrpanel_node_id}|" ./docker-compose.yml 256 | sed -i "s|sspanel_url:.*|sspanel_url: '${ssrpanel_url}'|" ./docker-compose.yml 257 | sed -i "s|key:.*|key: '${ssrpanel_key}'|" ./docker-compose.yml 258 | sed -i "s|speedtest:.*|speedtest: ${ssrpanel_speedtest}|" ./docker-compose.yml 259 | sed -i "s|api_port:.*|api_port: ${v2ray_api_port}|" ./docker-compose.yml 260 | sed -i "s|downWithPanel:.*|downWithPanel: ${v2ray_downWithPanel}|" ./docker-compose.yml 261 | sed -i "s|V2RAY_DOMAIN=xxxx.com|V2RAY_DOMAIN=${v2ray_domain}|" ./docker-compose.yml 262 | sed -i "s|V2RAY_PATH=/v2ray|V2RAY_PATH=${v2ray_path}|" ./docker-compose.yml 263 | sed -i "s|V2RAY_EMAIL=xxxx@outlook.com|V2RAY_EMAIL=${v2ray_email}|" ./docker-compose.yml 264 | sed -i "s|V2RAY_PORT=10550|V2RAY_PORT=${v2ray_local_port}|" ./docker-compose.yml 265 | sed -i "s|V2RAY_OUTSIDE_PORT=443|V2RAY_OUTSIDE_PORT=${caddy_listen_port}|" ./docker-compose.yml 266 | } 267 | 268 | # Config caddy_docker 269 | config_caddy_docker_cloudflare(){ 270 | 271 | # Set caddy cloudflare ddns email 272 | echo "你CF的邮箱账号" 273 | read -p "(No default ):" cloudflare_email 274 | [ -z "${cloudflare_email}" ] 275 | echo 276 | echo "---------------------------" 277 | echo "你CF的邮箱账号 = ${cloudflare_email}" 278 | echo "---------------------------" 279 | echo 280 | 281 | # Set caddy cloudflare ddns key 282 | echo "你CF的KEY密钥" 283 | read -p "(No default ):" cloudflare_key 284 | [ -z "${cloudflare_email}" ] 285 | echo 286 | echo "---------------------------" 287 | echo "你CF的KEY密钥 = ${cloudflare_key}" 288 | echo "---------------------------" 289 | echo 290 | echo 291 | 292 | echo "按任意键进行下一步...或者按 Ctrl+C 取消安装" 293 | char=`get_char` 294 | cd ${cur_dir} 295 | echo "我先安装curl " 296 | install_dependencies 297 | echo "开始加载CADDY和DOCKER的配置文件" 298 | curl -L https://raw.githubusercontent.com/hulisang/v2ray-sspanel-v3-mod_Uim-plugin/master/Docker/Caddy_V2ray/Caddyfile >Caddyfile 299 | epcho "加载DOCKER的配置文件中" 300 | curl -L https://raw.githubusercontent.com/hulisang/v2ray-sspanel-v3-mod_Uim-plugin/master/Docker/Caddy_V2ray/docker-compose.yml >docker-compose.yml 301 | sed -i "s|node_id:.*|node_id: ${ssrpanel_node_id}|" ./docker-compose.yml 302 | sed -i "s|sspanel_url:.*|sspanel_url: '${ssrpanel_url}'|" ./docker-compose.yml 303 | sed -i "s|key:.*|key: '${ssrpanel_key}'|" ./docker-compose.yml 304 | sed -i "s|speedtest:.*|speedtest: ${ssrpanel_speedtest}|" ./docker-compose.yml 305 | sed -i "s|api_port:.*|api_port: ${v2ray_api_port}|" ./docker-compose.yml 306 | sed -i "s|downWithPanel:.*|downWithPanel: ${v2ray_downWithPanel}|" ./docker-compose.yml 307 | sed -i "s|V2RAY_DOMAIN=xxxx.com|V2RAY_DOMAIN=${v2ray_domain}|" ./docker-compose.yml 308 | sed -i "s|V2RAY_PATH=/v2ray|V2RAY_PATH=${v2ray_path}|" ./docker-compose.yml 309 | sed -i "s|V2RAY_EMAIL=xxxx@outlook.com|V2RAY_EMAIL=${v2ray_email}|" ./docker-compose.yml 310 | sed -i "s|V2RAY_PORT=10550|V2RAY_PORT=${v2ray_local_port}|" ./docker-compose.yml 311 | sed -i "s|V2RAY_OUTSIDE_PORT=443|V2RAY_OUTSIDE_PORT=${caddy_listen_port}|" ./docker-compose.yml 312 | sed -i "s|# - CLOUDFLARE_EMAIL=xxxxxx@out.look.com| - CLOUDFLARE_EMAIL=${cloudflare_email}|" ./docker-compose.yml 313 | sed -i "s|# - CLOUDFLARE_API_KEY=xxxxxxx| - CLOUDFLARE_API_KEY=${cloudflare_key}|" ./docker-compose.yml 314 | sed -i "s|# dns cloudflare|dns cloudflare|" ./Caddyfile 315 | 316 | } 317 | 318 | # Install docker and docker compose 319 | install_docker(){ 320 | echo -e "开始安装 DOCKER " 321 | curl -fsSL https://get.docker.com -o get-docker.sh 322 | bash get-docker.sh 323 | echo -e "开始安装 Docker Compose " 324 | curl -L https://github.com/docker/compose/releases/download/1.17.1/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose 325 | chmod +x /usr/local/bin/docker-compose 326 | curl -L https://raw.githubusercontent.com/docker/compose/1.8.0/contrib/completion/bash/docker-compose > /etc/bash_completion.d/docker-compose 327 | clear 328 | echo "启动 Docker " 329 | service docker start 330 | echo "启动 Docker-Compose " 331 | docker-compose up -d 332 | echo 333 | echo -e "恭喜,V2ray服务器安装完成!" 334 | echo 335 | echo "注意:安装完成不代表安装成功 可能原因有:" 336 | echo "1、你未购买本V2RAY后端脚本,未获得授权安装失败" 337 | echo "2、你的系统或者管理面板内置防火墙 请关闭或放行" 338 | echo "3、脚本配置信息输入有误 检查前端网址密钥节点ID" 339 | echo "4、玄学问题 你太帅导致的 指导联系TG@WocaonimaB" 340 | echo 341 | } 342 | 343 | install_check(){ 344 | if check_sys packageManager yum || check_sys packageManager apt; then 345 | if centosversion 5; then 346 | return 1 347 | fi 348 | return 0 349 | else 350 | return 1 351 | fi 352 | } 353 | 354 | install_select(){ 355 | clear 356 | while true 357 | do 358 | echo "您选择哪个V2RAY后端安装方式:" 359 | for ((i=1;i<=${#software[@]};i++ )); do 360 | hint="${software[$i-1]}" 361 | echo -e "${green}${i}${plain}) ${hint}" 362 | done 363 | read -p "(推荐回车${software[0]}):" selected 364 | [ -z "${selected}" ] && selected="1" 365 | case "${selected}" in 366 | 1|2|3|4) 367 | echo 368 | echo "你选择了 = ${software[${selected}-1]}" 369 | echo 370 | break 371 | ;; 372 | *) 373 | echo -e "[${red}Error${plain}] 别瞎几把乱输,请输入正确数字" 374 | ;; 375 | esac 376 | done 377 | } 378 | install_dependencies(){ 379 | if check_sys packageManager yum; then 380 | echo -e "[${green}Info${plain}] 检查EPEL存储库..." 381 | if [ ! -f /etc/yum.repos.d/epel.repo ]; then 382 | yum install -y epel-release > /dev/null 2>&1 383 | fi 384 | [ ! -f /etc/yum.repos.d/epel.repo ] && echo -e "[${red}Error${plain}] 安装EPEL储存库失败,请检查一下." && exit 1 385 | [ ! "$(command -v yum-config-manager)" ] && yum install -y yum-utils > /dev/null 2>&1 386 | [ x"$(yum-config-manager epel | grep -w enabled | awk '{print $3}')" != x"True" ] && yum-config-manager --enable epel > /dev/null 2>&1 387 | echo -e "[${green}Info${plain}] 检查EPEL储存库是否完整..." 388 | 389 | yum_depends=( 390 | curl 391 | ) 392 | for depend in ${yum_depends[@]}; do 393 | error_detect_depends "yum -y install ${depend}" 394 | done 395 | elif check_sys packageManager apt; then 396 | apt_depends=( 397 | curl 398 | ) 399 | apt-get -y update 400 | for depend in ${apt_depends[@]}; do 401 | error_detect_depends "apt-get -y install ${depend}" 402 | done 403 | fi 404 | echo -e "[${green}Info${plain}] 将时区设置为上海" 405 | ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 406 | date -s "$(curl -sI g.cn | grep Date | cut -d' ' -f3-6)Z" 407 | 408 | } 409 | #update_image 410 | 更新镜像_v2ray(){ 411 | echo "关闭当前服务" 412 | docker-compose down 413 | echo "加载DOCKER镜像" 414 | docker-compose pull 415 | echo "开始运行DOKCER服务" 416 | docker-compose up -d 417 | } 418 | 419 | #show last 100 line log 420 | 421 | 查看日志_v2ray(){ 422 | echo "将要显示100行的运行日志" 423 | docker-compose logs --tail 100 424 | } 425 | 426 | # Update config 427 | 更新配置_v2ray(){ 428 | cd ${cur_dir} 429 | echo "关闭当前服务" 430 | docker-compose down 431 | install_select 432 | case "${selected}" in 433 | 1) 434 | pre_install_docker_compose 435 | pre_install_caddy 436 | config_caddy_docker 437 | ;; 438 | 2) 439 | pre_install_docker_compose 440 | pre_install_caddy 441 | config_caddy_docker_cloudflare 442 | ;; 443 | 3) 444 | pre_install_docker_compose 445 | config_docker 446 | ;; 447 | *) 448 | echo "错误的数字" 449 | ;; 450 | esac 451 | 452 | echo "开始运行DOKCER服务" 453 | docker-compose up -d 454 | 455 | } 456 | # remove config 457 | # Install v2ray 458 | 全新安装_v2ray(){ 459 | install_select 460 | case "${selected}" in 461 | 1) 462 | pre_install_docker_compose 463 | pre_install_caddy 464 | config_caddy_docker 465 | ;; 466 | 2) 467 | pre_install_docker_compose 468 | pre_install_caddy 469 | config_caddy_docker_cloudflare 470 | ;; 471 | 3) 472 | pre_install_docker_compose 473 | config_docker 474 | ;; 475 | *) 476 | echo "错误的数字" 477 | ;; 478 | esac 479 | install_docker 480 | } 481 | 482 | # Initialization step 483 | clear 484 | while true 485 | do 486 | echo -e "\033[42;30m 此为由狐狸的脚本汉化版 不支持审计设备限速 \033[0m" 487 | echo -e "\033[42;30m 如需代搭建或需技术指导请联系TG:@WocaonimaB \033[0m" 488 | echo "" 489 | echo "请输入数字选择你要进行的操作:" 490 | for ((i=1;i<=${#operation[@]};i++ )); do 491 | hint="${operation[$i-1]}" 492 | echo -e "${green}${i}${plain}) ${hint}" 493 | done 494 | read -p "请选择数字后回车 (回车默认 ${operation[0]}):" selected 495 | [ -z "${selected}" ] && selected="1" 496 | case "${selected}" in 497 | 1|2|3|4) 498 | echo 499 | echo "你的想法 = ${operation[${selected}-1]}" 500 | echo 501 | ${operation[${selected}-1]}_v2ray 502 | break 503 | ;; 504 | *) 505 | echo -e "[${red}Error${plain}] 你妈逼啊,请输入正确数字 [1-4]" 506 | ;; 507 | esac 508 | done -------------------------------------------------------------------------------- /ssrlibev/ss-local: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/ssrlibev/ss-local -------------------------------------------------------------------------------- /ssrlibev/ss-redir: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aiastia/note/558a2d8013b6c081621898f133f8420514aec72a/ssrlibev/ss-redir -------------------------------------------------------------------------------- /ssrlibev/教程: -------------------------------------------------------------------------------- 1 | python : 2 | 3 | 4 | python local.py -c /home/aiastia/ss/shadowsocksr/config.json 5 | 6 | 7 | ss-local 8 | 9 | ss-redir -c /home/aiastia/ss/shadowsocksr/config.json 10 | -------------------------------------------------------------------------------- /stopping服务器禁ping: -------------------------------------------------------------------------------- 1 | # stopping 2 | 1、通过修改配置文件 3 | 4 | 这个方法需要ROOT权限,且设置成功后别人无法Ping本机,本机也无法Ping他人,可能会带来一点麻烦。 5 | 6 | (1)直接修改/proc/sys/net/ipv4/icmp_echo_ignore_all 文件(这个文件默认是只读的) 7 | 该文件只有一个数值: 8 | 将该值改“1”后为开启(运行)禁止PING 9 | 将该值改“0”后为关闭(停止)禁止PING 10 | 11 | (2)直接输入命令行设置(这个方法需要ROOT权限) 12 | 直接在命令行输入以下指令 13 | 运行:禁止Ping 14 | 15 | 16 | echo 1 > /proc/sys/net/ipv4/icmp_echo_igore_all 17 | 停止:禁止Ping 18 | 19 | 20 | echo 0 > /proc/sys/net/ipv4/icmp_echo_igore_all 21 | 22 | 附:设置开机自动禁止Ping方法 23 | 想开机后立即禁止ping响应,将运行语句添加到/etc/rc.d/rc.local即可。 24 | 2、使用iptables限制(推荐) 25 | 这个方法在OpenVZ下VPS、也在虚拟机中测试通过,禁止他人Ping本机的同时,本机也可以Ping他人。 26 | 27 | (1)设置方法很简单,在SSH中输入以下命令,回车后直接生效无需重启iptables。 28 | 29 | iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP 30 | 31 | 以上操作是利用iptables丢弃掉来自外网请求的ICMP包,达到禁Ping的效果。反之请看下面。 32 | 33 | (2)解除设置方法(即删除本规则) 34 | 35 | 36 | iptables -D INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP 37 | -------------------------------------------------------------------------------- /swap 添加.md: -------------------------------------------------------------------------------- 1 | # swap 2 | 输入执行这个命令,即可看到你的VPS当前磁盘大小和使用情况: 3 | 4 | df -m 5 | 6 | 我们可以先查看一下当前的SWAP大小(单位 MB)。 7 | 8 | free -m 9 | 10 | bs=1024 B=1 KB,512000 * 1 KB=512000 KB / 1024 ≈ 512 MB (为了直观的看,就按1000来算了 :lol: ) 11 | 12 | dd if=/dev/zero of=/var/swapfile1 bs=1024 count=512000 13 | 14 | 查看文件是否创建成功,大小是否正确(因为按1000计算,所以会不足 512MB) 15 | 16 | du -ah /var|grep "swapfile1" 17 | 18 | mkswap /var/swapfile1 19 | 20 | swapon /var/swapfile1 21 | 22 | 23 | swapon -s 24 | free -m 25 | 26 | 27 | 机启动加载 28 | 29 | echo "/var/swapfile1 swap swap defaults 0 0" >> /etc/fstab 30 | 31 | 32 | 取消 SWAP文件 33 | 34 | swapoff /var/swapfile1 35 | 36 | 取消 开机启动加载 37 | 38 | sed -i "/swapfile1/d" /etc/fstab 39 | 40 | 删除 SWAP文件 41 | 42 | rm -rf /var/swapfile1 43 | 44 | ``` 45 | https://github.com/zhucaidan/swap.sh 46 | wget https://raw.githubusercontent.com/zhucaidan/swap.sh/main/swap.sh && bash swap.sh 47 | ``` 48 | -------------------------------------------------------------------------------- /vpsbanip: -------------------------------------------------------------------------------- 1 | # vpsbanip 2 | 3 | 在设置中国时区使用亚洲/上海(+8) 4 | 5 | cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 6 | 7 | vps 禁止密码登陆 8 | 用 cat /var/log/auth.log命令查看 9 | 10 | centos对应cat /var/log/secure 11 | 12 | 找了两条防暴力破解的命令 13 | 14 | iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --set 15 | 16 | 17 | iptables -I INPUT -p tcp --dport 22 -i eth0 -m state --state NEW -m recent --update --seconds 60 --hitcount 4 -j DROP 18 | 19 | 20 | 第一句是说,对于外来数据,如果是 TCP 协议,目标端口号是 22,网络接口是 eth0,状态是新连接,那么把它加到最近列表中。 21 | 第二句是说,对于这样的连接,如果在最近列表中,并且在 60 秒内达到或者超过四次,那么丢弃该数据。其中的-m是模块的意思。 22 | 也就是说,如果有人从一个 IP 一分钟内连接尝试四次 ssh 登录的话,那么它就会被加入黑名单,后续连接将会被丢弃。 23 | 24 | 25 | 26 | 27 | SSH服务的配置文件位于/etc/ssh/sshd_config,我们的安全设置都是围绕此文件展开,所以修改前最好先备份一次,以免出现无法登陆的情况。 28 | 29 | 30 | 31 | 修改完不要忘了执行 32 | service sshd restart 33 | 34 | 35 | III. 禁止ROOT用户登陆 36 | 37 | # vim /etc/ssh/sshd_config 38 | PermitRootLogin no 39 | 40 | 41 | IV. 限制其他用户登陆 42 | 43 | # vim /etc/ssh/sshd_config 44 | AllowUsers fsmythe bnice swilson 45 | DenyUsers jhacker joebadguy jripper 46 | 47 | V. 使用 Chroot SSHD 将 SFTP 用户局限于其自己的主目录: 48 | 49 | 50 | # vim /etc/ssh/sshd_config 51 | ChrootDirectory /home/%u 52 | X11Forwarding no 53 | AllowTcpForwarding no 54 | 55 | 56 | VI. 登陆IP限制 57 | 58 | # vim /etc/hosts.deny 59 | ALL: 192.168.200.09 # 希望禁止的IP 60 | 61 | 62 | VII. 禁止空密码登陆 63 | 64 | # vim /etc/ssh/sshd_config 65 | PermitEmptyPasswords no 66 | 67 | 68 | VIII. 禁用基于主机的身份验证 69 | 70 | # vim /etc/ssh/sshd_config 71 | HostbasedAuthentication no 72 | 73 | XI. 指纹登陆 74 | 75 | 生成4096位密钥 76 | 77 | ssh-keygen -t rsa -b 4096 78 | 将公钥拷贝至服务器对应用户的.ssh下,重命名为authorized_keys 79 | 80 | scp -P xxxxx ~/.ssh/id_rsa.pub server:/root/.ssh/authorized_keys 81 | 如果已经存在authorized_keys,需要将公钥追加至authorized_keys 82 | 83 | scp -P xxxxx ~/.ssh/id_rsa.pub server:/root/.ssh/tmp.pub 84 | 85 | # 在服务器端执行 86 | 87 | cat /root/.ssh/tmp.pub >> /root/.ssh/authorized_keys 88 | 89 | 90 | XII. 禁止使用密码登陆 91 | 92 | # vim /etc/ssh/sshd_config 93 | PasswordAuthentication no 94 | 95 | 96 | XIII. 报错 97 | 98 | WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! 99 | 100 | 删除~/.ssh/known_hosts文件 101 | 102 | rm ~/.ssh/known_hosts 103 | 104 | 105 | 106 | XIV. 检查登录日志 107 | 108 | 如果你的服务器一直很正常,那也可能不正常的表现,最好的办法就是定期查询ssh的登录日志,手动发现系统的异常! 109 | 110 | # vim /etc/ssh/sshd_config 111 | # add 112 | LogLevel DEBUG 113 | 114 | # 查看最近100条登录日志 115 | tail -100 /var/log/secure 116 | 117 | # 登录成功日志 118 | who /var/log/wtmp 119 | 120 | last 121 | 122 | -------------------------------------------------------------------------------- /wls-sources.list: -------------------------------------------------------------------------------- 1 | # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to 2 | # newer versions of the distribution. 3 | deb http://archive.ubuntu.com/ubuntu/ focal main restricted 4 | # deb-src http://archive.ubuntu.com/ubuntu/ focal main restricted 5 | 6 | ## Major bug fix updates produced after the final release of the 7 | ## distribution. 8 | deb http://archive.ubuntu.com/ubuntu/ focal-updates main restricted 9 | # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates main restricted 10 | 11 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 12 | ## team. Also, please note that software in universe WILL NOT receive any 13 | ## review or updates from the Ubuntu security team. 14 | deb http://archive.ubuntu.com/ubuntu/ focal universe 15 | # deb-src http://archive.ubuntu.com/ubuntu/ focal universe 16 | deb http://archive.ubuntu.com/ubuntu/ focal-updates universe 17 | # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates universe 18 | 19 | ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 20 | ## team, and may not be under a free licence. Please satisfy yourself as to 21 | ## your rights to use the software. Also, please note that software in 22 | ## multiverse WILL NOT receive any review or updates from the Ubuntu 23 | ## security team. 24 | deb http://archive.ubuntu.com/ubuntu/ focal multiverse 25 | # deb-src http://archive.ubuntu.com/ubuntu/ focal multiverse 26 | deb http://archive.ubuntu.com/ubuntu/ focal-updates multiverse 27 | # deb-src http://archive.ubuntu.com/ubuntu/ focal-updates multiverse 28 | 29 | ## N.B. software from this repository may not have been tested as 30 | ## extensively as that contained in the main release, although it includes 31 | ## newer versions of some applications which may provide useful features. 32 | ## Also, please note that software in backports WILL NOT receive any review 33 | ## or updates from the Ubuntu security team. 34 | deb http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse 35 | # deb-src http://archive.ubuntu.com/ubuntu/ focal-backports main restricted universe multiverse 36 | 37 | ## Uncomment the following two lines to add software from Canonical's 38 | ## 'partner' repository. 39 | ## This software is not part of Ubuntu, but is offered by Canonical and the 40 | ## respective vendors as a service to Ubuntu users. 41 | # deb http://archive.canonical.com/ubuntu focal partner 42 | # deb-src http://archive.canonical.com/ubuntu focal partner 43 | 44 | deb http://security.ubuntu.com/ubuntu/ focal-security main restricted 45 | # deb-src http://security.ubuntu.com/ubuntu/ focal-security main restricted 46 | deb http://security.ubuntu.com/ubuntu/ focal-security universe 47 | # deb-src http://security.ubuntu.com/ubuntu/ focal-security universe 48 | deb http://security.ubuntu.com/ubuntu/ focal-security multiverse 49 | # deb-src http://security.ubuntu.com/ubuntu/ focal-security multiverse -------------------------------------------------------------------------------- /双系统安装: -------------------------------------------------------------------------------- 1 | U盘安装 原料:Ubuntu Kylin的ISO、UltraISO、EasyBCD、U盘(>=2G) 优点:简单安全,正牌双系统 缺点:默认Ubuntu开机引导 windows 已经安装好的情况下 数据备份 先别着急,你备份了吗?如果你看到这里,说明你选择了风险最大的一条路,在游戏开始之前,一定要做好数据备份,数据备份,数据备份。 创建磁盘分区按住Win + X,选择“磁盘管理”: 选择剩余空间较大的可分配磁盘,右键并选择“压缩卷”,这里选择压缩E盘50G左右的空间: 点击“压缩”之后,E盘后部出现黑色的50G“未分配空间” 至此,磁盘分区过程完成。 2 | 3 | 禁用快速启动(可选) 4 | 5 | 按住Win + X(请记住这个万能的组合),选择“电源选项”,依次执行: 注: “快速启动”是Windows 8时代引进的新特性,建议关闭该特性的原因是,“快速启动”会影响Grub开机引导过程,可能出现无法载入Ubuntu的状况,最后选择“保存修改”。 禁用安全启动(Secure Boot) 大部分机器默认是关闭Secure Boot的,如果不放心,直接重启进Boot,简单粗暴: 注:同样的,“安全启动”也是Windows 8时代为了防范RootKit病毒所采取的安全措施,但也阻止了Windows和其他操作系统的双启动,因此在载入Ubuntu镜像之前,务必确保“安全启动”已禁用。 制作Ubuntu的启动U盘 6 | 7 | 备份待写入的U盘 进入UltraISO,打开文件: 启动>写入硬盘映像: 按默认值写入: 完成写入: U盘安装Ubuntu 插上U盘,根据机器找到进入Boot的快捷键 找到镜像U盘,调整Priority Order,Save and Exit: 选择“安装Ubuntu Kylin”:完成默认设置: 注:如果网络和空间匀速,建议选择“安装中下载更新”和“安装这个第三方软件”。 8 | 9 | 非常重要的一步,选择“其他选项”: 非常重要的一步,选择“其他选项”: 为空闲磁盘分区: 在这一步会看到我们之前分配的未使用磁盘空间,我们即将为这块空闲磁盘分区,为了更方便理解接下来的操作,这里简单介绍一下安装过程所涉及到的几个主要的Linux分区: /:存储系统文件,建议10GB ~ 15GB; swap:交换分区,即Linux系统的虚拟内存,建议是物理内存的2倍; /home:home目录,存放音乐、图片及下载等文件的空间,建议最后分配所有剩下的空间; /boot:包含系统内核和系统启动所需的文件,实现双系统的关键所在,建议200M。 选定空闲磁盘,点击+,首先分配16G空间给/分区,选择“主分区”、“空间起始位置”、Ext4和“挂载点/”: 注:实际上,一块硬盘最多容纳4个主分区,或3个主分区外加1个扩展分区,在选择分区类型时,可能会出现“安装系统时空闲分区不可用”状况,为了解决问题,下面一律选择“逻辑分区”。 重复创建步骤,分配16G空间给swap分区,选择“逻辑分区”(主分区已满)、“空间起始位置”、用于“交换空间”: 接着分配200M空间给/boot分区,选择“逻辑分区”(主分区已满)、“空间起始位置”、“Ext4”和“挂载点/boot” 最后将所有剩余空间分配给/home分区,选择“逻辑分区”(主分区已满)、“空间起始位置”、“Ext4”和“挂载点/home”: 选择/boot对应的盘符作为“安装启动引导器的设备”,务必保证一致: 将改动写入磁盘 10 | 11 | 重启系统,进入Windows完成最后的引导设置。 12 | 13 | EasyBCD引导Ubuntu 进入EasyBCD,选择“添加新条目”,选择Linux/BSD操作系统,在“驱动器”栏目选择接近200M的Linux分区: 14 | 15 | 完成条目添加后,重启电脑,会发现Windows10和Ubuntu的双系统已经完成安装,祝玩得开心! 用Windows引导Ubuntu最大的好处就是,当不再需要Ubuntu的时候,直接在Windows磁盘管理中将其所在所有分区删除,然后将EasyBCD中对应条目删除即可。关于Ubuntu引导Windows的方法,如果大家感兴趣,欢迎尝试和分享。 16 | 17 | 只需要在Unbutu分区的时候,将启动引导器设置为esp分区就好,就是存放windows启动项的分区,很好辨认,大小为100MB左右,分区格式为fast16的就是 18 | -------------------------------------------------------------------------------- /合并txt.sh: -------------------------------------------------------------------------------- 1 | a=0 2 | b="152" 3 | g="GB" 4 | u="UTF" 5 | cd $b 6 | for i in *.txt 7 | do 8 | echo $i ; 9 | a=$(($a + 1)); 10 | echo "第$a 本书:" >> ../$b.txt; 11 | #echo $i >> 1.txt ; 12 | echo ${i%*${i:(-4)}} >> ../$b.txt ; 13 | #cat "$i" | iconv -f GBK -t UTF-8 >> ../$b.txt 14 | f=`enca -L zh_CN "$i" | cut -d ';' -f 2 ` 15 | echo $f+1 ; 16 | if [[ $f == *$g* ]]; then h="GB18030" ;elif [[ $f == *$u* ]]; then h="UTF-8" ;else h="UTF-16";fi 17 | #if [[ $f = "GB*" ]]; then h="GBK" ;elif [[ $f = "UTF*" ]]; then h="UTF-8" ;else h="UTF-16" ;fi 18 | echo $h ; 19 | cat "$i" | iconv -f $h -t UTF-8 >> ../$b.txt 20 | #enca -L zh_CN "$i" | cut -d ';' -f 2 |xargs -i cat "$i" | iconv -f {} -t UTF-8 21 | echo " " >> ../$b.txt 22 | done -------------------------------------------------------------------------------- /端口转发/iptables-pf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | 5 | #================================================= 6 | # System Required: CentOS/Debian/Ubuntu 7 | # Description: iptables Port forwarding 8 | # Version: 1.1.1 9 | # Author: Toyo 10 | # Blog: https://doub.io/wlzy-20/ 11 | #================================================= 12 | sh_ver="1.1.1" 13 | 14 | Green_font_prefix="\033[32m" && Red_font_prefix="\033[31m" && Green_background_prefix="\033[42;37m" && Red_background_prefix="\033[41;37m" && Font_color_suffix="\033[0m" 15 | Info="${Green_font_prefix}[信息]${Font_color_suffix}" 16 | Error="${Red_font_prefix}[错误]${Font_color_suffix}" 17 | Tip="${Green_font_prefix}[注意]${Font_color_suffix}" 18 | 19 | check_iptables(){ 20 | iptables_exist=$(iptables -V) 21 | [[ ${iptables_exist} = "" ]] && echo -e "${Error} 没有安装iptables,请检查 !" && exit 1 22 | } 23 | check_sys(){ 24 | if [[ -f /etc/redhat-release ]]; then 25 | release="centos" 26 | elif cat /etc/issue | grep -q -E -i "debian"; then 27 | release="debian" 28 | elif cat /etc/issue | grep -q -E -i "ubuntu"; then 29 | release="ubuntu" 30 | elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat"; then 31 | release="centos" 32 | elif cat /proc/version | grep -q -E -i "debian"; then 33 | release="debian" 34 | elif cat /proc/version | grep -q -E -i "ubuntu"; then 35 | release="ubuntu" 36 | elif cat /proc/version | grep -q -E -i "centos|red hat|redhat"; then 37 | release="centos" 38 | fi 39 | #bit=`uname -m` 40 | } 41 | install_iptables(){ 42 | iptables_exist=$(iptables -V) 43 | if [[ ${iptables_exist} != "" ]]; then 44 | echo -e "${Info} 已经安装iptables,继续..." 45 | else 46 | echo -e "${Info} 检测到未安装 iptables,开始安装..." 47 | if [[ ${release} == "centos" ]]; then 48 | yum update 49 | yum install -y iptables 50 | else 51 | apt-get update 52 | apt-get install -y iptables 53 | fi 54 | iptables_exist=$(iptables -V) 55 | if [[ ${iptables_exist} = "" ]]; then 56 | echo -e "${Error} 安装iptables失败,请检查 !" && exit 1 57 | else 58 | echo -e "${Info} iptables 安装完成 !" 59 | fi 60 | fi 61 | echo -e "${Info} 开始配置 iptables !" 62 | Set_iptables 63 | echo -e "${Info} iptables 配置完毕 !" 64 | } 65 | Set_forwarding_port(){ 66 | read -e -p "请输入 iptables 欲转发至的 远程端口 [1-65535] (支持端口段 如 2333-6666, 被转发服务器):" forwarding_port 67 | [[ -z "${forwarding_port}" ]] && echo "取消..." && exit 1 68 | echo && echo -e " 欲转发端口 : ${Red_font_prefix}${forwarding_port}${Font_color_suffix}" && echo 69 | } 70 | Set_forwarding_ip(){ 71 | read -e -p "请输入 iptables 欲转发至的 远程IP(被转发服务器):" forwarding_ip 72 | [[ -z "${forwarding_ip}" ]] && echo "取消..." && exit 1 73 | echo && echo -e " 欲转发服务器IP : ${Red_font_prefix}${forwarding_ip}${Font_color_suffix}" && echo 74 | } 75 | Set_local_port(){ 76 | echo -e "请输入 iptables 本地监听端口 [1-65535] (支持端口段 如 2333-6666)" 77 | read -e -p "(默认端口: ${forwarding_port}):" local_port 78 | [[ -z "${local_port}" ]] && local_port="${forwarding_port}" 79 | echo && echo -e " 本地监听端口 : ${Red_font_prefix}${local_port}${Font_color_suffix}" && echo 80 | } 81 | Set_local_ip(){ 82 | read -e -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP,回车自动检测外网IP):" local_ip 83 | if [[ -z "${local_ip}" ]]; then 84 | local_ip=$(wget -qO- -t1 -T2 ipinfo.io/ip) 85 | if [[ -z "${local_ip}" ]]; then 86 | echo "${Error} 无法检测到本服务器的公网IP,请手动输入" 87 | read -e -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP):" local_ip 88 | [[ -z "${local_ip}" ]] && echo "取消..." && exit 1 89 | fi 90 | fi 91 | echo && echo -e " 本服务器IP : ${Red_font_prefix}${local_ip}${Font_color_suffix}" && echo 92 | } 93 | Set_forwarding_type(){ 94 | echo -e "请输入数字 来选择 iptables 转发类型: 95 | 1. TCP 96 | 2. UDP 97 | 3. TCP+UDP\n" 98 | read -e -p "(默认: TCP+UDP):" forwarding_type_num 99 | [[ -z "${forwarding_type_num}" ]] && forwarding_type_num="3" 100 | if [[ ${forwarding_type_num} == "1" ]]; then 101 | forwarding_type="TCP" 102 | elif [[ ${forwarding_type_num} == "2" ]]; then 103 | forwarding_type="UDP" 104 | elif [[ ${forwarding_type_num} == "3" ]]; then 105 | forwarding_type="TCP+UDP" 106 | else 107 | forwarding_type="TCP+UDP" 108 | fi 109 | } 110 | Set_Config(){ 111 | Set_forwarding_port 112 | Set_forwarding_ip 113 | Set_local_port 114 | Set_local_ip 115 | Set_forwarding_type 116 | echo && echo -e "—————————————————————————————— 117 | 请检查 iptables 端口转发规则配置是否有误 !\n 118 | 本地监听端口 : ${Green_font_prefix}${local_port}${Font_color_suffix} 119 | 服务器 IP\t: ${Green_font_prefix}${local_ip}${Font_color_suffix}\n 120 | 欲转发的端口 : ${Green_font_prefix}${forwarding_port}${Font_color_suffix} 121 | 欲转发 IP\t: ${Green_font_prefix}${forwarding_ip}${Font_color_suffix} 122 | 转发类型\t: ${Green_font_prefix}${forwarding_type}${Font_color_suffix} 123 | ——————————————————————————————\n" 124 | read -e -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var 125 | } 126 | Add_forwarding(){ 127 | check_iptables 128 | Set_Config 129 | local_port=$(echo ${local_port} | sed 's/-/:/g') 130 | forwarding_port_1=$(echo ${forwarding_port} | sed 's/-/:/g') 131 | if [[ ${forwarding_type} == "TCP" ]]; then 132 | Add_iptables "tcp" 133 | elif [[ ${forwarding_type} == "UDP" ]]; then 134 | Add_iptables "udp" 135 | elif [[ ${forwarding_type} == "TCP+UDP" ]]; then 136 | Add_iptables "tcp" 137 | Add_iptables "udp" 138 | fi 139 | Save_iptables 140 | clear && echo && echo -e "—————————————————————————————— 141 | iptables 端口转发规则配置完成 !\n 142 | 本地监听端口 : ${Green_font_prefix}${local_port}${Font_color_suffix} 143 | 服务器 IP\t: ${Green_font_prefix}${local_ip}${Font_color_suffix}\n 144 | 欲转发的端口 : ${Green_font_prefix}${forwarding_port_1}${Font_color_suffix} 145 | 欲转发 IP\t: ${Green_font_prefix}${forwarding_ip}${Font_color_suffix} 146 | 转发类型\t: ${Green_font_prefix}${forwarding_type}${Font_color_suffix} 147 | ——————————————————————————————\n" 148 | } 149 | View_forwarding(){ 150 | check_iptables 151 | forwarding_text=$(iptables -t nat -vnL PREROUTING|tail -n +3) 152 | [[ -z ${forwarding_text} ]] && echo -e "${Error} 没有发现 iptables 端口转发规则,请检查 !" && exit 1 153 | forwarding_total=$(echo -e "${forwarding_text}"|wc -l) 154 | forwarding_list_all="" 155 | for((integer = 1; integer <= ${forwarding_total}; integer++)) 156 | do 157 | forwarding_type=$(echo -e "${forwarding_text}"|awk '{print $4}'|sed -n "${integer}p") 158 | forwarding_listen=$(echo -e "${forwarding_text}"|awk '{print $11}'|sed -n "${integer}p"|awk -F "dpt:" '{print $2}') 159 | [[ -z ${forwarding_listen} ]] && forwarding_listen=$(echo -e "${forwarding_text}"| awk '{print $11}'|sed -n "${integer}p"|awk -F "dpts:" '{print $2}') 160 | forwarding_fork=$(echo -e "${forwarding_text}"| awk '{print $12}'|sed -n "${integer}p"|awk -F "to:" '{print $2}') 161 | forwarding_list_all=${forwarding_list_all}"${Green_font_prefix}"${integer}".${Font_color_suffix} 类型: ${Green_font_prefix}"${forwarding_type}"${Font_color_suffix} 监听端口: ${Red_font_prefix}"${forwarding_listen}"${Font_color_suffix} 转发IP和端口: ${Red_font_prefix}"${forwarding_fork}"${Font_color_suffix}\n" 162 | done 163 | echo && echo -e "当前有 ${Green_background_prefix} "${forwarding_total}" ${Font_color_suffix} 个 iptables 端口转发规则。" 164 | echo -e ${forwarding_list_all} 165 | } 166 | Del_forwarding(){ 167 | check_iptables 168 | while true 169 | do 170 | View_forwarding 171 | read -e -p "请输入数字 来选择要删除的 iptables 端口转发规则(默认回车取消):" Del_forwarding_num 172 | [[ -z "${Del_forwarding_num}" ]] && Del_forwarding_num="0" 173 | echo $((${Del_forwarding_num}+0)) &>/dev/null 174 | if [[ $? -eq 0 ]]; then 175 | if [[ ${Del_forwarding_num} -ge 1 ]] && [[ ${Del_forwarding_num} -le ${forwarding_total} ]]; then 176 | forwarding_type=$(echo -e "${forwarding_text}"| awk '{print $4}' | sed -n "${Del_forwarding_num}p") 177 | forwarding_listen=$(echo -e "${forwarding_text}"| awk '{print $11}' | sed -n "${Del_forwarding_num}p" | awk -F "dpt:" '{print $2}' | sed 's/-/:/g') 178 | [[ -z ${forwarding_listen} ]] && forwarding_listen=$(echo -e "${forwarding_text}"| awk '{print $11}' |sed -n "${Del_forwarding_num}p" | awk -F "dpts:" '{print $2}') 179 | Del_iptables "${forwarding_type}" "${Del_forwarding_num}" 180 | Save_iptables 181 | echo && echo -e "${Info} iptables 端口转发规则删除完成 !" && echo 182 | else 183 | echo -e "${Error} 请输入正确的数字 !" 184 | fi 185 | else 186 | break && echo "取消..." 187 | fi 188 | done 189 | } 190 | Uninstall_forwarding(){ 191 | check_iptables 192 | echo -e "确定要清空 iptables 所有端口转发规则 ? [y/N]" 193 | read -e -p "(默认: n):" unyn 194 | [[ -z ${unyn} ]] && unyn="n" 195 | if [[ ${unyn} == [Yy] ]]; then 196 | forwarding_text=$(iptables -t nat -vnL PREROUTING|tail -n +3) 197 | [[ -z ${forwarding_text} ]] && echo -e "${Error} 没有发现 iptables 端口转发规则,请检查 !" && exit 1 198 | forwarding_total=$(echo -e "${forwarding_text}"|wc -l) 199 | for((integer = 1; integer <= ${forwarding_total}; integer++)) 200 | do 201 | forwarding_type=$(echo -e "${forwarding_text}"|awk '{print $4}'|sed -n "${integer}p") 202 | forwarding_listen=$(echo -e "${forwarding_text}"|awk '{print $11}'|sed -n "${integer}p"|awk -F "dpt:" '{print $2}') 203 | [[ -z ${forwarding_listen} ]] && forwarding_listen=$(echo -e "${forwarding_text}"| awk '{print $11}'|sed -n "${integer}p"|awk -F "dpts:" '{print $2}') 204 | # echo -e "${forwarding_text} ${forwarding_type} ${forwarding_listen}" 205 | Del_iptables "${forwarding_type}" "${integer}" 206 | done 207 | Save_iptables 208 | echo && echo -e "${Info} iptables 已清空 所有端口转发规则 !" && echo 209 | else 210 | echo && echo "清空已取消..." && echo 211 | fi 212 | } 213 | Add_iptables(){ 214 | iptables -t nat -A PREROUTING -p "$1" --dport "${local_port}" -j DNAT --to-destination "${forwarding_ip}":"${forwarding_port}" 215 | iptables -t nat -A POSTROUTING -p "$1" -d "${forwarding_ip}" --dport "${forwarding_port_1}" -j SNAT --to-source "${local_ip}" 216 | echo "iptables -t nat -A PREROUTING -p $1 --dport ${local_port} -j DNAT --to-destination ${forwarding_ip}:${forwarding_port}" 217 | echo "iptables -t nat -A POSTROUTING -p $1 -d ${forwarding_ip} --dport ${forwarding_port_1} -j SNAT --to-source ${local_ip}" 218 | echo "${local_port}" 219 | iptables -I INPUT -m state --state NEW -m "$1" -p "$1" --dport "${local_port}" -j ACCEPT 220 | } 221 | Del_iptables(){ 222 | iptables -t nat -D POSTROUTING "$2" 223 | iptables -t nat -D PREROUTING "$2" 224 | iptables -D INPUT -m state --state NEW -m "$1" -p "$1" --dport "${forwarding_listen}" -j ACCEPT 225 | } 226 | Save_iptables(){ 227 | if [[ ${release} == "centos" ]]; then 228 | service iptables save 229 | else 230 | iptables-save > /etc/iptables.up.rules 231 | fi 232 | } 233 | Set_iptables(){ 234 | echo -e "net.ipv4.ip_forward=1" >> /etc/sysctl.conf 235 | sysctl -p 236 | if [[ ${release} == "centos" ]]; then 237 | service iptables save 238 | chkconfig --level 2345 iptables on 239 | else 240 | iptables-save > /etc/iptables.up.rules 241 | echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules' > /etc/network/if-pre-up.d/iptables 242 | chmod +x /etc/network/if-pre-up.d/iptables 243 | fi 244 | } 245 | Update_Shell(){ 246 | sh_new_ver=$(wget --no-check-certificate -qO- -t1 -T3 "https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/iptables-pf.sh"|grep 'sh_ver="'|awk -F "=" '{print $NF}'|sed 's/\"//g'|head -1) 247 | [[ -z ${sh_new_ver} ]] && echo -e "${Error} 无法链接到 Github !" && exit 0 248 | wget -N --no-check-certificate "https://raw.githubusercontent.com/ToyoDAdoubiBackup/doubi/master/iptables-pf.sh" && chmod +x iptables-pf.sh 249 | echo -e "脚本已更新为最新版本[ ${sh_new_ver} ] !(注意:因为更新方式为直接覆盖当前运行的脚本,所以可能下面会提示一些报错,无视即可)" && exit 0 250 | } 251 | check_sys 252 | echo && echo -e " iptables 端口转发一键管理脚本 ${Red_font_prefix}[v${sh_ver}]${Font_color_suffix} 253 | -- Toyo | doub.io/wlzy-20 -- 254 | 255 | ${Green_font_prefix}0.${Font_color_suffix} 升级脚本 256 | ———————————— 257 | ${Green_font_prefix}1.${Font_color_suffix} 安装 iptables 258 | ${Green_font_prefix}2.${Font_color_suffix} 清空 iptables 端口转发 259 | ———————————— 260 | ${Green_font_prefix}3.${Font_color_suffix} 查看 iptables 端口转发 261 | ${Green_font_prefix}4.${Font_color_suffix} 添加 iptables 端口转发 262 | ${Green_font_prefix}5.${Font_color_suffix} 删除 iptables 端口转发 263 | ———————————— 264 | 注意:初次使用前请请务必执行 ${Green_font_prefix}1. 安装 iptables${Font_color_suffix}(不仅仅是安装)" && echo 265 | read -e -p " 请输入数字 [0-5]:" num 266 | case "$num" in 267 | 0) 268 | Update_Shell 269 | ;; 270 | 1) 271 | install_iptables 272 | ;; 273 | 2) 274 | Uninstall_forwarding 275 | ;; 276 | 3) 277 | View_forwarding 278 | ;; 279 | 4) 280 | Add_forwarding 281 | ;; 282 | 5) 283 | Del_forwarding 284 | ;; 285 | *) 286 | echo "请输入正确数字 [0-5]" 287 | ;; 288 | esac -------------------------------------------------------------------------------- /端口转发/natcfg.sh: -------------------------------------------------------------------------------- 1 | red="\033[31m" 2 | black="\033[0m" 3 | 4 | base=/etc/dnat 5 | mkdir $base 2>/dev/null 6 | conf=$base/conf 7 | touch $conf 8 | 9 | # wget -qO natcfg.sh https://raw.githubusercontent.com/arloor/iptablesUtils/master/natcfg.sh && bash natcfg.sh 10 | echo -e "${red}用途${black}: 便捷的设置iptables端口转发" 11 | echo -e "${red}注意1${black}: 到域名的转发规则在添加后需要等待2分钟才会生效,且在机器重启后仍然有效" 12 | echo -e "${red}注意2${black}: 到IP的转发规则在重启后会失效,这是iptables的特性" 13 | echo 14 | setupService(){ 15 | wget -qO /usr/local/bin/dnat.sh https://raw.githubusercontent.com/arloor/iptablesUtils/master/dnat.sh||{ 16 | echo "脚本不存在,请通过github提交issue通知作者" 17 | exit 1 18 | } 19 | echo 20 | 21 | 22 | cat > /lib/systemd/system/dnat.service <<\EOF 23 | [Unit] 24 | Description=动态设置iptables转发规则 25 | After=network-online.target 26 | Wants=network-online.target 27 | 28 | [Service] 29 | WorkingDirectory=/root/ 30 | EnvironmentFile= 31 | ExecStart=/bin/bash /usr/local/bin/dnat.sh 32 | Restart=always 33 | RestartSec=30 34 | 35 | [Install] 36 | WantedBy=multi-user.target 37 | EOF 38 | 39 | systemctl daemon-reload 40 | systemctl enable dnat > /dev/null 2>&1 41 | service dnat stop > /dev/null 2>&1 42 | service dnat start > /dev/null 2>&1 43 | } 44 | 45 | 46 | ## 获取本机地址 47 | localIP=$(ip -o -4 addr list | grep -Ev '\s(docker|lo)' | awk '{print $4}' | cut -d/ -f1 | grep -Ev '(^127\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.1[6-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.2[0-9]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^172\.3[0-1]{1}[0-9]{0,1}\.[0-9]{1,3}\.[0-9]{1,3}$)|(^192\.168\.[0-9]{1,3}\.[0-9]{1,3}$)') 48 | if [ "${localIP}" = "" ]; then 49 | localIP=$(ip -o -4 addr list | grep -Ev '\s(docker|lo)' | awk '{print $4}' | cut -d/ -f1|head -n 1 ) 50 | fi 51 | 52 | rmIptablesNat(){ 53 | #删除旧的中转规则 54 | local arr1=(`iptables -L PREROUTING -n -t nat --line-number |grep DNAT|grep "dpt:$1 "|sort -r|awk '{print $1,$3,$9}'|tr " " ":"|tr "\n" " "`) 55 | for cell in ${arr1[@]} # cell= 1:tcp:to:8.8.8.8:543 56 | do 57 | local arr2=(`echo $cell|tr ":" " "`) #arr2=(1 tcp to 8.8.8.8 543) 58 | local index=${arr2[0]} 59 | local proto=${arr2[1]} 60 | local targetIP=${arr2[3]} 61 | local targetPort=${arr2[4]} 62 | # echo 清除本机$localport端口到$targetIP:$targetPort的${proto}的PREROUTING转发规则[$index] 63 | iptables -t nat -D PREROUTING $index 64 | # echo ==清除对应的POSTROUTING规则 65 | local toRmIndexs=(`iptables -L POSTROUTING -n -t nat --line-number|grep SNAT|grep $targetIP|grep dpt:$targetPort|grep $proto|awk '{print $1}'|sort -r|tr "\n" " "`) 66 | for cell1 in ${toRmIndexs[@]} 67 | do 68 | iptables -t nat -D POSTROUTING $cell1 69 | done 70 | done 71 | } 72 | 73 | addDnat(){ 74 | local localport= 75 | local remoteport= 76 | local remotehost= 77 | local valid= 78 | echo -n "本地端口号:" ;read localport 79 | echo -n "远程端口号:" ;read remoteport 80 | # echo $localport $remoteport 81 | # 判断端口是否为数字 82 | echo "$localport"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] && echo $remoteport |[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ]||{ 83 | echo -e "${red}本地端口和目标端口请输入数字!!${black}" 84 | return 1; 85 | } 86 | 87 | echo -n "目标域名:" ;read remotehost 88 | # 检查输入的不是IP 89 | if [ "$remotehost" = "" -o "$(echo $remotehost |grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}')" != "" ];then 90 | isip=true 91 | remote=$remotehost 92 | echo -e "${red}请输入一个ddns域名${black}" 93 | return 1 94 | fi 95 | 96 | setupService 97 | echo "成功添加转发规则 $localport>$remotehost:$remoteport 大约两分钟后规则会生效" 98 | 99 | sed -i "s/^$localport.*/$localport>$remotehost:$remoteport/g" $conf 100 | [ "$(cat $conf|grep "$localport>$remotehost:$remoteport")" = "" ]&&{ 101 | cat >> $conf <$remotehost:$remoteport 103 | LINE 104 | } 105 | } 106 | 107 | rmDnat(){ 108 | local localport= 109 | echo -n "本地端口号:" ;read localport 110 | sed -i "/^$localport>.*/d" $conf 111 | 112 | rmIptablesNat $localport 113 | #删除临时文件 114 | rm -f $base/${1}IP 115 | } 116 | 117 | testVars(){ 118 | local localport=$1 119 | local remotehost=$2 120 | local remoteport=$3 121 | # 判断端口是否为数字 122 | local valid= 123 | echo "$localport"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] && echo $remoteport |[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ]||{ 124 | # echo -e "${red}本地端口和目标端口请输入数字!!${black}"; 125 | return 1; 126 | } 127 | 128 | # 检查输入的不是IP 129 | if [ "$(echo $remotehost |grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}')" != "" ];then 130 | local isip=true 131 | local remote=$remotehost 132 | 133 | # echo -e "${red}警告:你输入的目标地址是一个ip!${black}" 134 | return 2; 135 | fi 136 | } 137 | 138 | lsDnat(){ 139 | arr1=(`cat $conf`) 140 | for cell in ${arr1[@]} 141 | do 142 | arr2=(`echo $cell|tr ":" " "|tr ">" " "`) #arr2=16 REJECT 0.0.0.0/0 143 | # 过滤非法的行 144 | [ "${arr2[2]}" != "" -a "${arr2[3]}" = "" ]&& testVars ${arr2[0]} ${arr2[1]} ${arr2[2]}&&{ 145 | echo "转发规则: ${arr2[0]}>${arr2[1]}:${arr2[2]}" 146 | } 147 | done 148 | } 149 | 150 | addSnat(){ 151 | local localport= 152 | local remoteport= 153 | local remotehost= 154 | echo -n "本地端口号:" ;read localport 155 | echo -n "远程端口号:" ;read remoteport 156 | # echo $localport $remoteport 157 | # 判断端口是否为数字 158 | echo "$localport"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] && echo $remoteport |[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ]||{ 159 | echo -e "${red}本地端口和目标端口请输入数字!!${black}" 160 | return 1; 161 | } 162 | 163 | echo -n "目标IP:" ;read remotehost 164 | # 检查输入的不是IP 165 | if [ "$remotehost" = "" -o "$(echo $remotehost |grep -E -o '([0-9]{1,3}[\.]){3}[0-9]{1,3}')" != "" ];then 166 | rmIptablesNat $localport 167 | 168 | ## 建立新的中转规则 169 | iptables -t nat -A PREROUTING -p tcp --dport $localport -j DNAT --to-destination $remotehost:$remoteport 170 | iptables -t nat -A PREROUTING -p udp --dport $localport -j DNAT --to-destination $remotehost:$remoteport 171 | iptables -t nat -A POSTROUTING -p tcp -d $remotehost --dport $remoteport -j SNAT --to-source $localIP 172 | iptables -t nat -A POSTROUTING -p udp -d $remotehost --dport $remoteport -j SNAT --to-source $localIP 173 | else 174 | echo 请输入一个IP 175 | return 1 176 | fi 177 | } 178 | 179 | rmSnat(){ 180 | local localport= 181 | echo -n "本地端口号:" ;read localport 182 | echo "$localport"|[ -n "`sed -n '/^[0-9][0-9]*$/p'`" ] &&rmIptablesNat $localport 183 | } 184 | 185 | 186 | 187 | echo -e "${red}你要做什么呢(请输入数字)?Ctrl+C 退出本脚本${black}" 188 | select todo in 增加到域名的转发 删除到域名的转发 增加到IP的转发 删除到IP的转发 列出所有到域名的转发 查看iptables转发规则 189 | do 190 | case $todo in 191 | 增加到域名的转发) 192 | addDnat 193 | break 194 | ;; 195 | 删除到域名的转发) 196 | rmDnat 197 | break 198 | ;; 199 | 增加到IP的转发) 200 | addSnat 201 | break 202 | ;; 203 | 删除到IP的转发) 204 | rmSnat 205 | break 206 | ;; 207 | 列出所有到域名的转发) 208 | lsDnat 209 | ;; 210 | 查看iptables转发规则) 211 | echo "###########################################################" 212 | iptables -L PREROUTING -n -t nat --line-number 213 | iptables -L POSTROUTING -n -t nat --line-number 214 | echo "###########################################################" 215 | ;; 216 | *) 217 | echo "如果要退出,请按Ctrl+C" 218 | ;; 219 | esac 220 | done --------------------------------------------------------------------------------