六月 2018

2018年6月7日星期四

Linux安装qBitTorrent、Transmission


qBitTorrent以及Transmission都是BT客户端,经常挂PT的人应该都熟悉这些软件。至于哪款更好用,仁者见智吧,这里不多讨论。当然如果是我,我选择Aria2。2333~

先来安装qBitTorrent,这里我采用编译安装的方式。不得不说qBitTorrent的编译安装真的是一堆暗坑,不过我TM都给你们填好了,下面的命令一个个复制,应该是可以直接编译成功的。




Centos 7 编译安装


安装EPEL源:

yum -y install epel-release


安装开发工具包:

yum -y groupinstall "Development Tools"


安装编译所需依赖和组件:

yum -y install wget git gcc gcc-c++ qt-devel boost-devel openssl-devel qt5-qtbase-devel qt5-linguist


先来编译安装libtorrent:

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_1_6/libtorrent-rasterbar-1.1.6.tar.gz
tar -zxf libtorrent-rasterbar-1.1.6.tar.gz
cd libtorrent-rasterbar-1.1.6
./configure --prefix=/usr CXXFLAGS=-std=c++11
make
make install
ln -s /usr/lib/pkgconfig/libtorrent-rasterbar.pc /usr/lib64/pkgconfig/libtorrent-rasterbar.pc
ln -s /usr/lib/libtorrent-rasterbar.so.9 /usr/lib64/libtorrent-rasterbar.so.9


成功后如图所示:

接着来安装qBitTorrent:

cd
git clone https://github.com/qbittorrent/qBittorrent.git
cd qBittorrent
./configure --prefix=/usr --disable-gui CPPFLAGS=-I/usr/include/qt5 CXXFLAGS=-std=c++11
make
make install

完成后如图所示:

安装完成后可以直接运行:

qbittorrent-nox


第一次运行,我们需要按y然后回车同意qBitTorrent的一些条款信息:

接着qBitTorrent就运行成功了,会回显给我们初始的WEBUI地址以及账号密码:

注:
1、WEBUI地址是你的VPS公网IP+端口8080
2、管理员账号是admin密码是adminadmin
我们打开浏览器如果没问题的话,就能看到qBitTorrent的登录界面了:

使用默认的管理账号登录进去后首先要做的一件事就是修改WEB界面的语言:

接着就是要把默认的管理密码修改掉:

回到终端内按键盘组合键Ctrl+C退出运行。请注意在WEB界面上做的这些系统级别的更改,比如更改语言之类的,必须要重启qBitTorrent才能生效!

现在我们写一个服务,实现开机启动qBitTorrent和方便日常管理:

vi /usr/lib/systemd/system/qbittorrent.service


写入:

[Unit]
Description=qbittorrent torrent server

[Service]
User=root
ExecStart=/usr/bin/qbittorrent-nox
Restart=on-abort

[Install]
WantedBy=multi-user.target


重载daemon让新的配置文件生效:

systemctl daemon-reload


管理命令:

systemctl start qbittorrent
systemctl enable qbittorrent
systemctl status qbittorrent
systemctl stop qbittorrent


OK,qBitTorrent的安装就大功告成了,让我们来看看下载效果如何:

各方面使用都没有问题,很完美~
编译安装的好处就在于我们可以安装最新版的软件,可以看到我们安装的是最新版:

接下来是Transmission的安装了~

Transmission我选择直接用yum安装,因为Transmission本就定义为一个简单、轻量的BT客户端,用编译那么麻烦的方法不是和Transmission的本意相违和嘛。另外由于Transmission并不会像qBitTorrent那样经常刷“版本号”。所以,一般yum安装的版本也是较新版本。

安装EPEL源:

yum -y install epel-release


一条命令完事:

yum -y install transmission transmission-daemon


虽然Transmission的安装非常简单,但是Transmission有一些反人类的设置,比如配置文件必须要首次启动软件后才会生成。所以这里,我们要先启动:

