海运的博客

使用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:
        #防止开机时wlan0未连接导致systemd-networkd-wait-online阻塞系统启动
        optional: true
        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

openwrt/PandoraBox通过cgi-bin脚本获取网络状态

发布时间:February 23, 2021 // 分类: // No Comments

通过lua脚本获取wan联网状态:

#!/usr/bin/lua
require 'luci.sys'

print("Content-Type: text/html")
print("")       

status = luci.sys.exec("ifstatus wan")
print(status)

通过sh:

#!/bin/sh
echo "Content-Type: text/html"
echo ""
echo `ifstatus wan`

保存到/www/cgi-bin/目录,并添加执行权限,测试:

curl 192.168.1.1/cgi-bin/file

linux/ubuntu/centos系统多ip指定出口ip

发布时间:February 21, 2021 // 分类: // No Comments

1.修改路由表指定默认路由源ip,也可设置metric优先级指定出口ip:

ip route change default via 192.168.1.1 dev eth0 src 192.168.1.9

2.也可使用iptables snat,扩展可对目标ip、端口、应用软件等单独指定出口ip。

iptables -t nat -I POSTROUTING -o eth0 -d 0.0.0.0/0 -j SNAT --to-source 192.168.1.9
分类
最新文章
最近回复
  • opnfense: 谢谢博主!!!解决问题了!!!我之前一直以为内置的odhcp6就是唯一管理ipv6的方式
  • liyk: 这个方法获取的IPv6大概20分钟之后就会失效,默认路由先消失,然后Global IPV6再消失
  • 海运: 不好意思,没有。
  • zongboa: 您好,請問一下有immortalwrt設定guest Wi-Fi的GUI教學嗎?感謝您。
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
归档