Skip to content

Commit 55c5d9a

Browse files
Update 1.5.0
1 parent d996de6 commit 55c5d9a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+4488
-434
lines changed

CODE/APIGen.py

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
import os
2+
import tkinter as tk
3+
from tkinter import messagebox
4+
5+
6+
def submit_api_key():
7+
"""
8+
Submit the API key entered by the user and save it to the SYSTEM/API-IP.KEY file.
9+
"""
10+
api_key = api_key_entry.get().strip() # Get the API key entered by the user
11+
api_key_confirm = api_key_entry_confirm.get().strip() # Get the API key confirmation entered by the user
12+
13+
# Enhanced error check for empty inputs
14+
if not api_key or not api_key_confirm:
15+
messagebox.showerror(title="Error", message="Both fields must be filled out.")
16+
return
17+
18+
# Validate the API key format (example: minimum length of 32 characters)
19+
if len(api_key) < 32:
20+
messagebox.showerror(title="Error", message="API key must be at least 32 characters long.")
21+
return
22+
23+
# Double-entry validation
24+
if api_key != api_key_confirm:
25+
messagebox.showwarning(title="Warning", message="The API keys do not match. Please try again.")
26+
return
27+
28+
# Check if the API-IP.KEY file already exists and read its content
29+
if os.path.exists('SYSTEM/API-IP.KEY'):
30+
try:
31+
with open('SYSTEM/API-IP.KEY', 'r') as f:
32+
existing_key = f.read().strip()
33+
if existing_key == api_key:
34+
messagebox.showinfo(title="Info", message="The same API key is already used. No action needed.")
35+
return
36+
except Exception as e:
37+
messagebox.showerror(title="Error", message=f"Failed to read existing API key: {str(e)}")
38+
return
39+
40+
# Proceed to create/update the API-IP.KEY file with the submitted API key
41+
try:
42+
parent_dir = os.path.dirname(os.getcwd()) # Get the parent directory of the current working directory
43+
system_dir = os.path.join(parent_dir,
44+
"SYSTEM") # Join the parent directory and "SYSTEM" to get the system directory
45+
os.makedirs(system_dir, exist_ok=True) # Create the system directory if it doesn't exist
46+
47+
with open(os.path.join(system_dir, 'API-IP.KEY'), 'w') as f:
48+
f.write(api_key + "\n") # Write the API key to the API-IP.KEY file
49+
50+
messagebox.showinfo(title="Success", message="API key saved to API-IP.KEY.")
51+
except Exception as e:
52+
messagebox.showerror(title="Error", message=f"Failed to save API key: {str(e)}")
53+
54+
root.destroy()
55+
56+
57+
# Initialize the main window
58+
root = tk.Tk()
59+
root.title("VPN API Key Request")
60+
61+
# Instructions for obtaining the API key
62+
instructions = """
63+
Please visit https://vpnapi.io/dashboard to create an account and obtain your API key. Once you have your API key,
64+
please enter it below and click 'Submit'.
65+
66+
We do apologise but for IP analysis we had to use this method, we ensure you its safe, if you are still in doubt you may use this pre-generated API key {c6048787b83f44b18d4ce50e5c8869ed}
67+
68+
The KEY should not include the {} given, the key has a limit of 1000 requests a day, so its recommended to use your own API key, Thank you and we apologise for this inconvenience, to skip the API function type API-NO as your key.
69+
"""
70+
71+
# Label to display instructions
72+
instruction_label = tk.Label(root, text=instructions)
73+
instruction_label.pack(pady=20)
74+
75+
# Entry widgets for the user to input the API key
76+
api_key_entry = tk.Entry(root)
77+
api_key_entry.pack(pady=10)
78+
79+
# Entry widget for the user to re-enter the API key for double-entry validation
80+
api_key_entry_confirm = tk.Entry(root)
81+
api_key_entry_confirm.pack(pady=10)
82+
83+
# Submit button for the user to finalize the API key submission
84+
submit_button = tk.Button(root, text="Submit", command=submit_api_key)
85+
submit_button.pack(pady=10)
86+
87+
# Start the application
88+
root.mainloop()

