This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python | |
Python 2.7.3 (default, Feb 27 2014, 20:00:17) | |
[GCC 4.6.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from xortools import * | |
>>> plaintext = 'This program cannot be run in DOS mode.' | |
>>> ciphertext = xorencode(plaintext, 'AX') | |
>>> ciphertext | |
'\x150(+a(37&* 5a; 6/75x#=a*46a1/x\x05\x17\x12x,7%=o' | |
>>> find_xorkey(ciphertext, 'program', keylen=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gcc -masm=intel inlineasm.c | |
$ ./a.out | |
saved_ebp = 0 | |
saved_eip = b7e444d3 | |
argc = 1 | |
argv = bffff864 | |
envp = bffff86c | |
$ objdump -d a.out | sed -n '/<main>:/,/^$/p' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ uname -a | |
Linux vm-ubuntu64 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux | |
$ gcc test_malloc.c | |
$ ./a.out | |
[+] allocate chunks: a = malloc(32), b = malloc(256), c = malloc(32) | |
a = 0x832010, b = 0x832040, c = 0x832150 | |
*a = 41414141, *b = 42424242, *c = 45524548 | |
[+] free the mid chunk: free(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python yt2m4a.py "http://www.youtube.com/watch?v=4YMD6xELI_k" | |
--2014-04-11 02:25:26-- http://r2---sn-ogueyn7z.googlevideo.com/videoplayback?sparams=id%2Cip%2Cipbits%2Citag%2Cpcm2fr%2Cratebypass%2Csource%2Cupn%2Cexpire&ipbits=0&mt=1397150542&expire=1397173854&upn=15FckWnBsJw&fexp=927905%2C936905%2C901065%2C916623%2C945513%2C937417%2C913434%2C936916%2C934022%2C936921%2C936923&signature=A2B6A3A92CCB9F6F09EDEC21266137C2A09975DF.A94CC65958FD475F79CE18DDF05188C29591C7A0&key=yt5&ip=123.224.99.3&pcm2fr=yes&itag=22&source=youtube&sver=3&mv=u&ratebypass=yes&ms=au&id=o-ADTX4MBPHtBDylBsjOsDle1msEAsW4PTJ7EyQH0qyPo1 | |
Resolving r2---sn-ogueyn7z.googlevideo.com (r2---sn-ogueyn7z.googlevideo.com)... 74.125.171.39 | |
Connecting to r2---sn-ogueyn7z.googlevideo.com (r2---sn-ogueyn7z.googlevideo.com)|74.125.171.39|:80... connected. | |
HTTP request sent, awaiting response... 302 Found | |
Location: http://r13---sn-ogueyn7z.googlevideo.com/videoplayback?sparams=id%2Cip%2Cipbits%2Citag%2Cpcm2fr%2Cratebypass%2Csource%2Cupn%2Cexpire&ipbits=0& |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import re | |
lines = [] | |
locs = [] | |
def add_loc(s): | |
def _add_loc(m): | |
locs.append(m.group(1)) | |
return s % m.group(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ echo -n 'hello world' | python rot.py | |
hello world | |
ifmmp xpsme | |
jgnnq yqtnf | |
khoor zruog | |
lipps asvph | |
mjqqt btwqi | |
nkrru cuxrj | |
olssv dvysk | |
pmttw ewztl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget http://printkjv.ifbweb.com/AV_txt.zip | |
2014-06-09 15:30:46 (535 KB/s) - `AV_txt.zip' saved [1262589/1262589] | |
$ unzip AV_txt.zip | |
Archive: AV_txt.zip | |
inflating: AV1611Bible.txt | |
$ python ngram.py < AV1611Bible.txt | |
1 gram result: | |
414963 'e' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <numeric> | |
#include <functional> | |
using namespace std; | |
template <typename T> | |
auto cube(T x) -> decltype(x) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function asm() { | |
echo "$*" | as -msyntax=intel -mnaked-reg -aln -o /dev/null | |
} | |
function disas() { | |
echo "$*" | perl -ne 's/([0-9A-Fa-f]{2})/print pack("H2",$1)/eg' >/tmp/disasm && objdump -M intel -D -b binary -m i386 /tmp/disasm | tail -n+8 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ seq 100 | factor | awk 'NF==2{print $2}' | |
2 | |
3 | |
5 | |
7 | |
11 | |
13 | |
17 | |
19 | |
23 |