Skip to content

Instantly share code, notes, and snippets.

View mskf3000's full-sized avatar
💭
I may be slow to respond.

MSKF3000 mskf3000

💭
I may be slow to respond.
View GitHub Profile
@mhmdiaa
mhmdiaa / httpx-cp-responses.sh
Created April 30, 2024 21:09
Copy responses from httpx's output to their original file names
cat urls.txt | httpx -json -store-response -output httpx.json
cat httpx.json | jq -r '"\(.stored_response_path) \(.path | ltrimstr("/"))"' | xargs -n 2 sh -c 'mkdir -p "$(dirname $2)" && cp $1 $2' sh
@abbaspour
abbaspour / client.conf
Last active December 17, 2023 22:53
https with stunnel and socat
client = yes
debug = 5
foreground = yes
pid = /var/tmp/stunnel-client.pid
cert= st.pem
[Application]
accept = 1081
connect = 3000
#!/bin/bash
# usage: aws-assume-role-from-env [<command> [<args> …]]
#
# Authenticates with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY, assumes the
# role in AWS_ROLE, and modifies the environment to set AWS_ACCESS_KEY_ID,
# AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN. If <command> is specified, it
# is exec-ed with the given <args>. Otherwise, /usr/bin/env is executed.
#
# Set AWS_ROLE_SESSION_NAME to use a value other than the default
# (aws-assume-role-from-env@$time).
@s1037989
s1037989 / README.md
Last active January 9, 2024 00:37
ip-discover: Setup a device for discovery on a network using socat

ip-discover

Setup a device for discovery on a network using socat

On the device to be discovered:

  • Copy ip-discovery to /usr/bin and run chmod +x /usr/bin/ip-discovery
  • Copy ip-discovery.service to /etc/systemd/system, adjust the code-word, and run sudo systemctl daemon-reload && sudo systemctl start ip-discovery

On the device wanting to discover the device to be discovered:

  • Copy ip-discover to your home folder and run . ~/ip-discover
@qistoph
qistoph / awk_netstat.sh
Created August 6, 2020 07:55
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Based on gist https://gist.github.com/staaldraad/4c4c80800ce15b6bef1c1186eaa8da9f
# - added TCP states
awk 'BEGIN{states["01"]="TCP_ESTABLISHED"
states["02"]="TCP_SYN_SENT"
states["03"]="TCP_SYN_RECV"
states["04"]="TCP_FIN_WAIT1"
states["05"]="TCP_FIN_WAIT2"
states["06"]="TCP_TIME_WAIT"
states["07"]="TCP_CLOSE"
$ echo -n -e "\x3c\x97\x0e\x1d\x3f\x07\xf8\x32\xe4\xc0\x48\xab\x00\x02\x61\x62" | sudo socat -t 1 -lu -x -d -d -d -d - SOCKET-SENDTO:17:3:0:x0003x02000000x0000x00x06x3c970e1d3f070000
2020/06/22 04:34:56.306263 socat[762494] D getpid()
2020/06/22 04:34:56.306315 socat[762494] D getpid() -> 762494
2020/06/22 04:34:56.306322 socat[762494] D setenv("SOCAT_PID", "762494", 1)
2020/06/22 04:34:56.306329 socat[762494] D setenv() -> 0
2020/06/22 04:34:56.306332 socat[762494] D setenv("SOCAT_PPID", "762494", 1)
2020/06/22 04:34:56.306337 socat[762494] D setenv() -> 0
2020/06/22 04:34:56.306341 socat[762494] I socat by Gerhard Rieger and contributors - see www.dest-unreach.org
2020/06/22 04:34:56.306345 socat[762494] I This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit. (http://www.openssl.org/)
2020/06/22 04:34:56.306349 socat[762494] I This product includes software written by Tim Hudson ([email protected])
@tomac4t
tomac4t / ipip-bt.py
Last active April 3, 2024 12:33
IPIP Firefox Extension API
#!/usr/bin/python3
import requests
import sys
n = len(sys.argv)
for i in range (1, n):
ipipapi = "https://btapi.ipip.net/host/info?ip=" + sys.argv[i] + "&host=&lang=cn"
@johnnypea
johnnypea / useful-one-liners.sh
Last active March 30, 2025 17:21
Useful one liners
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@Gardelll
Gardelll / traceroute_location.bash
Last active September 16, 2021 13:10
Bash脚本: 根据TraceRoute获取IP地址的物理位置
#!/bin/bash
if [[ "$1" == "" ]]; then
echo "未指定域名" 1>&2
echo "$0 Domain" 1>&2
exit 1
fi
traceroute -n > /dev/null 2>&1
if [[ "$?" == "64" ]]; then
@thedroidgeek
thedroidgeek / nokia-router-cfg-tool.py
Last active April 8, 2025 00:24
Nokia/Alcatel-Lucent router backup configuration tool
#!/usr/bin/env python3
#
# Nokia/Alcatel-Lucent router backup configuration tool
#
# Features:
# - Unpack/repack .cfg files generated from the backup and restore functionnality
# in order to modify the full router configuration
# - Decrypt/encrypt the passwords/secret values present in the configuration