CODE/API_IP_Scraper.py

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
import requests
2+
import os
3+
import colorlog
4+
5+
# Configure colorlog for logging messages with colors
6+
logger = colorlog.getLogger()
7+
logger.setLevel(colorlog.INFO) # Set the log level to INFO to capture all relevant logs
8+
9+
handler = colorlog.StreamHandler()
10+
formatter = colorlog.ColoredFormatter(
11+
"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
12+
datefmt=None,
13+
reset=True,
14+
log_colors={
15+
'DEBUG': 'cyan',
16+
'INFO': 'green',
17+
'WARNING': 'yellow',
18+
'ERROR': 'red',
19+
'CRITICAL': 'red,bg_white',
20+
}
21+
)
22+
handler.setFormatter(formatter)
23+
logger.addHandler(handler)
24+
25+
26+
def get_public_ip():
27+
"""
28+
Fetches the public IP address using the ipify API.
29+
30+
Returns:
31+
str: Public IP address as a string.
32+
None: If there's an error fetching the IP.
33+
"""
34+
try:
35+
response = requests.get('https://api.ipify.org?format=json')
36+
response.raise_for_status() # Raises an HTTPError if the response was unsuccessful
37+
return response.json()['ip']
38+
except requests.exceptions.RequestException as e:
39+
logger.error(f"Error fetching public IP: {e}")
40+
return None
41+
42+
43+
def save_to_file(filename, content):
44+
"""
45+
saves the provided content to a file.
46+
47+
Args:
48+
filename (str): Name of the file to save to.
49+
content (str): Content to write to the file.
50+
51+
Raises:
52+
IOError: If there's an issue writing to the file.
53+
"""
54+
try:
55+
with open(filename, 'w') as file:
56+
file.write(content)
57+
except IOError as e:
58+
logger.error(f"Error writing to file: {e}")
59+
60+
61+
def main():
62+
"""
63+
Main function to fetch and save public IP information using the VPNAPI service.
64+
"""
65+
66+
# Get the script directory and parent directory
67+
script_dir = os.path.dirname(os.path.realpath(__file__))
68+
parent_dir = os.path.join(script_dir, '..')
69+
70+
# Construct the path to the API key file
71+
api_key_file_path = os.path.join(parent_dir, 'SYSTEM', 'API-IP.KEY')
72+
73+
# Check if the API key file exists before proceeding
74+
if not os.path.exists(api_key_file_path):
75+
logger.error("Exiting: The API-IP.KEY file does not exist.")
76+
return
77+
78+
# Read the API key from the file
79+
with open(api_key_file_path, 'r') as file:
80+
api_key = file.read().strip()
81+
if api_key == "API-NO":
82+
exit()
83+
84+
# Attempt to fetch the public IP
85+
public_ip = get_public_ip()
86+
if not public_ip:
87+
logger.error("Exiting: Could not fetch your public IP address.")
88+
return
89+
90+
# Construct the URL for the request
91+
url = f'https://vpnapi.io/api/{public_ip}?key={api_key}'
92+
93+
# Make the request to the VPNAPI service
94+
try:
95+
response = requests.get(url)
96+
response.raise_for_status() # Raises an HTTPError if the response was unsuccessful
97+
except requests.exceptions.HTTPError as e:
98+
logger.error(f"Exiting: Failed to retrieve data from VPNAPI. Error: {e}")
99+
return
100+
101+
# Parse the JSON response
102+
data = response.json()
103+
104+
# Format the output string
105+
output = (
106+
f"Country: {data['location']['country']}\n"
107+
f"City: {data['location']['city']}\n"
108+
f"ISP: {data['network']['autonomous_system_organization']}\n"
109+
f"Organization: {data['network']['autonomous_system_organization']}\n\n"
110+
f"VPN Used: {'Yes' if data['security']['vpn'] else 'No'}\n"
111+
f"Proxy Used: {'Yes' if data['security']['proxy'] else 'No'}\n"
112+
f"Tor Used: {'Yes' if data['security']['tor'] else 'No'}\n"
113+
)
114+
115+
# Save the formatted output to a file
116+
save_to_file('API_Output.txt', output)
117+
logger.info("Operation completed successfully.")
118+
119+
120+
if __name__ == "__main__":
121+
main()

CODE/Backup.py

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import shutil
2+
import os
3+
import colorlog
4+
from datetime import datetime
5+
6+
# Configure colorlog
7+
logger = colorlog.getLogger()
8+
logger.setLevel(colorlog.DEBUG) # Set the log level
9+
handler = colorlog.StreamHandler()
10+
formatter = colorlog.ColoredFormatter(
11+
"%(log_color)s%(levelname)-8s%(reset)s %(blue)s%(message)s",
12+
datefmt=None,
13+
reset=True,
14+
log_colors={
15+
'DEBUG': 'cyan',
16+
'INFO': 'green',
17+
'WARNING': 'yellow',
18+
'ERROR': 'red',
19+
'CRITICAL': 'red,bg_white',
20+
}
21+
)
22+
handler.setFormatter(formatter)
23+
logger.addHandler(handler)
24+
25+
26+
def filter_zip_files(names):
27+
"""
28+
Function to filter out zip files from being included in the backup.
29+
30+
:param names: List of filenames in the source directory.
31+
:return: List of filenames to exclude (zip files).
32+
"""
33+
try:
34+
return [name for name in names if name.endswith('.zip')]
35+
except Exception as e:
36+
logger.error(f"Error filtering zip files: {e}")
37+
raise
38+
39+
40+
def create_backup():
41+
"""
42+
Function to create a backup of the CODE directory in the BACKUP directory.
43+
"""
44+
try:
45+
# Get the absolute path of the parent directory
46+
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
47+
48+
# Define the source directory (CODE) and the destination directory (BACKUP) in the parent directory
49+
source_dir = os.path.join(parent_dir, 'CODE')
50+
backup_dir = os.path.join(parent_dir, 'BACKUP')
51+
52+
# Check if the source directory exists
53+
if not os.path.exists(source_dir):
54+
logger.error(f"Source directory does not exist: {source_dir}")
55+
raise FileNotFoundError(f"Source directory does not exist: {source_dir}")
56+
57+
# Create the BACKUP directory if it doesn't already exist
58+
if not os.path.exists(backup_dir):
59+
os.makedirs(backup_dir)
60+
logger.info(f"Created backup directory: {backup_dir}")
61+
62+
# Get the current date and time as a string
63+
current_datetime_str = datetime.now().strftime('%d-%m-%Y')
64+
65+
# Create the zip file name with the current date and time
66+
zip_name = f'{current_datetime_str}_backup'
67+
68+
# Define the path for the zip file
69+
zip_file_path = os.path.join(backup_dir, zip_name)
70+
71+
# Use shutil.make_archive to create a zip file of the CODE directory, ignoring zip files
72+
shutil.make_archive(base_name=os.path.join(backup_dir, zip_name), format='zip', root_dir=source_dir)
73+
74+
logger.info(f"Backup created at {zip_file_path}.zip")
75+
except Exception as e:
76+
logger.error(f"An unexpected error occurred: {e}")
77+
78+
79+
create_backup()