systemctl start transmission-daemon


其次,默认的配置文件并不是最佳的配置,尤其是当我们使用WEBGUI的时候,肯定是需要自己修改的,但是Transmission的配置文件你想让更改生效就必须要先停止Transmission的运行,所以这里我们还要把刚启动的Transmission给停止运行:

systemctl stop transmission-daemon


看到这里,是不是觉得Transmission这玩意是真有点蛋疼啊,没事,更蛋疼的还在后面。

查找一下配置文件到底在哪里:

find / -name settings.json


找到了,路径如下:

/var/lib/transmission/.config/transmission-daemon/settings.json


编辑它

vi /var/lib/transmission/.config/transmission-daemon/settings.json


需要更改的地方如下图红框所示:

注:

1、rpc-authentication-required的值改为true。

2、rpc-host-whitelist-enabled的值改为false。

3、rpc-password请设置一个高强度的密码。

4、rpc-username是你的WEBGUI登录用户名,这里可以自定义填写。

5、rpc-whitelist-enabled的值改为false。

OK,配置文件改完后,我们现在重新运行Transmission:

systemctl start transmission-daemon


现在通过浏览器访问你的VPS公网IP+端口9091应该就可以访问到Transmission的WEB界面了,并且是需要进行登录验证的,而用来验证的账号密码就是刚才在配置文件内设置的:

登录进去之后,我们尝试下载一个文件试试:

也是完全OK的,使用没任何问题~

通过EPEL源安装的Transmission版本是2.92:


值得一提的是,这个版本被爆出有安全漏洞,不过影响不是特别大。只要设置了rpc-authentication-required是可以无视掉的。当然如果你不是特别放心的话,那就只能自己编译安装最新的2.93版了。

写在最后:

其实我自己也基本不玩什么PT、BT之类的,对于这两款软件到底谁更好我也说不清楚,但是就这两个的软件特性和区别还是很明显的。

1、在WEBGUI美观方面,虽然两个都设计的挺丑的,但是很明显Transmission更丑更单调一点。。。

2、在WEBGUI易用方面,qBitTorrent也明显要好于Transmission。qBitTorrent有中文支持,其次功能、可设置项要比Transmission多。

3、可能大家最关系的是下载速度,但是我目前测试不出来这两个软件下载速度哪个更快,感觉都差不多。

Debian安装qBit



[v_error]这个方法我没有测试过,所以不清楚到底好不好用,感谢熊猫大佬提供的脚本[/v_error]

Debian 8



wget http://www.wxbook.win/789.sh
chmod 777 789.sh
./789.sh


Debian 9



wget http://www.wxbook.win/qbit.sh
chmod 777 qbit.sh
./qbit.sh

2018年6月6日星期三

远程服务器上安装和使用Resilio Sync


Resilio Sync(之前叫BitTorrent Sync)是一款跨平台的文件同步工具,由于不依托服务器,因此成为文件共享的又一选择,大家既可以配合VPS,用它来搭建一个网盘,也可以借助他的共享能力用来和朋友共享文件。网上有不少关于Windows平台上他的教程,没什么难度,因此本文不赘述。本文要讨论的是在Linux VPS下(即在命令行下借助Web界面管理文件)的使用方法。


安装Resilio Sync


官方推荐使用软件源进行安装:

Debian系



echo "deb http://linux-packages.resilio.com/resilio-sync/deb resilio-sync non-free" | sudo tee /etc/apt/sources.list.d/resilio-sync.list
curl -LO https://linux-packages.resilio.com/resilio-sync/key.asc && sudo apt-key add ./key.asc
apt-get update
sudo apt-get install resilio-sync


CentOS系


/etc/yum.repos.d/resilio-sync.repo中加入如下内容


[resilio-sync]
name=Resilio Sync
baseurl=http://linux-packages.resilio.com/resilio-sync/rpm/$basearch
enabled=1
gpgcheck=1


