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 / tar_archive_with_symboliclink.py
Created October 5, 2017 11:03
A tar archive with symbolic link file
@mozhu1024
mozhu1024 / WebSocket.class.php
Last active December 24, 2017 16:08
WebSocket Class for PHP
<?php
class WS
{
var $master; // 连接 server 的 client
var $sockets = array(); // 不同状态的 socket 管理
var $handshake = false; // 判断是否握手
function __construct($address, $port)
{
@mozhu1024
mozhu1024 / WebSocket.js
Last active December 24, 2017 16:08
WebSocket for JavaScript
var ws;
function ToggleConnectionClicked() {
try {
ws = new WebSocket("ws://127.0.0.1:2000");//连接服务器
ws.onopen = function(event){alert("已经与服务器建立了连接\r\n当前连接状态:"+this.readyState);};
ws.onmessage = function(event){alert("接收到服务器发送的数据:\r\n"+event.data);};
ws.onclose = function(event){alert("已经与服务器断开连接\r\n当前连接状态:"+this.readyState);};
ws.onerror = function(event){alert("WebSocket异常!");};
} catch (ex) {
alert(ex.message);
@mozhu1024
mozhu1024 / WebSocket.vue
Last active December 24, 2017 16:06
WebSocket for Vue
<template>
<div>
</div>
</template>
<script>
export default {
data() {
return {
websock: null,
@mozhu1024
mozhu1024 / mysql_open_general_log.sql
Created January 1, 2018 14:19
mysql query open general log
set global general_log=off;
truncate table general_log;
SET GLOBAL log_output='table';
set global general_log=on;
@mozhu1024
mozhu1024 / github_webhook_nginx_luajit.lua
Created July 9, 2018 14:40
[Github Webhook with LuaJit]
local ffi = nil
local token = 'xxx'
ffi = require("ffi")
ffi.load("z")
ffi.cdef[[int system(const char * string);]]
if "POST" == ngx.var.request_method then
ngx.req.read_body()
local args, err = ngx.req.get_post_args()
@mozhu1024
mozhu1024 / hashgrep_md5.lua
Created July 15, 2018 16:11
[A Lua script for grep hash md5 with nginx] #lua #nginx
function split( str,reps )
local res = {}
string.gsub(str,'[^'..reps..']+',function ( w )
table.insert(res,w)
end)
return res
end
local hashfile = '/data/hashgrep/hash_md5.vir'
if "GET" == ngx.var.request_method then
local args, err = ngx.req.get_uri_args()
@mozhu1024
mozhu1024 / php_images_webshell_jpg.php
Created September 27, 2018 13:39
[PHP Image Webshell] A script to generate php webshell in image #php #image #img #webshell
<?php
/*
The algorithm of injecting the payload into the JPG image, which will keep unchanged after transformations
caused by PHP functions imagecopyresized() and imagecopyresampled().
It is necessary that the size and quality of the initial image are the same as those of the processed
image.
1) Upload an arbitrary image via secured files upload script
2) Save the processed image and launch:
function markdown(md){
$.ajax({
type: "POST",
url: "https://api.github.com/markdown",
contentType: "application/json",
data: JSON.stringify({
"text": md,
"mode": "gfm",
"context": "github/gollum"
}),
@mozhu1024
mozhu1024 / php_debug_example_json.php
Last active May 21, 2019 07:42
[PHP是如何解析JSON的 - 测试文件] #paper #php #json
<?php
error_reporting(E_ALL | E_STRICT);
function op($var = "", $msg = "") {
if ($msg) {
echo "\t$msg \r\n";
}
print_r($var);
echo "\r\n";