Skip to content

Instantly share code, notes, and snippets.

@sfilyh
sfilyh / tcpdump-es-capture
Created October 25, 2022 05:45 — forked from z0mbix/tcpdump-es-capture
Capture Elasticsearch Queries
# tcpdump -A -nn -s 0 'tcp dst port 9200 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' -i lo
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
14:32:33.525122 IP 127.0.0.1.49777 > 127.0.0.1.9200: Flags [P.], seq 313752908:313753888, ack 2465010394, win 257, options [nop,nop,TS val 2684167067 ecr 2684167066], length 980
E...^.@.@............q#...}L...............
..#...#.GET /index/_search HTTP/1.1
Host: 127.0.0.1:9200
Accept: */*
Content-Length: 845
Content-Type: application/x-www-form-urlencoded
@sfilyh
sfilyh / alert.sh
Created August 31, 2022 08:38 — forked from cherti/alert.sh
send a dummy alert to prometheus-alertmanager
#!/bin/bash
name=$RANDOM
url='http://localhost:9093/api/v1/alerts'
echo "firing up alert $name"
# change url o
curl -XPOST $url -d "[{
\"status\": \"firing\",
@sfilyh
sfilyh / Capture_HTTP_traffic.sh
Created August 29, 2022 09:35 — forked from igreenfield/Capture_HTTP_traffic.sh
Capture HTTP traffic: tcpdump
#!/bin/bash
##########################################
# Generate Filter tool:
# https://www.wireshark.org/tools/string-cf.html
#
# GET Filter:
# tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420
# POST Filter:
# tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354 && tcp[((tcp[12:1] & 0xf0) >> 2) + 4:1] = 0x20
<!-- plug-in configuration to put into your parent POM for avoiding any usages of outdated log4j2 versions,
some of which are subject to the RCE CVE-2021-44228 ("Log4Shell") -->
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>ban-bad-log4j-versions</id>
@sfilyh
sfilyh / ffmpeg download m3u8.md
Last active March 6, 2021 13:18
ffmpeg 下载 m3u8视频
ffmpeg  -i "http://abc.com/file.m3u8" -vcodec copy -acodec copy -absf aac_adtstoasc  123456.mp4
@sfilyh
sfilyh / proxy.sh
Created March 6, 2021 13:13
mac 切换代理脚本
#!/bin/bash
networksetup -setwebproxystate "Wi-Fi" off
networksetup -setsecurewebproxystate "Wi-Fi" off
networksetup -setautoproxyurl "Wi-Fi" http://pac25v2.test.upcdn.net/squid.pac
echo '已启用局部代理!'
@sfilyh
sfilyh / switch.sh
Last active March 6, 2021 13:13
git 多分支切换脚本
#!/bin/bash
BRANCH_NAME=$1
SRC_DIR="/Users/user/poject/all_branch/${BRANCH_NAME}"
echo $SRC_DIR
if [ ! -d $SRC_DIR ];then
git clone https://github.com/sdemo/sdemo.git $SRC_DIR
fi

Direct copy of pre-encoded file:

$ ffmpeg -i filename.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls filename.m3u8