Skip to content

Instantly share code, notes, and snippets.

View orangeblock's full-sized avatar
🦤

Daniel Datsev orangeblock

🦤
View GitHub Profile
@orangeblock
orangeblock / renamer.py
Last active March 28, 2021 13:14
Run as `python3 renamer.py /path/to/normalize`. Renames all files and subdirectories at specified root to be UNIX-friendly and not require any quoting.
#!/usr/bin/python3
import os
import re
import sys
try:
PATH = sys.argv[1]
except IndexError:
print("Usage: %s /path/to/normalize" % sys.argv[0])
exit(0)
@orangeblock
orangeblock / portcheck.ps1
Last active March 27, 2021 15:31
Powershell script to check which hosts have a port open. You can use it without any arguments to scan local addresses [192.168.1.2 - 192.168.1.30] for port 22, or use the arguments at the top to specify various properties.
param(
[string]$HostPrefix = "192.168.1.",
[int]$Port = 22,
[int]$StartIndex = 2,
[int]$EndIndex = 30,
[int]$ConnectTimeout = 150
)
function testport ($hostname, $port, $timeout) {
$client = New-Object System.Net.Sockets.TcpClient
@orangeblock
orangeblock / dler.py
Last active December 23, 2018 16:15
Customizable concurrent URL downloader. Works with Python 2.7x and 3.x, only using core libraries. Can be ran as a command line script or used as a library. Simply pass a list of URLs to download_files. For the rest simply read the docstring or --help from the CL.
#!/usr/bin/python
import os
import sys
import csv
import time
import shutil
from multiprocessing.dummy import Pool as ThreadPool
from collections import Iterable
try:
@orangeblock
orangeblock / handler.sh
Last active May 13, 2023 16:52
GitHub webhook listener, using netcat and bash. `listen.sh` and `handler.sh` must be in the same directory. Start with `./listen.sh <port> <path-to-script> [<endpoint>]`. All files (including scripts) must be executable.
#!/bin/bash
# parse endpoint (only works for POST)
read request
url="${request#POST }"
url="${url% HTTP/*}"
# change this!!!
secret="top-secret"