导入Key

rpm --import https://linux-packages.resilio.com/resilio-sync/key.asc


安装Resilio Sync

yum update
yum install resilio-sync


运行Resilio Sync


由于Resilio Sync需要Web界面进行管理,因此,启动时需要加一些参数

rslsync --webui.listen 0.0.0.0:8888 #端口可以自定义


返回以下内容表示已成功启动

By using this application, you agree to our Privacy Policy, Terms of Use and End User License Agreement.
https://www.getsync.com/legal/privacy
https://www.getsync.com/legal/terms-of-use
https://www.getsync.com/legal/eula

Resilio Sync forked to background. pid = 32766

2018年6月5日星期二

Windows10使用HWIDGen申请永久数字许可证


HWIDGen是一款由国外Nsane论坛会员s1ave77制作的Windows 10数字权利激活工具,这款Win10数字权利获取工具,可以自动获取Windows 10 数字许可证激活,无需产品密钥,以最简单的方式永久激活。
原帖地址:http://www.nsaneforums.com/topic/312871-windows-10-digital-license-hwid-generation-without-kms-or-predecessor-installupgrade/


数字权利激活


什么是“数字权利激活”?数字许可证激活是 Windows 10 中新加入的激活方式,是一种授权方法的分类。

数字许可证会记录您的硬件设备信息,只要在CPU和主板设备没有更换的情况下就可以连接微软服务器自动永久性的激活系统,重新安装系统时无需再次输入产品密钥,安装后会自动永久激活。

“数字权利激活”在不更换电脑硬件的情况下一直有效,无论您安装的系统是正式版还是预览版,不影响永久激活效果。

支持的系统


目前基本上支持大部分Win 10系统!

Windows 10 Cloud
Windows 10 Cloud(N)
Windows 10 Core(N)
Windows 10 CoreCountrySpecific
CWindows 10 oreSingleLanguage
Windows 10 Core
Windows 10 Education
Windows 10 Education(N)
Windows 10 Enterprise
Windows 10 Enterprise(S)
Windows 10 EnterpriseS(N)
Windows 10 Professional
Windows 10 Professional(N)
Windows 10 ProfessionalEducation
Windows 10 ProfessionalEducation(N)
Windows 10 ProfessionalWorkstation
Windows 10 ProfessionalWorkstation(N)
Windows 10 LTSB 2015
Windows 10 LTSB 2016


手动激活


[v_error]操作比较复杂!不建议小白入手![/v_error]
1. Get GatherOsState.exe from Windows 10 17134 ISO
2. Get latest version of slshim from https://github.com/vyvojar/slshim/releases
3. Extract slshim32.dll (for gatherosstate from x86 ISO) or slshim64.dll (for gatherosstate from x64 ISO)
4. Place gatherosstate and extracted slshim dll in the same directory
5. Rename slshim dll to slc.dll
6. Import this to registry:
6.1. Set the real value for %sku% from beneath list.

edition=Cloud
sku=178

edition=CloudN
sku=179

edition=Core
sku=101

edition=CoreCountrySpecific
sku=99

edition=CoreN
sku=98

edition=CoreSingleLanguage
sku=100

edition=Education
sku=121

edition=EducationN
sku=122

edition=Enterprise
sku=4

edition=EnterpriseN
sku=27

edition=EnterpriseS
sku=125

edition=EnterpriseSN
sku=126

edition=Professional
sku=48

edition=ProfessionalEducation
sku=164

edition=ProfessionalEducationN
sku=165

edition=ProfessionalN
sku=49

edition=ProfessionalWorkstation
sku=161

edition=ProfessionalWorkstationN
sku=162


Replace the ‘XXX’ with the needed sku value. If using REG make sure the string is 7 digits long, the CMD will take the value from above.

CMD:

