Skip to content

Instantly share code, notes, and snippets.

View hexiyou's full-sized avatar

He Xiyou hexiyou

View GitHub Profile
@hexiyou
hexiyou / trojanports.sh
Last active February 2, 2024 12:17
通用函数trojanports:Cygwin或Msys2一键查询trojan-qt5的监听端口号,并且探测端口类型!
trojanports() {
## 读取 Trojan-qt5.exe 代理端口配置;
## See Also:"D:\Extra\Trojan-Qt5-Windows-1.4.0\config.json"
print_color 40 "通过 netstat 命令获取 trojan-qt5.exe 端口监听信息..."
local pid=$(ps2 trojan-qt5.exe --nopath|dos2unix -q|awk -F '=' '/ProcessId=/{print $2;exit}')
[ -z "$pid" ] && print_color 9 "没有发现 trojan-qt5.exe 进程!" && return
local portsInfo=$(netstat -ano|grep $pid|dos2unix -q|awk -F " " '{if(match($2,/0.0.0.0:/) && $4=="LISTENING") print;}'|tee /dev/tty)
local portsInfo=$(echo "$portsInfo"|awk -F " " '{sub("0.0.0.0","127.0.0.1",$2);print}')
print_color 40 "探测各个端口类型..."
while read line
读书,先是从厚读到薄,然后是从薄读到厚;写代码也是一样一样的
不停coding,但又及时回顾、提炼,总结出一些规律和方法,再从这些规律和方法出发,指导后续的工作,这是一个「从厚到薄」的过程
针对其中的每个点,可以从容自得地、深入浅出地讲解、分享给其他人,可以解决一些深层次的问题,这个过程就是「从薄到厚」
正所谓「厚积薄发」,「厚积」容易,「薄发」难,最近这半年在支付宝的工作,自我感觉提升非常大,但是提升的内容仅仅只能抽象出一些要点,还做不到由点及面地开展,简单记录下,希望不久将来,可以「薄发」
架构层面
@hexiyou
hexiyou / quote.vimrc
Last active March 15, 2023 04:44
Vimrc配置:引号、括号自动补全
set nocompatible
" 括号自动补全
inoremap ( ()<Esc>i
inoremap [ []<Esc>i
inoremap { {<CR>}<Esc>O
autocmd Syntax html,vim inoremap < <lt>><Esc>i| inoremap > <c-r>=ClosePair('>')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap } <c-r>=CloseBracket()<CR>
@hexiyou
hexiyou / powershell-net.ps1
Created March 1, 2023 15:59 — forked from angel-vladov/powershell-net.ps1
PowerShell function you can use for reading UTF8 encoded HTML pages content. The built in Invoke-WebRequest and Invoke-RestMethod fail miserably.
function Read-HtmlPage {
param ([Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true)][String] $Uri)
# Invoke-WebRequest and Invoke-RestMethod can't work properly with UTF-8 Response so we need to do things this way.
[Net.HttpWebRequest]$WebRequest = [Net.WebRequest]::Create($Uri)
[Net.HttpWebResponse]$WebResponse = $WebRequest.GetResponse()
$Reader = New-Object IO.StreamReader($WebResponse.GetResponseStream())
$Response = $Reader.ReadToEnd()
$Reader.Close()
@hexiyou
hexiyou / sshfind.pl
Created December 28, 2022 15:22
Perl小脚本:根据主机名称关键字筛选~/.ssh/config主机配置项
#!/usr/bin/perl -W
#用途:命令行传递主机名称关键字搜索~/.ssh/config的主机配置项
#参数说明:
# $1 --- 主机名称搜索关键字
# $2 --- 要显示主机的个数限制
#Usage:
# sshfind.pl racknerd #查找主机名包含racknerd的主机
# sshfind.pl racknerd 1 #查找主机名包含racknerd的主机,仅列出一个
# sshfind.pl . 5 #查找主任意关键字主机,仅列出前5个
@hexiyou
hexiyou / H2Command
Created December 20, 2022 05:16 — forked from johnnian/H2Command
H2命令行
## 命令行工具
H2数据库提供了一组命令行工具,如果你需要了解这些工具,使用参数`-?`,如:
java -cp h2*.jar org.h2.tools.Backup -?
命令行工具有:
* Backup 创建数据库备份
* ChangeFileEncryption 允许改变文件加密密码和数据库的加密算法
@hexiyou
hexiyou / _hook-cd.sh
Created December 8, 2022 18:24
劫持cd命令,方便在手机终端不方便打汉字的情况下交互式选择切换到子目录
_hook-cd() {
#劫持cd命令,方便在手机终端不方便打汉字的情况下切换目录
[ $# -gt 0 ] && \cd "$@" && return
[[ "$-" != *i* ]] && \cd "$@" && return #非交互式会话操作直接返回
[ -z "$SSH_TTY" ] && \cd "$@" && return #如果是本地终端窗口,不是SSH远程会话连接,则不做任何修改
#echo "创建交互式选择列表..."
print_color 40 "请选择要切换到的子目录..."
local subDirs=$(\ls -F|grep '/$'|tr '\t' '\n')
local toDir
echo "$subDirs"|awk '{print NR" ):"$0}'
@hexiyou
hexiyou / ddos
Created December 8, 2022 18:22 — forked from ubear/ddos
#!/usr/bin/perl
####################################
# Design By Mistiq
#-[Zr Commands List]-
#-----[Hacking Based]-----
@hexiyou
hexiyou / host_ports.pl
Created December 8, 2022 13:41 — forked from mshock/host_ports.pl
Perl test host port connectivity
#! perl -w
# test ports 80 and 1433 on given IP
# HTTP and SQL
# for new NAT addresses
use strict;
use IO::Socket::PortState qw(check_ports);
my $timeout = 10;
@hexiyou
hexiyou / gitstats.sh
Created November 20, 2022 10:02 — forked from xeoncross/gitstats.sh
Git - calculate how many lines of code were added/changed by someone
# Run this in the project repo from the command-line
# http://stackoverflow.com/a/4593065/99923
git log --shortstat --author "Xeoncross" --since "2 weeks ago" --until "1 week ago" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'