pt torrent种子自动辅种相似度计算
发布时间:March 5, 2021 // 分类:PT // No Comments
torrent解析类使用https://github.com/Rhilip/Bencode,打补丁支持获取种子hash信息。
--- Bencode.php.1 2021-02-24 07:30:41.677067125 +0800
+++ Bencode.php 2021-03-05 17:52:23.803081067 +0800
@@ -26,6 +26,9 @@
*/
class Bencode
{
+ public function info_hash($data, $info_hash) {
+ return sha1(substr($data, $info_hash['pos'], $info_hash['length']));
+ }
/**
* Decode bencoded data from string
*
@@ -46,7 +49,15 @@
$return = [];
while ($data[$pos] !== 'e') {
$key = self::decode($data, $pos);
+ if (!strcmp($key, "info")) {
+ //if ($key === "info") {
+ $return['info_hash']['pos'] = $pos;
+ }
$value = self::decode($data, $pos);
+ if (!strcmp($key, "info")) {
+ //if ($key === "info") {
+ $return['info_hash']['length'] = ($pos - $return['info_hash']['pos']);
+ }
if ($key === null || $value === null) {
break;
}
@@ -125,6 +136,9 @@
$return = '';
$check = -1;
$list = true;
+ if (isset($data['info_hash'])) {
+ unset($data['info_hash']);
+ }
foreach ($data as $key => $value) {
if ($key !== ++$check) {
$list = false;
解析种子torrent所包含的文件名称信息,将名称和文件大小组合排序并计算sha,sha相同则2个种子内容一样可自动辅种。
<?php
require_once './Bencode.php';
require_once './ParseErrorException.php';
$bencode = new Bencode();
$str = file_get_contents($filename);
$s = $bencode->decode($str);
if (isset($s['info']["files"])) {
foreach ($s['info']["files"] as $v) {
$length = $v["length"];
$file = end($v["path"]);
$save[] = $length.$file;
}
} else {
$length = $s['info']["length"];
$file = $s['info']["name"];
$save[] = $length.$file;
}
if (isset($s["encoding"])) {
$coding = $s["encoding"];
} else {
$coding = mb_detect_encoding(implode('', $save), ['UTF-8', 'GB18030', 'GBK', 'GB2312', 'ISO-8859-1']);
echo 'detect encoding: '.$coding.PHP_EOL;
}
if (!$coding) {
$coding = 'UTF-8';
}
if ($coding != "UTF-8") {
foreach ($save as $k => $v) {
$save[$k] = mb_convert_encoding($v, "UTF-8", $coding);
}
}
sort($save);
$sha1 = sha1(implode('', $save));
使用Tampermonkey油猴脚本自动抢购斯巴达spartanhost vps
发布时间:March 1, 2021 // 分类: // 3 Comments
最近斯巴达vps比较火,一机难求,写了个js脚本用于抢购,效果还不错,推荐使用chrome浏览器,安装Tampermonkey扩展使用。
// ==UserScript==
// @name 自动抢购买vps
// @namespace https://www.haiyun.me
// @version 0.1
// @description buy spartanhost vps
// @author www.haiyun.me
// @match https://billing.spartanhost.net/cart.php?a=*
// @grant none
// ==/UserScript==
(function() {
var forcedReload = false;
var time = 500;
var url = document.URL;
var hostname = "www.haiyun.me";
var customfield = "website";
if (document.title == '502 Bad Gateway') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '504 Gateway Time-out') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '503 Service Temporarily Unavailable') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.title == '500 Internal Server Error') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
} else if (document.getElementsByTagName('h1')[0].innerHTML == '无法访问此网站') {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
}
if (url.indexOf("https://billing.spartanhost.net/cart.php?a=add") != -1) {
var str = document.getElementById("order-boxes").innerHTML;
if (str.indexOf("Out of Stock") != -1) {
setTimeout(function() {
window.location.reload(forcedReload);
}, time);
}
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=confproduct") != -1) {
document.getElementById("inputHostname").value = hostname;
var element = document.querySelector('input[name^="customfield"]');
element.value = customfield;
document.getElementById("btnCompleteProductConfig").click();
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=view") != -1) {
document.getElementById("checkout").click();
} else if (url.indexOf("https://billing.spartanhost.net/cart.php?a=checkout") != -1) {
document.getElementById("iCheck-accepttos").click();
document.getElementById("btnCompleteOrder").click();
}
})();
windows10添加多ip地址及指定出口ip
发布时间:February 24, 2021 // 分类: // No Comments
查看网卡名称及编号:
netsh int ipv4 show int
查看当前ip地址:
netsh int ipv4 show ipadd level=verbose
开启dhcp和静态ip共存:
netsh int ipv4 set int "Ethernet0" dhcpstaticipcoexistence=enabled
添加ip地址,skipassource设置是否使用此ip为出口源ip,默认新添加的ip为出口ip:
netsh int ipv4 add add "Ethernet0" 192.168.1.22/24 skipassource=true
已添加的ip修改skipassource参数:
Get-NetIPAddress 192.168.1.22 | Set-NetIPAddress -SkipAsSource $True
Set-NetIPAddress -IPAddress "192.168.1.22" -InterfaceAlias "Ethernet0" -SkipAsSource $false
多网卡可修改路由及网卡metric跃点数指定优先网络出口:
netsh int ipv4 show rou
netsh int ipv4 set int "Ethernet0" metric=2
netsh int ipv4 set rou 0.0.0.0/0 "Ethernet0" 192.168.1.1 metric=100
route change 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 100 if 4
n1盒子连接手机4G无线热点做k2p宽带pppoe备份线路并切换
发布时间:February 24, 2021 // 分类:N1,K2P // No Comments
k2p主路由地址:192.168.1.1
n1盒子地址:192.168.1.2
k2p添加低优先级默认路由走n1,此路由只有pppoe断开后才有效:
ip rou add default via 192.168.1.2 dev br-lan metric 1000
n1盒子用netplan配置无线网络默认路由和无线热点的路由优先级,默认情况下走k2p主路由,当路由器pppoe不能连接时打开手机无线热点则自动走手机4g网络连接。
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.1.2/24
dhcp4: false
dhcp6: true
accept-ra: true
#gateway4: 192.168.1.1
routes:
- to: 0.0.0.0/0
via: 192.168.1.1
metric: 1000
nameservers:
addresses:
- 192.168.1.1
search: []
wifis:
wlan0:
dhcp4: yes
dhcp6: no
dhcp4-overrides:
route-metric: 600
access-points:
"Phone-ssid":
password: "www.haiyun.me"
n1盒子开启snat及网络转发:
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sysctl -w net.ipv4.ip_forward=1
分类
- Apache (13)
- Nginx (45)
- PHP (86)
- IIS (8)
- Mail (17)
- DNS (15)
- Cacti (14)
- Squid (5)
- Nagios (4)
- Puppet (7)
- CentOS (13)
- Iptables (23)
- RADIUS (3)
- OpenWrt (41)
- DD-WRT (1)
- VMware (9)
- 网站程序 (2)
- 备份存储 (11)
- 常用软件 (20)
- 日记分析 (10)
- Linux基础 (18)
- 欧诺代理 (0)
- Linux服务 (18)
- 系统监控 (4)
- 流量监控 (7)
- 虚拟化 (28)
- 伪静态 (2)
- LVM (3)
- Shell (18)
- 高可用 (2)
- 数据库 (16)
- FreeBSD (3)
- 网络安全 (25)
- Windows (35)
- 网络工具 (22)
- 控制面板 (3)
- 系统调优 (10)
- Cisco (3)
- VPN (5)
- ROS (20)
- Vim (14)
- KMS (4)
- PXE (2)
- Mac (1)
- Git (1)
- PE (1)
- LNS (2)
- Xshell (7)
- Firefox (13)
- Cygwin (4)
- OpenSSL (9)
- Sandboxie (3)
- StrokesPlus (1)
- AutoHotKey (4)
- Total Commander (3)
- WordPress (3)
- iMacros (6)
- Typecho (2)
- Ollydbg (1)
- Photoshop (1)
- 正则 (3)
- Debian (3)
- Python (8)
- NoSQL (6)
- 消息队列 (4)
- JS (7)
- Tmux (3)
- GO (7)
- HHVM (2)
- 算法 (1)
- Docker (2)
- PT (15)
- N1 (16)
- K2P (6)
- LUKS (4)
最新文章
- 此内容被密码保护
- pt torrent种子自动辅种相似度计算
- 使用Tampermonkey油猴脚本自动抢购斯巴达spartanhost vps
- windows10添加多ip地址及指定出口ip
- n1盒子连接手机4G无线热点做k2p宽带pppoe备份线路并切换
- openwrt/PandoraBox通过cgi-bin脚本获取网络状态
- linux/ubuntu/centos系统多ip指定出口ip
- ubuntu安装Knot 域名权威Authoritative DNS服务器配置ddns动态更新ip
- ubuntu 20.04安装hwe最新内核kernel
- nginx配置webdav及使用curl测试
最近回复
- spartan2: https://dashboard.hcaptcha.com/welcome_accessib...
- 海运: 应该能,在购买页面先手工跳过cf机器验证,后续一定时间内不更换ip应该不会再次验证。
- spartan: 大佬斯巴达开启了CF的机器识别验证,请问插件能自动跳过吗? 另外这个脚本有没有简单使用说明,新...
- vincent: 膜拜大佬
- 海运: proxy-header或proxy_protocol
- liangjw: 如果是 内部调用 或者 中间存在 代理 而上一个代理又在内网 ,那怎么处理来自代理私有IP?
- chainofhonor: 感谢,用dnsmasq设置自动判断BIOS和UEFI成功了
- 海运: 不好意思,这个是很多年前的,现在也许已经不适用,我现在也不用多线了。
- CQ: -m state --state NEW 替换成-m conntrack --ctstate NEW
- CQ: 你好,我入站已经成功分流,但是不知道出站怎么设置,PREROUTING替换成POSTROUTI...
归档
- April 2021
- March 2021
- February 2021
- January 2021
- December 2020
- November 2020
- October 2020
- September 2020
- July 2020
- May 2020
- April 2020
- March 2020
- February 2020
- January 2020
- December 2019
- November 2019
- July 2019
- April 2019
- March 2019
- February 2019
- January 2019
- December 2018
- November 2018
- October 2018
- September 2018
- August 2018
- July 2018
- June 2018
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- October 2017
- September 2017
- August 2017
- July 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- November 2016
- July 2016
- June 2016
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- November 2013
- October 2013
- August 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- March 2012
- February 2012
- October 2011
- September 2011
- August 2011
- July 2011