reg add "HKLM\SYSTEM\Tokens" /v "Channel" /t REG_SZ /d "Retail" /f
reg add "HKLM\SYSTEM\Tokens\Kernel" /v "Kernel-ProductInfo" /t REG_DWORD /d XXX /f
reg add "HKLM\SYSTEM\Tokens\Kernel" /v "Security-SPP-GenuineLocalStatus" /t REG_DWORD /d 1 /f
reg add "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\gatherosstate.exe" /d "^ WIN7RTM" /f


Make shure the XXX are peplaced by shown ID from above SKUID list.
Adapt the above path to gatherosstate.exe to the actual path.

7. Enter default Retail/OEM key from products ini

Key list from 17134.1 products.ini:
Site: https://pastebin.com
ShareCode: /rYakstDc

if you have Enterprise N or LTSB 2016 N use this in elevated Powershell:

::EnterpriseN
((Get-Content '.\gatherosstate.exe') -replace "`0" | Select-String -Pattern "(.....-){4}C372T" -AllMatches).Matches | Select-Object -ExpandProperty Value

::EnterpriseSN
((Get-Content '.\gatherosstate.exe') -replace "`0" | Select-String -Pattern "(.....-){4}VMJWR" -AllMatches).Matches | Select-Object -ExpandProperty Value

this will gather the key from within gatherosstate.exe

8. Run gatherosstate. After a few seconds you should get GenuineTicket.xml
9. (optional) Remove HKEY_LOCAL_MACHINE\SYSTEM\Tokens from registry.

CMD:

reg delete "HKLM\SYSTEM\Tokens" /f
reg delete "HKCU\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers" /v "C:\gatherosstate.exe" /f



10. Place the created genuineticket at the root of c:\ and in admin CMD:

clipup -v -o -altto c:\


11. then force activation with:

cscript /nologo %windir%\system32\slmgr.vbs -ato

自动激活


该版本是作者s1ave77提供的!全E英文操作!大家可以尝试其他几种!
软件下载:链接: 下载hwidgen
解压密码:3Fs44Rv#tZ4u3UOij656NgF____


批处理激活版


这个也不错,可以直接看源码,放心安逸~~
软件下载地址:链接: 点击下载
萌卡大佬优化:链接: 点击下载

C#激活版本


比较推荐这个版本也不错!比较直观!
软件下载地址:链接: 点击下载
C#代码编写~ 可以利用反编译工具看代码内容。
推荐大家试一试这个!!
该版本来自:吾爱破解-W10数字许可激活C#版v2.6.7【已支持LTSB2015】

特别提醒


激活过程中,保持电脑联网,且开启Windows Update!避免使用V_P_N!

有些杀毒软件会提示软件有病毒。大家可以参考下:远景论坛-关于最近hwidgen.mk3 病毒的发表下个人看法。

最后说明


所有附件均存放在OneDrive,如出现无法下载的情况,请留言,我将尽快更换。

2018年6月1日星期五

使用 Nginx 屏蔽部分国家或地区IP,禁止访问网站



博主的环境是用宝塔搭建的,所以安装目录会和正常的LNMP目录不太一样。


使Nginx支持GeoIP


我们先检查一下Nginx 是否有GeoIP模块。

nginx -V

看下输出界面有没有包含 --with-http_geoip_module ,如果有的话就说明Nginx 已经编译了GeoIP模块,直接到安装GeoIP检查GeoIP这一步。

安装GeoIP


如果没有安装GeoIP模块,先安装GeoIP

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz
tar -zxvf GeoIP.tar.gz
cd GeoIP-1.4.8
./configure
make
make install
echo '/usr/local/lib' > /etc/ld.so.conf.d/geoip.conf
ldconfig

添加未编译安装模块


cd 到Nginx 源码目录,因为我是用宝塔安装的环境,所以目录在/www/server/nginx

cd /www/server/nginx/src

使用参数从新配置,注意这里参数是直接复制 nginx -V 显示出来的,把configure arguments: 后面的参数复制出来,后面加上--with-http_geoip_module


