aboutsummaryrefslogtreecommitdiff
path: root/databases/passwords/sql
diff options
context:
space:
mode:
authorChristian Cleberg <hello@cleberg.net>2025-04-05 13:43:01 -0500
committerGitHub <noreply@github.com>2025-04-05 13:43:01 -0500
commitbee22b97b652cd04fa470d7f31c3b917e44f3ab9 (patch)
treee1ec29a3388b94a8d41e3b28ca1f2357f3efaec7 /databases/passwords/sql
parent3041472781997ff66c5f9fa80a7f5ffbd284a438 (diff)
downloadaudit-tools-bee22b97b652cd04fa470d7f31c3b917e44f3ab9.tar.gz
audit-tools-bee22b97b652cd04fa470d7f31c3b917e44f3ab9.tar.bz2
audit-tools-bee22b97b652cd04fa470d7f31c3b917e44f3ab9.zip
migrate from pylint to ruff (#1)
* migrate from pylint to ruff * Commit from GitHub Actions (Pylint) * rename pylint.yml to ruff.yml * only run ruff-action when python files change --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'databases/passwords/sql')
-rw-r--r--databases/passwords/sql/test.py53
1 files changed, 28 insertions, 25 deletions
diff --git a/databases/passwords/sql/test.py b/databases/passwords/sql/test.py
index bfacb20..81c1138 100644
--- a/databases/passwords/sql/test.py
+++ b/databases/passwords/sql/test.py
@@ -6,7 +6,8 @@ Checks SQL Server user data for compliance with Windows policies.
import pandas as pd
# Load the data into a pandas DataFrame
-df_input = pd.read_csv('./data.csv')
+df_input = pd.read_csv("./data.csv")
+
# Function to apply rules and generate report
def apply_rules_and_report(df):
@@ -22,45 +23,46 @@ def apply_rules_and_report(df):
report = []
for _, row in df.iterrows():
result = {
- 'Name': row['name'],
- 'Type Check': '',
- 'Policy Check': '',
- 'Expiration Check': '',
- 'Reason': ''
+ "Name": row["name"],
+ "Type Check": "",
+ "Policy Check": "",
+ "Expiration Check": "",
+ "Reason": "",
}
# Check the type_desc
- if row['type_desc'] == 'SQL_LOGIN':
- result['Type Check'] = 'SQL_LOGIN'
- elif row['type_desc'] == 'WINDOWS_LOGIN':
- result['Type Check'] = 'N/A'
- result['Reason'] = 'Refer to Windows password policy.'
+ if row["type_desc"] == "SQL_LOGIN":
+ result["Type Check"] = "SQL_LOGIN"
+ elif row["type_desc"] == "WINDOWS_LOGIN":
+ result["Type Check"] = "N/A"
+ result["Reason"] = "Refer to Windows password policy."
else:
- result['Type Check'] = 'Manual Review'
- result['Reason'] = 'Reviewer to manually review.'
+ result["Type Check"] = "Manual Review"
+ result["Reason"] = "Reviewer to manually review."
# Check if password policy is enforced
- if row['is_policy_checked'] == 1:
- result['Policy Check'] = 'PASS'
- result['Reason'] += '''Password policy is enforced. Reviewer to
- check the assigned policy.'''
+ if row["is_policy_checked"] == 1:
+ result["Policy Check"] = "PASS"
+ result["Reason"] += """Password policy is enforced. Reviewer to
+ check the assigned policy."""
else:
- result['Policy Check'] = 'FAIL'
- result['Reason'] += 'Password policy is not enforced.'
+ result["Policy Check"] = "FAIL"
+ result["Reason"] += "Password policy is not enforced."
# Check if password expiration is enforced
- if row['is_expiration_checked'] == 1:
- result['Expiration Check'] = 'PASS'
- result['Reason'] += '''Password expiration is enforced. Reviewer to
- check the expiration policy.'''
+ if row["is_expiration_checked"] == 1:
+ result["Expiration Check"] = "PASS"
+ result["Reason"] += """Password expiration is enforced. Reviewer to
+ check the expiration policy."""
else:
- result['Expiration Check'] = 'FAIL'
- result['Reason'] += 'Password expiration is not enforced.'
+ result["Expiration Check"] = "FAIL"
+ result["Reason"] += "Password expiration is not enforced."
report.append(result)
return report
+
# Main function to run the script
def main():
"""
@@ -73,5 +75,6 @@ def main():
# Print the report
print(report_df)
+
if __name__ == "__main__":
main()