Skip to content

Instantly share code, notes, and snippets.

@kerasking
kerasking / upwned247.php
Created April 15, 2017 14:05 — forked from Wack0/upwned247.php
UCam247/Phylink/Titathink/YCam/Anbash/Trivision/Netvision/others IoT webcams : remote code exec: reverse shell PoC. (works only in qemu usermode)
<?php
/*
Updated version, 2016-12-02: fixed shellcode so it *actually* works on QEMU
usermode emulation (seems I pushed an old version), and removed debug output.
-------------------------
NB: THIS PoC ONLY WORKS IN QEMU USERMODE EMULATION!
If anyone wants to fix this, go ahead (no pun intended).
However, I don't have a vulnerable product and am unwilling to acquire one.
@kerasking
kerasking / imgcompare.py
Created June 21, 2016 02:55 — forked from hfeeki/imgcompare.py
利用opencv做图片相似度比较
# coding: utf8
'''
对于图片相似度比较有很多方法,我们这以RGB直方图为例。
我们以一种规则,使得每个图片生成一组描述的特征向量。
opencv的直方图比较函数我们可以巧妙的利用,其有若干比较规则,但只支持直方图的数据结构,我们可以将特征向量拟合成直方图的数据结构,然后使用其的相似度比较函数。
具体的数学计算方法有兴趣的可以看opencv的官方教程,这里我们期望生成百分比形式的相似度参数,所以使用CV_COMP_CORREL
以下是代码,以python编写
'''
import cv2.cv as cv
@kerasking
kerasking / ufw.md
Created February 18, 2016 08:56 — forked from kimus/ufw.md
NAT and FORWARD with Ubuntu’s ufw firewall

UFW

I use Ubuntu’s Uncomplicated firewall because it is available on Ubuntu and it's very simple.

Install UFW

if ufw is not installed by default be sure to install it first.

/*
* define file about portable socket class.
* description:this sock is suit both windows and linux
* design:odison
* e-mail:odison@126.com>
*
*/
#ifndef _ODSOCKET_H_
#define _ODSOCKET_H_
#ifndef __CSocket__
#define __CSocket__
#if CC_TARGET_PLATFORM==CC_PLATFORM_WIN32
#include <winsock.h>
#elif CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
local skynet = require "skynet"
local socket = require "socket"
local mode = ...
if mode == "agent" then
skynet.start(function()
skynet.dispatch("lua", function(_,_,id)
socket.start(id)
#include "lua.h"
#include "lauxlib.h"
#include <stdio.h>
int
dylib_add(lua_State* L) {
int a = lua_tonumber(L,1);
int b = lua_tonumber(L,2);
int c = a+b;
local skynet = require "skynet"
local mongo = require "mongo"
skynet.start(function()
local db = mongo.client { host = "127.0.0.1" , username = "user", password = "pass" }
local r = db:runCommand "listDatabases"
for k,v in ipairs(r.databases) do
print(v.name)
end
--langdef=MYLUA
--langmap=MYLUA:.lua
--regex-MYLUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+):([a-zA-Z0-9_]+).*$/\2/f/
--regex-MYLUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+).*$/\2/f/
--regex-MYLUA=/^.*\s*function[ \t]*([a-zA-Z0-9_]+)\s*\(.*$/\1/f/
--regex-MYLUA=/^[ \t]*([a-zA-Z0-9_]+)[ \t]*=.*$/\1/e/
--regex-MYLUA=/^[ \t]*module[ \t\(]*\"([a-zA-Z0-9_]+)\".*$/\1/m,module/
ctags lua 规则增强,将以上部分保存至目录:
--[[ config
root = "./"
listen = "127.0.0.1:8786"
redisaddr = "127.0.0.1:6379[1]"
dbfile = root .. "backup.db"
thread = 4
logger = nil
harbor = 1