./configure --user=www --group=www --prefix=/www/server/nginx --with-openssl=/www/server/nginx/src/openssl --add-module=/www/server/nginx/src/ngx_devel_kit --add-module=/www/server/nginx/src/lua_nginx_module --add-module=/www/server/nginx/src/ngx_cache_purge --with-http_stub_status_module --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_gunzip_module --with-stream --with-stream_ssl_module --with-ipv6 --with-http_sub_module --with-http_flv_module --with-http_addition_module --with-http_realip_module --with-http_mp4_module --with-ld-opt=-Wl,-E --with-ld-opt=-ljemalloc --with-http_geoip_module #不要复制这里的,要根据自己的进行修改


等上面执行完了,然后再编译

make

替换Nginx 二进制文件。(最好备份下当前Nginx 文件,避免出问题了没办法恢复)

#我这边是用宝塔安装的环境,目录是/www/server/nginx,如果不是宝塔安装的环境,请换成自己服务器上的目录
#先停止nginx 再替换二进制文件,提示overwrite 的话记得输入y后回车。
service nginx stop
cp /www/server/nginx/sbin/nginx /www/server/nginx/sbin/nginx.bak
cp ./objs/nginx /www/server/nginx/sbin/

替换成功后,重启Nginx。然后查看一下GeoIP模块加载情况。如果后面包含了--with-http_geoip_module 就成功了。

service nginx start
nginx -V


检查GeoIP


检查一下/usr/local/share/GeoIP/目录是否包含GeoIP.dat,如果没有的就直接下一个最新的数据库

cd /usr/local/share/GeoIP/
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
gunzip GeoIP.dat.gz

配置Nginx,添加变量


打开Nginx 配置文件。

#注意!目录换成自己的Nginx 目录,我这个目录是宝塔安装的 ,或者进入面板修改
vim /www/server/nginx/conf/nginx.conf

添加变量,在http{} 区域任意位置添加如下变量

geoip_country /usr/local/share/GeoIP/GeoIP.dat;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;


配置规则


在你需要的网站上配置规则
编辑Nginx 网站配置文件,在server {} 区域内添加代码

#返回403
if ($geoip_country_code = CN) {
return 403;
}


#指定页面
if ($geoip_country_code = CN) {
root /451.html;
}

上面那段代码,CN 就是中国大陆地区,如果中国大陆地区的IP 访问网站就返回403,当然你也可以单独写一个界面返回到指定界面。如果你想屏蔽其他国家或地区的IP 访问 那么把RU 改成对应就可以了 ,以此类推。
这样就设置完毕了,可以任意屏蔽某个国家的IP 访问。当然GeoIP还有很多种写法,还可以屏蔽某个城市的IP,想学的话可以去网上找找。

附表:



[v_tips]中国大陆地区编号:
相应的省份代码:

CN,01,”Anhui”
CN,02,”Zhejiang”
CN,03,”Jiangxi”
CN,04,”Jiangsu”
CN,05,”Jilin”
CN,06,”Qinghai”
CN,07,”Fujian”
CN,08,”Heilongjiang”
CN,09,”Henan”
CN,10,”Hebei”
CN,11,”Hunan”
CN,12,”Hubei”
CN,13,”Xinjiang”
CN,14,”Xizang”
CN,15,”Gansu”
CN,16,”Guangxi”
CN,18,”Guizhou”
CN,19,”Liaoning”
CN,20,”Nei Mongol”
CN,21,”Ningxia”
CN,22,”Beijing”
CN,23,”Shanghai”
CN,24,”Shanxi”
CN,25,”Shandong”
CN,26,”Shaanxi”
CN,28,”Tianjin”
CN,29,”Yunnan”
CN,30,”Guangdong”
CN,31,”Hainan”
CN,32,”Sichuan”
CN,33,”Chongqing”


[/v_tips]