Skip to content

Instantly share code, notes, and snippets.

View hahwul's full-sized avatar
🔥
I love coffee ☕️

HAHWUL hahwul

🔥
I love coffee ☕️
View GitHub Profile
@hahwul
hahwul / getParameter.js
Created December 30, 2020 02:30
Get vaule of parameter from URL
function getParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
@hahwul
hahwul / parseJwt.js
Created December 30, 2020 02:34
Parsing JWT
function parseJwt (token) {
var base64Url = token.split('.')[1];
var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
var jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
return JSON.parse(jsonPayload);
};
@hahwul
hahwul / md_to_html.js
Last active December 30, 2020 04:08
Markdown to HTML
// included this js
// <script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"></script>
function md_to_html(text) {
var converter = new showdown.Converter(),
html = converter.makeHtml(text);
return html
}
@hahwul
hahwul / darkmode.js
Created December 30, 2020 04:10
Darkmode with js
// Included this js
// <script src="https://cdn.jsdelivr.net/npm/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script>
const options = {
bottom: '64px', // default: '32px'
right: 'unset', // default: '32px'
left: '32px', // default: 'unset'
time: '0.5s', // default: '0.3s'
mixColor: '#fff', // default: '#fff'
backgroundColor: '#fff', // default: '#fff'
@hahwul
hahwul / css-tooltip.css
Last active January 18, 2021 06:59
Tooltip using pure css
[data-tooltip-text]:hover {
position: relative;
}
[data-tooltip-text]:after {
-webkit-transition: bottom .3s ease-in-out, opacity .3s ease-in-out;
-moz-transition: bottom .3s ease-in-out, opacity .3s ease-in-out;
transition: bottom .3s ease-in-out, opacity .3s ease-in-out;
background-color: rgba(0, 0, 0, 0.8);
@hahwul
hahwul / server.go
Created January 22, 2021 18:49
Go simple web server using echo
package main
import (
"net/http"
"github.com/labstack/echo/v4/middleware"
"github.com/labstack/echo/v4"
"github.com/tylerb/graceful"
)
@hahwul
hahwul / token.go
Created January 22, 2021 18:50
Go generate token(SHA256)
func MakeToken(url string) string {
now := time.Now()
nanos := now.UnixNano()
sum := sha256.Sum256([]byte(strconv.FormatInt(nanos,10)+url))
data := fmt.Sprintf("%x",string(sum[:]))
return data
}
@hahwul
hahwul / show-all-relative-path.sh
Created February 5, 2021 07:44
Show files and directories with relative path in directory
tree -f | cut -d "." -f 2-99 | sort -u | tee paths
@hahwul
hahwul / enum-ciphersuite.sh
Last active February 23, 2021 15:55
Emun cipher suite of website (only use openssl)
SERVER=$1
DELAY=1
ciphers=$(openssl ciphers 'ALL:eNULL' | sed -e 's/:/ /g')
echo Enum cipher list from $(openssl version).
echo "========================"
for cipher in ${ciphers[@]}
do
result=$(echo -n | openssl s_client -cipher "$cipher" -connect $SERVER 2>&1)
@hahwul
hahwul / xss-vuln-web-v2.go
Last active March 7, 2021 16:44
Vuln web for path based XSS testing
package main
import (
"net/http"
"time"
"net/url"
"github.com/labstack/echo"
"github.com/tylerb/graceful"
)