Skip to content

Instantly share code, notes, and snippets.

View mozhu1024's full-sized avatar
🌴
emmmmmmm

陌竹 mozhu1024

🌴
emmmmmmm
  • virzz
  • China
View GitHub Profile
@mozhu1024
mozhu1024 / change_database_table_columns_charset.sql
Created July 24, 2020 19:09
[修改MySQL字符集] 修改MySQL数据库表字段字符集 #mysql #mariadb #sql #charset
DROP PROCEDURE IF EXISTS `chanageCharSet`;
CREATE PROCEDURE `chanageCharSet`()
BEGIN
DECLARE done INT DEFAULT FALSE;
DECLARE scheamName VARCHAR(100);
DECLARE tableName VARCHAR(100);
DECLARE columnName VARCHAR(100);
DECLARE columnType VARCHAR(100);
DECLARE alertSql VARCHAR(200);
DECLARE _Cur CURSOR FOR (
@mozhu1024
mozhu1024 / go_multi_bins.Makefile
Created July 17, 2020 10:55
[Makefile] Makefile Template #make #dev #build
#!/usr/bin/env make
TARGET=./build
ARCHS=amd64 386
LDFLAGS="-s -w"
GCFLAGS="all=-trimpath=$(shell pwd)"
ASMFLAGS="all=-trimpath=$(shell pwd)"
GOPATH=$(shell go env GOPATH)
SOURCE="./cmd/"
APPNAMES=test1 test2
@mozhu1024
mozhu1024 / csrf_middleware.go
Created March 20, 2020 02:01
[CSRF Middleware in Gin] #gin #csrf #middleware
func csrfMiddleware(c *gin.Context) {
method := strings.ToUpper(c.Request.Method)
if method == "POST" || method == "PUT" || method == "DELETE" {
if _csrf, err := CSRFToken(c.GetHeader("X-Csrf-Token")); err != nil || _csrf != "csrf" {
logger.Errorln(err, _csrf)
c.AbortWithStatusJSON(http.StatusBadRequest, Resp{
Code: -1,
Msg: "CSRF Validate Error",
})
return
@mozhu1024
mozhu1024 / gfb_cmd.sh
Created November 5, 2019 09:39
[GFB-GC] Git永久删除文件和历史记录 #git #gfb #shell #cmd
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' --prune-empty --tag-name-filter cat -- --all
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
@mozhu1024
mozhu1024 / fuzz_unserialize_class.php
Created August 23, 2019 02:02
[Fuzz Unserialize Class] 模糊测试反序列化类 #php #unserialize #class #fuzz
<?php
$classes = get_declared_classes();
foreach ($classes as $class) {
$methods = get_class_methods($class);
foreach ($methods as $method) {
if (in_array($method, [
'__destruct',
'__toString',
'__wakeup',
@mozhu1024
mozhu1024 / str_or_str.php
Created August 18, 2019 14:54
[PHP 异或 shell 生成] #php #eval #shell
<?php
function gen($pl) {
$aa = "";
$bb = "";
for ($j = 0; $j < strlen($pl); $j++) {
for ($i = 0xa0; $i < 0xff; $i++) {
if (preg_match('/[\x00- 0-9A-Za-z\'"\`~_&.,|=[\x7F]+/i', chr($i)) == 0) {
$t = chr($i) ^ $pl[$j];
if (preg_match('/[\x00- 0-9A-Za-z\'"\`~_&.,|=[\x7F]+/i', $t) == 0) {
@mozhu1024
mozhu1024 / Dockerfile
Created July 8, 2019 07:43
[SecurityManageFramwork] Docker for SecurityManageFramwork #docker
FROM python:3-alpine3.9
# git clone https://gitee.com/gy071089/SecurityManageFramwork.git
# cd SecurityManageFramwork
COPY . /app/
WORKDIR /app
# TODO: django -> django==2.1.7
RUN python -m pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com -r requirements.txt
function sendData(data, tag = "t") {
if (data.length <= 0) {
return;
}
// str2hex
var val = "";
var html = "";
for (var i = 0; i < data.length; i++) {
val += data.charCodeAt(i).toString(16);
}
export LDFLAGS="-L/usr/local/opt/openssl/lib \
-L/usr/local/opt/sqlite/lib \
-L/usr/local/opt/curl-openssl/lib \
-L/usr/local/opt/webp/lib \
-L/usr/local/opt/jpeg/lib \
-L/usr/local/opt/libpng/lib \
-L/usr/local/opt/freetype/lib \
-L/usr/local/opt/gettext/lib \
-L/usr/local/opt/gmp/lib \
-L/usr/local/opt/unixodbc/lib \
export LDFLAGS="-L/usr/local/opt/openssl/lib \
-L/usr/local/opt/sqlite/lib \
-L/usr/local/opt/curl-openssl/lib \
-L/usr/local/opt/webp/lib \
-L/usr/local/opt/jpeg/lib \
-L/usr/local/opt/libpng/lib \
-L/usr/local/opt/freetype/lib \
-L/usr/local/opt/gettext/lib \
-L/usr/local/opt/gmp/lib \
-L/usr/local/opt/icu4c/lib \