分类 技术杂记 下的文章

frps作为服务端,需要在Windows服务器上实现服务后台运行,借助winsw工具快速搞定,记录如下:

  • 下载winsw
    https://github.com/winsw/winsw/releases
    下载对应的版本,如WinSW-x64.exe
  • 填写服务配置文件
    配置文件名:WinSW-x64.xml,注意取名跟所下载的应用程序名WinSW-x64.exe相同,并放入同一目录下。

    <service>
    <!--  该服务的唯一标识  -->
    <id>frps</id>
    <!--  该服务的名称  -->
    <name>frp-server</name>
    <!--  该服务的描述  -->
    <description>frp服务器</description>
    <!--  要运行的程序路径  -->
    <executable>C:\bug\frp\frps.exe</executable>
    <!--  携带的参数  -->
    <startargument>-c</startargument>
    <startargument>C:\bug\frp\frps.toml</startargument>
    <!--  第一次启动失败 60秒重启  -->
    <onfailure action="restart" delay="60 sec"/>
    <!--  第二次启动失败 120秒后重启  -->
    <onfailure action="restart" delay="120 sec"/>
    <!--  日志模式  -->
    <logmode>append</logmode>
    <!--  指定日志文件目录(相对于executable配置的路径)  -->
    <logpath>logs</logpath>
    </service>
  • 安装并启动服务

    以管理员权限运行cmd:

      WinSW-x64.exe install
      WinSW-x64.exe start
  • 查看log
    找到配置文件所在的logs目录查看即可。

Nginx 只允许Cloudflare CDN IP访问

server {
    listen 80;
    server_name your_domain.com;

    # 允许 Cloudflare 的 IP 地址访问
    # 定义允许的 IPv4 地址范围
    allow 173.245.48.0/20;
    allow 103.21.244.0/22;
    allow 103.22.200.0/22;
    allow 103.31.4.0/22;
    allow 141.101.64.0/18;
    allow 108.162.192.0/18;
    allow 190.93.240.0/20;
    allow 188.114.96.0/20;
    allow 197.234.240.0/22;
    allow 198.41.128.0/17;
    allow 162.158.0.0/15;
    allow 104.16.0.0/13;
    allow 104.24.0.0/14;
    allow 172.64.0.0/13;
    allow 131.0.72.0/22;

    # 定义允许的 IPv6 地址范围
    allow 2400:cb00::/32;
    allow 2606:4700::/32;
    allow 2803:f800::/32;
    allow 2405:b500::/32;
    allow 2405:8100::/32;
    allow 2a06:98c0::/29;
    allow 2c0f:f248::/32;

    # 禁止其他 IP 地址访问
    deny all;

    # 此处添加其他 Nginx 配置,如 location 等
}

现有一个简单的需求,需要用户弹窗选择一个铃音,要求在正式的确认之前就能播放对应的音乐作预听,微信小程序picker(mode = selector)可以实现选择确认功能,但只有点击确认后的bindchange事件,没有选择变化事件。根据微信文档,在mode = multiSelector时,有多了一个bindcolumnchange事件,灵光一闪,只有一列的multiSelector不就是selector?那不就可以把multiSelector当selector用?

wxml:

          <view class="option">铃声: 
          <picker mode="multiSelector" range="{{[ringtones]}}" data-alarmid="{{item.id}}" bindcolumnchange="bindRingtoneSelect" bindchange="bindRingtoneChange">
            <view class="picker">{{ringtones[item.ringtoneIndex]}} <text class="picker-selector"> ❯</text> </view> 
          </picker>
          </view>

特别注意其中:ringtones一维数组,调整为:[ringtones]引用。

js:

  bindRingtoneSelect: function(e) {
    proto.sendPlayMusic(e.detail.value);
  },

  bindRingtoneChange:function(e) {
    proto.sendSaveMusic(e.detail.value);
  },

实验效果完美解决~~

Debian默认root帐号shell无色彩解决

默认root帐号的shell无色彩

修改.bashrc文件为:

# ~/.bashrc: executed by bash(1) for non-login shells.

# Note: PS1 and umask are already set in /etc/profile. You should not
# need this unless you want different defaults for root.
 PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ '
# umask 022

