Skip to content

Instantly share code, notes, and snippets.

View CyberLight's full-sized avatar
🎓
in training

Aleksandr Vishniakov CyberLight

🎓
in training
View GitHub Profile
@CyberLight
CyberLight / api.py
Created July 7, 2017 04:07 — forked from alanhamlett/api.py
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@CyberLight
CyberLight / ARMDebianUbuntu.md
Created June 19, 2017 15:45 — forked from Liryna/ARMDebianUbuntu.md
Emulating ARM on Debian/Ubuntu

You might want to read this to get an introduction to armel vs armhf.

If the below is too much, you can try Ubuntu-ARMv7-Qemu but note it contains non-free blobs.

Running ARM programs under linux (without starting QEMU VM!)

First, cross-compile user programs with GCC-ARM toolchain. Then install qemu-arm-static so that you can run ARM executables directly on linux

@CyberLight
CyberLight / hexdump.py
Created May 26, 2017 09:31 — forked from JonathonReinhart/hexdump.py
hexdump implementation in Python
import string
def hexdump(src, length=16, sep='.'):
DISPLAY = string.digits + string.letters + string.punctuation
FILTER = ''.join(((x if x in DISPLAY else '.') for x in map(chr, range(256))))
lines = []
for c in xrange(0, len(src), length):
chars = src[c:c+length]
hex = ' '.join(["%02x" % ord(x) for x in chars])
if len(hex) > 24:
@CyberLight
CyberLight / jest-webpack-preprocessor.js
Created April 23, 2017 08:18 — forked from okonet/jest-webpack-preprocessor.js
Test webpack-shimmed and aliased modules with Jest
/* eslint-env node */
const path = require('path');
const webpack = require('webpack');
const MemoryFileSystem = require('memory-fs');
const EnhancedResolve = require('enhanced-resolve');
const transform = require('transform-jest-deps');
const babel = require('babel-jest');
const createConfig = require('../build/utils/createWebpackConfig');
@CyberLight
CyberLight / headless.md
Created April 17, 2017 09:25 — forked from addyosmani/headless.md
So, you want to run Chrome headless.

Update

If you're looking at this in 2016 and beyond, I strongly recommend investigating real headless Chrome: https://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md

Windows and Mac users might find using Justin Ribeiro's Docker setup useful here while full support for these platforms is being worked out.

You can use chrome --headless on Linux as of M57 but note you'll need to build the binaries yourself for now.

The metabug for adding headless mode to Chromium is over here.

@CyberLight
CyberLight / commands.sh
Created April 16, 2017 10:58 — forked from williballenthin/commands.sh
Install IDA Pro under Wine in Docker
# build wine Docker image
pushd wine; docker build -t wine .; popd
# build x11 Docker image for IDA
pushd ida; docker build -t wine/ida .; popd
# demonstrate x11 forwarding works
docker run -ti --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix wine/ida xclock
# interactive shell in container
@CyberLight
CyberLight / speech2text.py
Created April 9, 2017 16:06 — forked from baali/speech2text.py
A Python script to break audio into chunks of smaller audios and using Google API to get Speech to Text.
'''
A hack based on this http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/. While with smaller voice samples google speech to text works really good, as length increases quality decreases. So here using audiolab and numPy we are breaking audio sample, in smaller chunks, and removing blank/empty spaces from audio signal and then pushing them to google for processing.
It takes wav file format as input but can be changed to other formats too.
'''
from scikits.audiolab import wavread, play, flacwrite
from numpy import average, array, hstack
import os
import sys
@CyberLight
CyberLight / decode_starblind.js
Created April 3, 2017 15:38
Starblind (Reverse Engineering, 200) (70 solvers) https://ctf.dragonsector.pl/?challenges
Math.sgn = function(a) { return 1/a<0; };
var DecodeCalcSHA4 = function() {
let r = new Uint8Array(64);
let d = "983bb35ed0a800fcc85d12806df9225364713be578ba67f65bc508b77f0c54878eda18a5eed50bac705bdc7db205623221e8ffe330483955a22216960754a122".match(/.{1,2}/g)
let xor = function (imm) {
for (let i = 0; i < 64; i++) {
r[i] ^= imm[i];
}
@CyberLight
CyberLight / test-dlsym.c
Created April 3, 2017 11:01 — forked from bindle/test-dlsym.c
simple example of dlsym()
/*
* Quick example to test dlsym()
* build: gcc -W -Wall -Werror -o test-dlsym test-dlsym.c
* Usage: ./test-dlsym openldap
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dlfcn.h>
@CyberLight
CyberLight / cli.md
Created March 26, 2017 04:16 — forked from phrawzty/2serv.py
simple http server to dump request headers
$ curl -s -H "X-Something: yeah" localhost:8000 > /dev/null
$ python serv.py
ERROR:root:User-Agent: curl/7.37.1
Host: localhost:8000
Accept: */*
X-Something: yeah