Skip to content

Instantly share code, notes, and snippets.

🍺
public volatile void

Rémy F. yne

🍺
public volatile void
Block or report user

Report or block yne

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yne
yne / upnp_port.c
Created Mar 12, 2017
UPNP port forwarding managment
View upnp_port.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <fcntl.h>
#include <netinet/in.h>
#include <ctype.h>
#include "miniwget.h"
#include "miniupnpc.h"
#include "upnpcommands.h"
@yne
yne / flv_parser.c
Created Mar 5, 2017
Unfinished FLV parser
View flv_parser.c
#include <stdio.h>
#include <fcntl.h>
typedef struct{
char unsigned F;
char unsigned L;
char unsigned V;
char unsigned version;
char unsigned video:1;
char unsigned res2:1;
@yne
yne / kh_diff.c
Created Feb 13, 2017
khash diff example
View kh_diff.c
#include <inttypes.h>
#include <stdio.h>
//#include "klist.h"
#include "khash.h"
#define kh_forall(h) for(khint_t __i=kh_begin(h);__i!=kh_end(h);++__i)if(kh_exist(h,__i))
#define kh_diff(name, old, new, on_add, on_keep, on_del)\
kh_forall(new){/*find added(exist in new, not in old) and kept(exist in both) entries */\
khiter_t __j = kh_get(name, old, kh_key(new,__i));\
if((__j==kh_end(old))||(!kh_exist(old,__j))){on_add;}else{on_keep;}\
View gist:2bab1c797c120a542aca3e06d053f221
#http://d{u,e,o}01{,b}.psp.update.playstation.org/update/psp/image{,2}/{eu,us}/$date_$md5/EBOOT.PBP
6be8878f475ac5b1a499b95ab2f7d301 6.61
2011_0810 2ca64d59dcf48f45fb99b400a586b395 6.60
ccce1a0f3ba08e22c26ec5bc047a0063 6.39
d033298a1de455a5d90e06f91c6802f6 6.38
2011_0120 5a21c511c90ed765747c43a9779f7a4b 6.37
bcac2b0a4ac55378f300386391e4bb37 6.36
2010_1124 5945c21abfa5b1221adda745f9417668 6.35
2010_0729 d7ea54162d2d53c5efb46648ee12f6bc 6.31
@yne
yne / wrpcap.py
Last active Oct 22, 2016
dump packets/str into pcap (without scapy)
View wrpcap.py
def wrpcap(out_path,packets=[],magic_number=0xa1b2c3d4,version_major=2,version_minor=4,thiszone=0,timestamp=0,snaplen=0x7FFF,link_type=1):
import struct
open(out_path,'w+').write(struct.pack('<IHHiIII',magic_number,version_major,version_minor,thiszone,timestamp,snaplen,link_type)+
''.join([struct.pack('<IIII',p.time,round(p.time%1*1000000),len(str(p)),len(str(p)))+str(p) for p in packets]))
@yne
yne / json_diff.c
Created Oct 15, 2016
JSON diff with callback support
View json_diff.c
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <json-c/json.h>
#define DIFF_LIST(CB) \
CB(none)\
CB(type)\
CB(value)\
CB(attr_del)\
@yne
yne / rest.py
Created Oct 13, 2016
RESTfull Python CGI for MySQL
View rest.py
#!/usr/bin/env python
import os,re,sys,mysql.connector,json,datetime
DB_NAME='modelespace'
path=os.environ.get('PATH_INFO','')
def query(params):
return 'SHOW FULL COLUMNS FROM %(table)s'%params.groupdict();
routes=[
@yne
yne / json.c
Last active Oct 10, 2016
Smart json import/update into internal structure
View json.c
#include <json-c/json.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
typedef enum{
diff_none,
diff_type,
diff_value,
diff_removed,
@yne
yne / disect_rl.py
Last active Aug 4, 2016
Return Link Dissector (SBDM+RLE)
View disect_rl.py
#! /usr/bin/env python
#import logging
#logging.getLogger("scapy").setLevel(1)
from scapy.all import *
#http://www.etsi.org/deliver/etsi_ts/103100_103199/103179/01.01.01_60/ts_103179v010101p.pdf
class ALPDU(Packet):#4095 or 8191
fields_desc = [
@yne
yne / mk_test.sh
Last active Jul 24, 2016
Execute commands from docx
View mk_test.sh
#!/bin/bash
#./runner example.docx | bash /dev/stdin ATP_SIMPLE
XML_PATH="word/document.xml"
STYLE_CODE="HTMLPreformatted"
STYLE_BODY="Normal"
STYLE_HEAD="Heading1"
IN_FILE=""
You can’t perform that action at this time.