CODE/Browser_Policy_Miner.ps1

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Define the list of source paths with placeholders
2+
$sourcePaths = @(
3+
"C:\Users\{}\AppData\Local\Microsoft\Edge\User Data\Default\Network",
4+
"C:\Users\{}\AppData\Local\Google\Chrome\User Data\Default\Network",
5+
"C:\Users\{}\AppData\Roaming\Mozilla\Firefox\Profiles",
6+
"C:\Users\{}\AppData\Roaming\Opera Software\Opera Stable\Network",
7+
"C:\Users\{}\AppData\Roaming\Opera Software\Opera GX Stable\Network",
8+
'C:\\WINDOWS\\system32\\config\\SAM',
9+
'C:\\Windows\\System32\\config',
10+
'C:\\Windows\\System32\\GroupPolicy',
11+
'C:\\Windows\\System32\\GroupPolicyUsers',
12+
'C:\\Windows\\System32\\winevt\\Logs'
13+
)
14+
15+
# Define the list of identifiers for renaming
16+
$identifiers = @(
17+
"Edge",
18+
"Chrome",
19+
"Firefox",
20+
"OperaStable",
21+
"OperaGXStable",
22+
"SAM",
23+
"SystemConfig",
24+
"GroupPolicy",
25+
"GroupPolicyUsers",
26+
"WindowsEventLogs"
27+
)
28+
29+
# Get the current user's name
30+
$currentUser = $env:USERNAME
31+
32+
# Define the base directory for the destination
33+
$baseDirectory = "DATA"
34+
35+
# Function to check if a path exists and is accessible
36+
function Test-PathAndAccess($path) {
37+
return Test-Path $path -PathType Container -ErrorAction SilentlyContinue
38+
}
39+
40+
# Loop through each source path
41+
foreach ($sourcePath in $sourcePaths) {
42+
# Replace the placeholder with the current user's name
43+
$fullSourcePath = $sourcePath -replace '\{\}', $currentUser
44+
45+
# Enhanced error checking for source path existence and accessibility
46+
if (-not (Test-PathAndAccess $fullSourcePath)) {
47+
Write-Host "WARNING: Source path $fullSourcePath does not exist or cannot be accessed."
48+
continue
49+
}
50+
51+
52+
# Extract the identifier from the source path using the corresponding index from the $identifiers array
53+
try
54+
{
55+
$index = [Array]::IndexOf($identifiers, $sourcePath.Split('\')[-1].Split('\\')[-1])
56+
$identifier = $identifiers[$index]
57+
}
58+
catch
59+
{
60+
Write-Host "WARNING: Failed to extract identifier from source path $fullSourcePath."
61+
continue
62+
}
63+
64+
65+
# Define the destination path
66+
$destinationPath = Join-Path -Path $baseDirectory -ChildPath "USER_$identifier"
67+
68+
# Enhanced error checking for destination directory existence
69+
if (-not (Test-PathAndAccess $destinationPath)) {
70+
New-Item -ItemType Directory -Path $destinationPath -Force | Out-Null
71+
}
72+
73+
# Attempt to copy the folder to the DATA directory and rename it
74+
try {
75+
Copy-Item -Path $fullSourcePath -Destination $destinationPath -Recurse -Force -ErrorAction SilentlyContinue
76+
# Print the success message to the console
77+
Write-Host "INFO: Successfully copied $fullSourcePath to $destinationPath"
78+
} catch {
79+
# Detailed error handling
80+
Write-Host "ERROR: An error occurred while copying $fullSourcePath to $destinationPath. Error: $_"
81+
}
82+
}

0 commit comments

Comments
 (0)