idek whats in here, there might even be some password idk

This commit is contained in:
2024-08-06 22:23:56 +05:00
parent 44d2ac2019
commit 8b24c9f318
6 changed files with 197 additions and 12 deletions

48
scripts/get-http Executable file
View File

@@ -0,0 +1,48 @@
#!/bin/bash
# Usage check
if [ $# -ne 1 ]; then
echo "Usage: $0 <URL>"
exit 1
fi
# Extract the protocol, hostname, port, and path from the URL
url=$1
protocol="${url%%://*}"
host_port="${url#*://}"
host="${host_port%%/*}"
path="/${host_port#*/}"
port=80
# Check if the protocol is HTTP
if [ "$protocol" != "http" ]; then
echo "Only HTTP protocol is supported."
exit 1
fi
# Check if a port is specified
if [[ $host == *:* ]]; then
IFS=':' read -ra ADDR <<< "$host"
host=${ADDR[0]}
port=${ADDR[1]}
fi
# Open connection to the host
exec 3<>/dev/tcp/$host/$port
# Send HTTP GET request
echo -e "GET $path HTTP/1.1\r\nHost: $host\r\nConnection: close\r\n\r\n" >&3
# Read the response and output the file content
{
# Skip HTTP headers
while IFS= read -r line; do
[[ $line == $'\r' ]] && break
done
# Output the body (file content)
cat >&1
} <&3
# Close the connection
exec 3<&-

27
scripts/i3lock-finger Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# Ensure the directory for failed fingerprint images exists
mkdir -p ~/pictures/failed_finger
# Lock the screen with all passed arguments
i3lock "$@" &
while true; do
# Run the fingerprint verification and redirect output to /dev/null
fprintd-verify &> /dev/null
# Capture the exit code
exit_code=$?
# Check the exit code
if [ $exit_code -eq 0 ]; then
pkill i3lock
exit 0
elif [ $exit_code -eq 1 ]; then
timestamp=$(date "+%Y%m%d_%H%M%S")
timestamp_human=$(date -d "${timestamp:0:8} ${timestamp:9:2}:${timestamp:11:2}:${timestamp:13:2}" "+%Y-%h-%d %H:%M:%S")
ffmpeg -f video4linux2 -s 1280x720 -i /dev/video0 -frames:v 1 ~/pictures/failed_finger/$timestamp.png
kdeconnect-cli --device $(kdeconnect-cli -a --id-only) --ping-msg "Failed to unlock at $timestamp_human"
fi
done

72
scripts/netscan Executable file
View File

@@ -0,0 +1,72 @@
#!/bin/bash
# Check if an interface name is provided
if [ -z "$1" ]; then
echo "Usage: $0 <network-interface>"
exit 1
fi
INTERFACE=$1
# Get the IP subnet for the provided network interface
IP_SUBNET=$(ip route show dev "$INTERFACE" | grep -v default | awk '{print $1}')
# Check if the IP information was found
if [ -z "$IP_SUBNET" ]; then
echo "No IP address found for interface $INTERFACE."
exit 1
fi
# Scan the subnet using nmap, running as root
echo "Scanning the subnet $IP_SUBNET..."
OUTPUT=$(sudo nmap -sP "$IP_SUBNET")
# Parse the nmap output and present it in a table
#echo "$OUTPUT" | awk '/Nmap scan report for/{
# if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
# else if ($6 ~ /^\(/) { name=$5; ip=$6; }
# else { name="Unknown"; ip=$5; }
#
# ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
#
# getline; getline; mac=$3; brand="";
#
# # Capture the entire remainder as brand, remove parentheses
# for (i=4; i<=NF; i++) brand = brand $i " ";
# brand=gensub(/^\(|\)$/, "", "g", brand); # Clean brand formatting
# print name, ip, mac, brand
#}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n-----------------------------------------------------------------"} {print}'
# Parse the nmap output and present it in a table
echo "$OUTPUT" | awk '/Nmap scan report for/{
if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
else if ($6 ~ /^\(/) { name=$5; ip=$6; }
else { name="Unknown"; ip=$5; }
ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
getline; getline; mac=$3; brand=$4; # Skip status line and move to MAC and Brand
gsub(/\(|\)/, "", brand); # Clean brand formatting
print name, ip, mac, brand
}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n-----------------------------------------------------------------"} {print}'
## Parse the nmap output and present it in a table
#echo "$OUTPUT" | awk '/Nmap scan report for/{
# if ($5 ~ /^\(/) { ip=$5; name="Unknown"; }
# else if ($6 ~ /^\(/) { name=$5; ip=$6; }
# else { name="Unknown"; ip=$5; }
#
# ip=gensub(/\(|\)/, "", "g", ip); # Remove parentheses from IP
#
# getline; getline; mac=$3; brand="";
#
# # Capture the entire remainder as brand
# if ($(NF-1) ~ /^\(/) { # Check if the second last field starts with (
# for (i=4; i<=NF; i++) brand = brand $i " ";
# sub(/\s+$/, "", brand); # Trim trailing space
# brand=gensub(/\((.*)\)/, "\\1", "g", brand); # Remove outer parentheses
# }
# print name, ip, mac, brand
#}' | column -t -s ' ' -o ' | ' | awk 'BEGIN {print "Name | IP Address | MAC Address | Brand\n--------------------------------------------------------------------------------"} {print}'

BIN
scripts/output.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB