diff --git a/change-checker.py b/change-checker.py new file mode 100644 index 0000000..35aa74d --- /dev/null +++ b/change-checker.py @@ -0,0 +1,42 @@ +import requests + +# Changedetection.io details +base_url = "http://change.ext.ben.io" +auth_cookie = "6abdf17c692daf27a79c9d23a63c7d96" + +# Headers for the requests +headers = { + "Cookie": f"sessionid={auth_cookie}" +} + +# Function to get system information +def get_system_info(): + url = f"{base_url}/api/v1/system/info" + print(f"Testing URL: {url}") + response = requests.get(url, headers=headers) + + if response.status_code == 200: + system_info = response.json() + print("System Information:") + print(system_info) + else: + print(f"Error getting system information: {response.status_code}") + +# Function to list watch IDs +def list_watch_ids(): + url = f"{base_url}/api/v1/watches" + print(f"Testing URL: {url}") + response = requests.get(url, headers=headers) + + if response.status_code == 200: + watches = response.json() + watch_ids = [watch['uuid'] for watch in watches] + print("Available Watch IDs:") + print(watch_ids) + else: + print(f"Error listing watch IDs: {response.status_code}") + +# Main execution +if __name__ == "__main__": + get_system_info() + list_watch_ids() \ No newline at end of file diff --git a/nord.sh b/nord.sh new file mode 100644 index 0000000..c888ddb --- /dev/null +++ b/nord.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# Variables +CREDENTIAL_FILE="nord.creds" +OVPN_DIR="ovpn_tcp" +LOG_FILE="/root/openvpn.log" +RESULT_FILE="vpnlist.txt" +OVPN_ZIP_URL="https://downloads.nordcdn.com/configs/archives/servers/ovpn.zip" + +# Get current IP before starting +CURRENT_IP=$(curl -s ifconfig.me) +echo "$(date) [Main Script]: Current IP before VPN connections: $CURRENT_IP" + +# Terminate any existing OpenVPN connections +PIDS=$(pgrep openvpn) +if [ -n "$PIDS" ]; then + kill $PIDS + echo "$(date) [Main Script]: Existing OpenVPN connections terminated." +fi + +# Download and extract OVPN configurations +if [ ! -d "$OVPN_DIR" ]; then + mkdir "$OVPN_DIR" +fi + +curl -s -L -o "$OVPN_DIR/ovpn.zip" "$OVPN_ZIP_URL" +unzip -q -o "$OVPN_DIR/ovpn.zip" -d "$OVPN_DIR" +rm "$OVPN_DIR/ovpn.zip" + +# Find all OVPN files except those starting with "us", "del", or "uk" +OVPN_FILES=$(find "$OVPN_DIR" -name "*.ovpn" ! -name "us*.ovpn" ! -name "del*.ovpn" ! -name "uk*.ovpn") + +# Get the total number of OVPN files +TOTAL_FILES=$(echo "$OVPN_FILES" | wc -l) + +# Process each OVPN file +FILE_NUM=1 +for OVPN_FILE in $OVPN_FILES; do + OVPN_FILENAME=$(basename "$OVPN_FILE") + + # Read credentials + USERNAME=$(head -n 1 "$CREDENTIAL_FILE") + PASSWORD=$(tail -n 1 "$CREDENTIAL_FILE") + + # Establish VPN connection + echo "$PASSWORD" | openvpn --config "$OVPN_FILE" --auth-user-pass "$CREDENTIAL_FILE" --daemon --log-append "$LOG_FILE" + + # Wait for connection to establish + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Waiting for VPN connection to establish..." + sleep 10 + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: VPN connection established." + + # Check external IP (with validation and retries) + EXTERNAL_IP=$(curl -s ifconfig.me) + + if ! [[ $EXTERNAL_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Invalid response from ifconfig.me, retrying with ifconfig.co" + EXTERNAL_IP=$(curl -s ifconfig.co) + + if ! [[ $EXTERNAL_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Invalid response from ifconfig.co, retrying with ipinfo.io/ip" + EXTERNAL_IP=$(curl -s ipinfo.io/ip) + + if ! [[ $EXTERNAL_IP =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Unable to get external IP. Skipping this OVPN file." + continue # Skip to the next OVPN file + fi + fi + fi + + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: External IP via VPN: $EXTERNAL_IP" + + # Append result to file + echo "$EXTERNAL_IP # $OVPN_FILENAME" >> "$RESULT_FILE" + + # Disconnect VPN + PIDS=$(pgrep openvpn) + if [ -n "$PIDS" ]; then + kill $PIDS + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: VPN disconnected." + else + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: No openvpn process found." + fi + + # Wait for a random time between 8 and 30 seconds + SLEEP_TIME=$(((RANDOM % 23) + 8)) + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Waiting for $SLEEP_TIME seconds before the next connection..." + sleep $SLEEP_TIME + echo "$(date) [$FILE_NUM/$TOTAL_FILES] [$OVPN_FILENAME]: Resuming..." + + # Increment file number + FILE_NUM=$((FILE_NUM + 1)) +done \ No newline at end of file