Skip to content

Enhance CyberCafe infrastructure and testing#43

Merged
Daniel-Lopez246 merged 1 commit into
Feature/Utility-Library-(ASU-CIDSE-2025-Fall)from
fix/ci-pipeline
Mar 26, 2026
Merged

Enhance CyberCafe infrastructure and testing#43
Daniel-Lopez246 merged 1 commit into
Feature/Utility-Library-(ASU-CIDSE-2025-Fall)from
fix/ci-pipeline

Conversation

@Daniel-Lopez246

Copy link
Copy Markdown
Collaborator

Integrate John's prototype work, improve session management, and enhance logging and error handling. Implement automated tests for critical functions, ensuring better reliability and maintainability of the CyberCafe system.

@Daniel-Lopez246 Daniel-Lopez246 merged commit 9ad59ad into Feature/Utility-Library-(ASU-CIDSE-2025-Fall) Mar 26, 2026
1 check passed

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request fixes a variable reference in a database query, updates iptables destination formatting for consistency, and introduces eval for command execution in the setup script. Feedback highlights a redundant database query that could be removed for efficiency and suggests simplifying run_cmd calls by removing redundant error handling and redirections already managed by the function.

#Necessary data from internet_session row
{
RESPONSE=$(sqlite3 "${DATABASE_PATH}" "SELECT * FROM internet_sessions WHERE table_index=${I}") > /dev/null 2>> error.log
RESPONSE=$(sqlite3 "${DATABASE_PATH}" "SELECT * FROM internet_sessions WHERE table_index=${1}") > /dev/null 2>> error.log

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change correctly fixes the variable from ${I} to ${1}, this database query is redundant. The RESPONSE variable is already populated with the same data from the query on line 117. This second query can be removed to improve efficiency.


# also attempt to delete the specific rules added by John's setup (tcp redirect & FORWARD DROP) if present
run_cmd "iptables -t nat -D PREROUTING -p tcp -i '${HS_INTERFACE}' -j DNAT --to-destination '${LOCAL_IP}':80 > /dev/null 2>> error.log || true"
run_cmd "iptables -t nat -D PREROUTING -p tcp -i '${HS_INTERFACE}' -j DNAT --to-destination '${LOCAL_IP}:80' > /dev/null 2>> error.log || true"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The run_cmd function already handles redirecting stderr to error.log and suppressing command failures with || true. Including > /dev/null 2>> error.log || true inside the string passed to run_cmd is redundant and makes the command harder to read. The call should be simplified to only pass the core command.

Suggested change
run_cmd "iptables -t nat -D PREROUTING -p tcp -i '${HS_INTERFACE}' -j DNAT --to-destination '${LOCAL_IP}:80' > /dev/null 2>> error.log || true"
run_cmd "iptables -t nat -D PREROUTING -p tcp -i '${HS_INTERFACE}' -j DNAT --to-destination '${LOCAL_IP}:80' > /dev/null"

@Daniel-Lopez246 Daniel-Lopez246 deleted the fix/ci-pipeline branch April 18, 2026 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant