change IPs in code

This commit is contained in:
2026-03-24 15:44:50 -07:00
parent d679e422b1
commit 8ccf17d4b7
5 changed files with 14 additions and 10 deletions

View File

@ -11,6 +11,7 @@ RUN apt-get update && apt-get install -y \
nginx \
supervisor \
net-tools \
iputils-ping \
&& rm -rf /var/lib/apt/lists/*
# Copy your application code & config files

View File

@ -27,9 +27,11 @@ password_types = [
#################################################
# Hash Record Functions
#################################################
# Create the file if it doesnt exist
if not HASH_FILE.exists():
# Nothing to load create an empty file for future use
HASH_FILE.touch(exist_ok=True)
# Read the hashes
try:
with HASH_FILE.open("r", encoding="utf-8") as fh:
password_hashes = {line.strip() for line in fh if line.strip()}
@ -125,7 +127,7 @@ def get_password():
"password_types": password_types
}), 404 # 404 Not Found
# Success return the password
# Success - return the password
return jsonify({
"password": get_password_by_index(index)
}), 200
@ -151,7 +153,7 @@ def verbose_password():
"error": f"Index {index} is out of bounds (0 ≤ index < {len(password_types)})",
"password_types": password_types
}), 404 # 404 Not Found
# Success return the result
# Success - return the result
result = {
"password": get_password_by_index(index),
"descriptor": password_function_descriptor[password_types[index]],
@ -166,7 +168,7 @@ def custom_password():
payload = request.get_json()
# Basic presence check you can relax this if you want defaults
# Basic presence check - you can relax this if you want defaults
required_keys = {"w_min", "w_max", "w_count", "s_char", "num_len"}
missing = required_keys - payload.keys()
if missing:
@ -411,7 +413,7 @@ def check_and_add_hash(password: str) -> bool:
hash_value = sha256_hex(password)
if hash_value in password_hashes:
return False
# Hash was missing add it and report that it was newly inserted.
# Hash was missing - add it and report that it was newly inserted.
password_hashes.add(hash_value)
save_hashes()
return True

View File

@ -1 +1 @@
docker build -t pwdgen-v2 /opt/containers/pwdgen-v2
docker build -t pwdgen-v2 .

View File

@ -6,7 +6,8 @@ services:
image: pwdgen_v2:latest
container_name: pwd.matt-cloud.com
ports:
- "80:80"
- "8080:80"
volumes:
- ./pwdgen:/opt/pwdgen
network_mode: bridge
restart: always

View File

@ -92,7 +92,7 @@ function curlHelper($url, $APIKey){
// Password Generator API Function
function getStandardPasswordFromAPI($passType){
$apiUrl = "http://172.17.0.1:8189/get_password";
$apiUrl = "http://0.0.0.0:8189/get_password";
// Build the query string and full URL
$query = http_build_query(['pwd_index' => $passType]);
$url = rtrim($apiUrl, '?') . '?' . $query;
@ -101,7 +101,7 @@ function getStandardPasswordFromAPI($passType){
// Password Generator API Function for Custom Password
function getCustomPasswordFromAPI($passType, $payload){
$url = 'http://172.17.0.1:8189/custom_password';
$url = 'http://0.0.0.0:8189/custom_password';
// Initialise a cURL handle
$ch = curl_init($url);
@ -159,7 +159,7 @@ function getCustomPasswordFromAPI($passType, $payload){
// Password Count API Function
function getPasswordCountFromAPI(){
$apiUrl = "http://172.17.0.1:8189/get_count";
$apiUrl = "http://0.0.0.0:8189/get_count";
// Build the query string and full URL
$url = rtrim($apiUrl, '?') ;
return curlHelper($url, "total_passwords");