Skip to content

Instantly share code, notes, and snippets.

View sursir's full-sized avatar
💥
COME BACK

Heisenberg sursir

💥
COME BACK
View GitHub Profile
@sursir
sursir / 攻击.md
Created February 26, 2018 11:34
Replay Attacks MITM XSS CSRF
  • MITM: 中间人攻击 HTTPS
  • XSS: 浏览器漏洞JS攻击 过滤
  • CSRF: http header: TOKEN,# 无法完全避免,只能尽量,如果被xss+预制你的token key,一样被获取到token然后进行攻击
  • Replay: 过期时间
@sursir
sursir / sign 与 token 的区别.md
Last active February 26, 2018 09:47
sign signature token

Signature 签名

赋予签名,客户端在私密环境下(服务器环境)向服务端请求数据或动作,服务端保证请求方是被授权客户

应用场景

  • 客户认证

详细说明

一次性的身份校验方式,常见于不同项目间的api通信

@sursir
sursir / jwt.md
Last active February 26, 2018 10:01
jwt

JSON web Token,简称JWT,本质是一个token,是一种紧凑的URL安全方法,用于在网络通信的双方之间传递。一般放在HTTP的headers 参数里面的authorization里面,值的前面加Bearer关键字和空格。除此之外,也可以在url和request body中传递。


作者:space back
链接:https://www.zhihu.com/question/36135526/answer/136603826
来源:知乎
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。

  • 单点登录
@sursir
sursir / 火焰图.md
Created February 24, 2018 07:17
perf flamegraph flame graph
yum install perf
ps aux | grep filebeat
perf record -F 99 -p 20315 -g -- sleep 10s
perf record -F 99 -p 5559 -g -- sleep 10s
perf script > test_out.perf

~/FlameGraph-master/stackcollapse-perf.pl --kernel < ./test_out.perf | ~/FlameGraph-master/flamegraph.pl --hash > ./test_out.svg
~/FlameGraph-master/stackcollapse-perf.pl  < ./test_out.perf | ~/FlameGraph-master/flamegraph.pl --hash > ./test_out.svg
@sursir
sursir / zabbix.md
Last active February 24, 2018 05:54
zabbix zabbix-agent zabbix-server

zabbix zabbix-agent zabbix-server

zabbix server

直接使用默认配置,关键用webUI进行配置

LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
@sursir
sursir / elk-6.4.md
Last active December 25, 2018 03:49
elk elasticsearch logstash kinaba filebeat nginx basic_auth

安装yum repo 然后通过repo安装

rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

vi /etc/yum.repos.d/elasticsearch.repo

# 以下内容

[elasticsearch-6.x]
name=Elasticsearch repository for 6.x packages
@sursir
sursir / Assertions.php
Last active January 23, 2018 01:54
php preg pcre 断言
<?php
$str = '<end><p><img src="nihao"><img src="nihao2"><img src="nihao3"><img src="nihao4"></p></end>';
// 后瞻断言使用
// ==========
// 使用后瞻断言 (?<=) 匹配 nihao
$str1 = preg_replace('/((?<=<end><p>)<img src=[^>]+>)/', '', $str);
echo $str1, PHP_EOL;
@sursir
sursir / Windows下手工编译Nginx.md
Last active January 10, 2018 12:48
nginx build windows

Windows下手工编译Nginx

默认的nginx已经包含了很多通用的模块,详见:http://nginx.org/en/docs/ 但是如果需要增加一些第三方的模块的话(比如淘宝的HTTP请求合并模块:) 则需要下载nginx的源码并加入新的模块源代码一同重新编译。 下面为编译具体步骤

参考

Windows下编译Nginx超详细教程

@sursir
sursir / php-proxy.txt
Last active January 5, 2018 09:12
php proxy ssh socks5 http
// ssh 代理
$connection = ssh2_connect(ip-address-of-ssh-server, 22);
ssh2_auth_pubkey_file($connection, 'username', 'id_dsa.pub', 'id_dsa');
$tunnel = ssh2_tunnel($connection, 本地公网ID, 9999);
curl_setopt($ch, CURLOPT_PROXY, '127.0.0.1:9999');
// perform curl operations
// The connection and tunnel will die at the and of the session.
@sursir
sursir / php-strace.sh
Created December 27, 2017 01:54
php-strace
#!/bin/bash
additional_strace_args="$1"
MASTER_PID=$(ps auwx | grep php-fpm | grep -v grep | grep 'master process' | cut -d ' ' -f 6)
while read -r pid;
do
if [[ $pid != $MASTER_PID ]]; then
nohup strace -r -p "$pid" $additional_strace_args >"$pid.trc" 2>&1 &