# You may uncomment the following lines if you want `ls' to be colorized:
 export LS_OPTIONS='--color=auto'
 eval "$(dircolors)"
 alias ls='ls $LS_OPTIONS'
 alias ll='ls $LS_OPTIONS -l'
 alias l='ls $LS_OPTIONS -lA'

# Some more alias to avoid making mistakes:
# alias rm='rm -i'
# alias cp='cp -i'
# alias mv='mv -i'

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ ! -z "$PS1" ]; then
    if [ "$color_prompt" = yes ]; then
        PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
    else
        PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
    fi
fi

FOFA搜索:

body="get all proxy from proxy pool"

可以得到很多爬虫维护的代理站点:

http://113.235.121.92:5010/
http://112.74.98.149:5010/
http://159.75.88.180:5010/
http://101.200.37.197:5010/
https://49.235.191.186/
...……

拉取一个:

http://113.235.121.92:5010/all/

可得:

[{"anonymous":"","check_count":60,"fail_count":0,"https":true,"last_status":true,"last_time":"2024-06-26 14:47:38","proxy":"47.96.176.130:59394","region":"\u4e2d\u56fd \u6d59\u6c5f \u676d\u5dde \u963f\u91cc\u4e91/\u7535\u4fe1/\u8054\u901a/\u79fb\u52a8/\u94c1\u901a/\u6559\u80b2\u7f51","source":"freeProxy11"},{"anonymous":"","check_count":2,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:42","proxy":"154.203.132.49:8080","region":"\u4e2d\u56fd \u9999\u6e2f  cloudinnovation.org","source":"freeProxy11"},{"anonymous":"","check_count":5,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:38","proxy":"183.60.141.41:443","region":"\u4e2d\u56fd \u5e7f\u4e1c \u4e1c\u839e \u7535\u4fe1","source":"freeProxy11"},{"anonymous":"","check_count":44,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:39","proxy":"178.48.68.61:18080","region":"\u5308\u7259\u5229 \u5308\u7259\u5229  upc.hu","source":"freeProxy11"},{"anonymous":"","check_count":13,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:45:44","proxy":"50.62.183.223:80","region":"\u7f8e\u56fd \u4e9a\u5229\u6851\u90a3\u5dde \u51e4\u51f0\u57ce godaddy.com","source":"freeProxy11"},{"anonymous":"","check_count":163,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:37","proxy":"116.63.129.202:6000","region":"\u4e2d\u56fd \u8d35\u5dde \u8d35\u9633 \u7535\u4fe1/\u8054\u901a/\u79fb\u52a8","source":"freeProxy11"},{"anonymous":"","check_count":1,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:45:51","proxy":"120.197.40.219:9002","region":"\u4e2d\u56fd \u5e7f\u4e1c \u5e7f\u5dde \u79fb\u52a8","source":"freeProxy11/freeProxy03"},{"anonymous":"","check_count":14,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:41","proxy":"62.236.76.83:8085","region":"\u82ac\u5170 \u65b0\u5730\u533a \u8d6b\u5c14\u8f9b\u57fa dna.fi","source":"freeProxy11"},{"anonymous":"","check_count":3,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:45:44","proxy":"142.93.142.36:9122","region":"\u8377\u5170 \u5317\u8377\u5170\u7701 \u963f\u59c6\u65af\u7279\u4e39 digitalocean.com","source":"freeProxy11"},{"anonymous":"","check_count":6,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:43","proxy":"154.203.132.55:8090","region":"\u4e2d\u56fd \u9999\u6e2f  cloudinnovation.org","source":"freeProxy11"},{"anonymous":"","check_count":4,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:37","proxy":"223.113.80.158:9091","region":"\u4e2d\u56fd \u6c5f\u82cf \u5f90\u5dde \u79fb\u52a8","source":"freeProxy11"},{"anonymous":"","check_count":46,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:39","proxy":"112.19.241.37:19999","region":"\u4e2d\u56fd \u56db\u5ddd \u6210\u90fd \u79fb\u52a8","source":"freeProxy11"},{"anonymous":"","check_count":2,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:37","proxy":"51.89.73.162:80","region":"\u5fb7\u56fd \u9ed1\u68ee\u5dde \u5170\u6cb3\u7554\u6797\u5821 ovh.com","source":"freeProxy11"},{"anonymous":"","check_count":5,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:43","proxy":"154.203.132.55:8080","region":"\u4e2d\u56fd \u9999\u6e2f  cloudinnovation.org","source":"freeProxy11"},{"anonymous":"","check_count":7,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:37","proxy":"60.12.168.114:9002","region":"\u4e2d\u56fd \u6d59\u6c5f \u53f0\u5dde \u8054\u901a","source":"freeProxy03"},{"anonymous":"","check_count":2,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:40","proxy":"8.209.253.237:8080","region":"\u65e5\u672c \u4e1c\u4eac\u90fd \u4e1c\u4eac \u963f\u91cc\u4e91","source":"freeProxy07"},{"anonymous":"","check_count":9,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:47:37","proxy":"111.160.204.146:9091","region":"\u4e2d\u56fd \u5929\u6d25 \u5929\u6d25 \u8054\u901a","source":"freeProxy11"},{"anonymous":"","check_count":3,"fail_count":0,"https":false,"last_status":true,"last_time":"2024-06-26 14:45:54","proxy":"161.34.40.109:3128","region":"\u65e5\u672c \u65e5\u672c  sphere.ne.jp","source":"freeProxy11"},{"anonymous":"","check_count":4,"fail_count":0,"https":true,"last_status":true,"last_time":"2024-06-26 14:45:48","proxy":"160.248.93.84:3128","region":"\u65e5\u672c \u65e5\u672c  sphere.ne.jp","source":"freeProxy11"}]

