Skip to content

Instantly share code, notes, and snippets.

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

Aditya Thebe adityathebe

🏠
Working from home
View GitHub Profile
package main
import (
"fmt"
"net/http"
)
func handleNoCors(w http.ResponseWriter, req *http.Request) {
fmt.Println("Request received. Referer:", req.Header.Get("Referer"))
w.Write([]byte("Hello world!"))
@adityathebe
adityathebe / download-amass-bin.sh
Created January 16, 2021 06:26
Script to download amass binary
#!/bin/bash
tmp_dir='amass-temp-dir'
mkdir $temp_dir
cd $temp_dir
wget "https://github.com/OWASP/Amass/releases/download/v$1/amass_linux_amd64.zip"
unzip amass_linux_amd64.zip
rm amass_linux_amd64.zip
@adityathebe
adityathebe / hackerone-hacktivity-graphl.sh
Created January 14, 2021 11:34
Hackerone Hacktivity on your terminal
#/bin/bash
json=$(curl -s 'https://hackerone.com/graphql' \
-H 'authority: hackerone.com' \
-H 'accept: */*' \
-H 'x-auth-token: ----' \
-H 'user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36' \
-H 'content-type: application/json' \
-H 'sec-gpc: 1' \
-H 'origin: https://hackerone.com' \
@adityathebe
adityathebe / HS256-public-pem.go
Created December 17, 2020 07:27
Calculate HS256 with secret keys read from a file
// https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/.
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/base64"
"fmt"
"io/ioutil"
package main
import (
"fmt"
"net/http"
)
func handler(w http.ResponseWriter, r *http.Request) {
query := r.URL.Query()
name := query.Get("name")
@adityathebe
adityathebe / downloadWithAxios.js
Last active November 25, 2019 13:59
Download files with axios.js in Nodejs
/**
* @param {String} uri url of the file to download
* @param {String} filePath File Path
*/
function _downloadFile(uri, filePath) {
return new Promise((resolve, reject) => {
axios({
method: 'get',
url: uri,
responseType: 'stream',
@adityathebe
adityathebe / ssl-setup.sh
Created November 10, 2018 13:59
How to Deploy a Node.js App to DigitalOcean with SSL
# Source :: https://code.lengstorf.com/deploy-nodejs-ssl-digitalocean/
# Install tools that Let’s Encrypt requires
sudo apt-get install bc
# Clone the Let’s Encrypt repository to your server
sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
# Move into the Let’s Encrypt directory
cd /opt/letsencrypt
const fs = require('fs');
const eratosthenes = (n) => {
// Eratosthenes algorithm to find all primes under n
let array = []
let output = [];
let upperLimit = Math.sqrt(n)
// Make an array from 2 to (n - 1)
for (var i = 0; i < n; i++) {
@adityathebe
adityathebe / pixelmapper.js
Last active March 26, 2018 04:43
A function to map rgba value into better accessible pixels
/*
* A function to map rgba value into better accessible pixels
* */
// ========= Actual Pixels ( 2x2 image ) ==========
/*
let x = [
[1, 2],
[3, 4]
]
@adityathebe
adityathebe / tweeterbot.js
Last active September 15, 2017 15:54
Twitter Bot Final File
const TWIT = require('twit')
const config = require('./config');
var Twit = new TWIT(config);
function makeTweet(tweet) {
Twit.post('statuses/update', { status: tweet }, function(err, data, response) {
if(err) {
console.log(err)
} else {