Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vivekseth
vivekseth / recover_source_code.md
Created March 12, 2017 15:58 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
var HEIGHT = 600;
var WIDTH = 600;
var body = document.body;
body.style.margin = 0;
body.style.backgroundColor = '#eee';
var canvas = document.getElementById('canvas')
canvas.style.position = 'absolute'
canvas.style.top = '50%';
@vivekseth
vivekseth / Animation 7.8.2017 #2
Created July 8, 2017 22:28
Just some circles moving up and down.
var HEIGHT = 600;
var WIDTH = 600;
var body = document.body;
body.style.margin = 0;
body.style.backgroundColor = '#eee';
var canvas = document.getElementById('canvas')
canvas.style.position = 'absolute'
canvas.style.top = '50%';
@vivekseth
vivekseth / jump_overwrite.c
Created November 23, 2017 04:52
Jump Address Hacking to Execute Code Stored as a String
#include <stdio.h>
/*
# Jump Address Hacking to Execute Code Stored as a String
Operating systems typically give each process a virtual address space ranging from 0x0000000000000000 to 0xffffffffffffffff on a 64bit machine. This memory range is divded up in muliple sections. Usually there are at least two: .DATA and .TEXT.
Memory in .DATA is read/write, but cannot be executed. Similarly, memory in .TEXT is read/exec but cannot be written to. This security measure is called "W xor X" and prevents a malicious user from injecting *new* code into a running process. This does not prevent a malicious user from manipulating a program to run code that *already exists* when it shouldn't.
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 10, 15 sdk_version 10, 15, 4
.globl _runStringAsCode ## -- Begin function runStringAsCode
.p2align 4, 0x90
_runStringAsCode: ## @runStringAsCode
.cfi_startproc
## %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
.section __TEXT,__text,regular,pure_instructions
.build_version macos, 10, 15 sdk_version 10, 15, 4
.globl _runStringAsCode ## -- Begin function runStringAsCode
.p2align 4, 0x90
_runStringAsCode: ## @runStringAsCode
.cfi_startproc
## %bb.0:
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset %rbp, -16
@vivekseth
vivekseth / top_websites
Created August 21, 2023 20:27
top_websites
This file has been truncated, but you can view the full file.
google.com
youtube.com
tmall.com
baidu.com
qq.com
sohu.com
facebook.com
taobao.com
360.cn
jd.com
@vivekseth
vivekseth / top-1000-websites.json
Created August 21, 2023 20:27 — forked from dlucian/top-1000-websites.json
Top 1000 Websites
[
{
"position": 1,
"domain": "youtube.com",
"count": 361515143,
"etv": 460411425.18914586
},
{
"position": 2,
"domain": "facebook.com",
@vivekseth
vivekseth / websites.csv
Created August 21, 2023 20:28 — forked from bejaneps/websites.csv
List of top 1000 websites
1 fonts.googleapis.com 10
2 facebook.com 10
3 twitter.com 10
4 google.com 10
5 youtube.com 10
6 s.w.org 10
7 instagram.com 10
8 googletagmanager.com 10
9 linkedin.com 10
10 ajax.googleapis.com 10