验证

#!/bin/bash

# 代理列表
proxies=(
  "47.96.176.130:59394"
  "178.48.68.61:18080"
  "91.148.127.162:8080"
  "50.62.183.223:80"
  "116.63.129.202:6000"
  "120.197.40.219:9002"
  "212.127.93.185:8081"
  "154.203.132.55:8090"
  "142.93.142.36:9122"
  "223.113.80.158:9091"
  "112.19.241.37:19999"
  "51.89.73.162:80"
  "154.203.132.55:8080"
  "49.13.9.253:80"
  "79.110.196.145:8081"
  "60.12.168.114:9002"
  "111.160.204.146:9091"
  "91.148.126.189:8080"
  "161.34.40.109:3128"
  "160.248.93.84:3128"
  "8.219.97.248:80"
  "103.153.154.6:80"
)

# 目标URL
url="http://www.baidu.com"

# 检查代理是否有效
for proxy in "${proxies[@]}"; do
  # 通过代理发送请求
  response=$(curl -s -o /dev/null -w "%{http_code}" -x "$proxy" "$url")
  
  # 检查响应状态码
  if [ "$response" -eq 200 ]; then
    echo "Proxy $proxy is valid."
  else
    echo "Proxy $proxy is invalid."
  fi
done

结果:

Proxy 47.96.176.130:59394 is valid.
Proxy 178.48.68.61:18080 is valid.
Proxy 91.148.127.162:8080 is valid.
Proxy 50.62.183.223:80 is valid.
Proxy 116.63.129.202:6000 is valid.
Proxy 120.197.40.219:9002 is valid.
Proxy 212.127.93.185:8081 is valid.
Proxy 154.203.132.55:8090 is valid.
Proxy 142.93.142.36:9122 is valid.
Proxy 223.113.80.158:9091 is valid.
Proxy 112.19.241.37:19999 is valid.
Proxy 51.89.73.162:80 is valid.
Proxy 154.203.132.55:8080 is valid.
Proxy 49.13.9.253:80 is invalid.
Proxy 79.110.196.145:8081 is valid.
Proxy 60.12.168.114:9002 is valid.
Proxy 111.160.204.146:9091 is valid.
Proxy 91.148.126.189:8080 is invalid.
Proxy 161.34.40.109:3128 is invalid.
Proxy 160.248.93.84:3128 is valid.
Proxy 8.219.97.248:80 is valid.
Proxy 103.153.154.6:80 is valid.

总结

  1. 可以通过脚本自动获取并验证更新代理节点
  2. 还有更多的搜索方法:

      protocol=="socks5" && "Version:5 Method:No Authentication(0x00)" && after="1900-01-01" && country="CN"
     "“89e3175.js”" 或title="代理池网页管理界面"