rcf-cli 1.2.6__tar.gz → 1.2.8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rcf-cli
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: A command-line tool for RCF protocol compliance verification.
5
5
  Author-email: Aladdin Aliyev <aladdin@aliyev.site>
6
6
  License: RCF-PL 1.1.1
@@ -31,6 +31,7 @@ pip install rcf-cli
31
31
  - **Automated Scanning**: Quickly scan projects for RCF compliance and extract markers.
32
32
  - **Header Validation**: Ensure files have the required `NOTICE: This file is protected under RCF-PL v1.1` header.
33
33
  - **RCF-Audit (Premium)**: Generate cryptographically signed compliance reports for enterprise auditing.
34
+ - **Integrity Verification**: Compare current file hashes against an audit report to detect unauthorized modifications or tampering.
34
35
 
35
36
 
36
37
  ## CLI Usage
@@ -65,6 +66,17 @@ rcf-cli audit . --license-key RCF-AUDIT-XXXX-XXXX
65
66
  export RCF_LICENSE_KEY=RCF-AUDIT-XXXX-XXXX
66
67
  rcf-cli audit .
67
68
  ```
69
+
70
+ ### 4. Verify Project Integrity
71
+
72
+ Compare current files with the latest audit report:
73
+
74
+ ```bash
75
+ rcf-cli verify .
76
+
77
+ # Show summary only
78
+ rcf-cli verify . --summary
79
+ ```
68
80
  ```
69
81
 
70
82
  ## Markers Reference
@@ -18,6 +18,7 @@ pip install rcf-cli
18
18
  - **Automated Scanning**: Quickly scan projects for RCF compliance and extract markers.
19
19
  - **Header Validation**: Ensure files have the required `NOTICE: This file is protected under RCF-PL v1.1` header.
20
20
  - **RCF-Audit (Premium)**: Generate cryptographically signed compliance reports for enterprise auditing.
21
+ - **Integrity Verification**: Compare current file hashes against an audit report to detect unauthorized modifications or tampering.
21
22
 
22
23
 
23
24
  ## CLI Usage
@@ -52,6 +53,17 @@ rcf-cli audit . --license-key RCF-AUDIT-XXXX-XXXX
52
53
  export RCF_LICENSE_KEY=RCF-AUDIT-XXXX-XXXX
53
54
  rcf-cli audit .
54
55
  ```
56
+
57
+ ### 4. Verify Project Integrity
58
+
59
+ Compare current files with the latest audit report:
60
+
61
+ ```bash
62
+ rcf-cli verify .
63
+
64
+ # Show summary only
65
+ rcf-cli verify . --summary
66
+ ```
55
67
  ```
56
68
 
57
69
  ## Markers Reference
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "rcf-cli"
7
- version = "1.2.6"
7
+ version = "1.2.8"
8
8
  authors = [
9
9
  { name="Aladdin Aliyev", email="aladdin@aliyev.site" },
10
10
  ]
@@ -1,4 +1,4 @@
1
- # NOTICE: This file is protected under RCF-PL v1.2.6
1
+ # NOTICE: This file is protected under RCF-PL v1.2.8
2
2
  import argparse
3
3
  import sys
4
4
  import json
@@ -15,7 +15,7 @@ def init_project(args):
15
15
 
16
16
  notice_content = f"""# RCF-PL NOTICE
17
17
 
18
- This project (**{project_name}**) is protected under the **Restricted Correlation Framework Protocol License (RCF-PL) v1.2.6**.
18
+ This project (**{project_name}**) is protected under the **Restricted Correlation Framework Protocol License (RCF-PL) v1.2.8**.
19
19
 
20
20
  Copyright (c) {year} {author_name}. All rights reserved.
21
21
 
@@ -35,7 +35,7 @@ For full protocol details, visit: https://rcf.aliyev.site
35
35
  else:
36
36
  with open(notice_path, "w") as f:
37
37
  f.write(notice_content)
38
- print("✅ Generated NOTICE.md with RCF-PL v1.2.6 protections.")
38
+ print("✅ Generated NOTICE.md with RCF-PL v1.2.8 protections.")
39
39
 
40
40
  rcfignore_path = os.path.join(os.getcwd(), ".rcfignore")
41
41
  if not os.path.exists(rcfignore_path):
@@ -56,11 +56,17 @@ def audit_project(args):
56
56
 
57
57
  if provided_key_hash == admin_key_hash:
58
58
  pass # Admin bypass
59
- elif not license_key or not license_key.startswith("RCF-AUDIT-") or not uuid_regex.match(license_key.replace("RCF-AUDIT-", "")):
60
- print("❌ RCF-PL ERROR: The 'audit' command is a premium feature.")
61
- print(" Please provide a valid RCF-AUDIT license key via --license-key or RCF_LICENSE_KEY env variable.")
59
+ elif not license_key:
60
+ print("❌ RCF-PL ERROR: License key is missing.")
61
+ print(" The 'audit' command is a premium feature. Please provide a license key.")
62
+ print(" Usage: rcf-cli audit . --license-key RCF-AUDIT-XXXXXX")
62
63
  print(" Visit https://rcf.aliyev.site to obtain a license.")
63
64
  sys.exit(1)
65
+ elif not license_key.startswith("RCF-AUDIT-") or not uuid_regex.match(license_key.replace("RCF-AUDIT-", "")):
66
+ print("❌ RCF-PL ERROR: Invalid license key format.")
67
+ print(" Expected format: RCF-AUDIT-(KEY)")
68
+ print("")
69
+ sys.exit(1)
64
70
 
65
71
  scanner = RCFScanner(args.path)
66
72
  results = scanner.scan_directory()
@@ -91,6 +97,71 @@ def audit_project(args):
91
97
  print(f"✅ RCF-Audit Complete. Generated {report_path}")
92
98
  print(f"🔒 Encrypted snapshot of {len(audit_report['protected_assets'])} protected assets created.")
93
99
 
100
+ # [RCF:RESTRICTED]
101
+ # Verification logic to detect tampering by comparing current hashes with the audit report.
102
+ def verify_audit(args):
103
+ report_path = os.path.join(args.path, "RCF-AUDIT-REPORT.json")
104
+ if not os.path.exists(report_path):
105
+ print(f"❌ RCF-PL ERROR: Audit report not found at {report_path}")
106
+ print(" Please run 'rcf-cli audit' first to generate a baseline.")
107
+ sys.exit(1)
108
+
109
+ try:
110
+ with open(report_path, "r") as f:
111
+ report = json.load(f)
112
+ except Exception as e:
113
+ print(f"❌ RCF-PL ERROR: Failed to load audit report: {e}")
114
+ sys.exit(1)
115
+
116
+ print(f"--- RCF Integrity Verification ---")
117
+ print(f"Report Timestamp: {report.get('timestamp')}")
118
+ print("-" * 30)
119
+
120
+ mismatches = []
121
+ missing = []
122
+ verified_count = 0
123
+
124
+ for asset in report.get("protected_assets", []):
125
+ file_rel_path = asset["file"]
126
+ stored_hash = asset["sha256"]
127
+ full_path = os.path.join(args.path, file_rel_path)
128
+
129
+ if not os.path.exists(full_path):
130
+ missing.append(file_rel_path)
131
+ print(f"❌ MISSING: {file_rel_path}")
132
+ continue
133
+
134
+ try:
135
+ with open(full_path, "rb") as f:
136
+ current_hash = hashlib.sha256(f.read()).hexdigest()
137
+
138
+ if current_hash == stored_hash:
139
+ verified_count += 1
140
+ if not args.summary:
141
+ print(f"✅ VERIFIED: {file_rel_path}")
142
+ else:
143
+ mismatches.append(file_rel_path)
144
+ print(f"🚨 TAMPERED: {file_rel_path}")
145
+ print(f" Expected: {stored_hash}")
146
+ print(f" Actual: {current_hash}")
147
+ except Exception as e:
148
+ print(f"⚠️ ERROR scanning {file_rel_path}: {e}")
149
+
150
+ print("-" * 30)
151
+ print(f"Total Assets in Report: {len(report.get('protected_assets', []))}")
152
+ print(f"Verified: {verified_count}")
153
+
154
+ if missing:
155
+ print(f"Missing: {len(missing)}")
156
+ if mismatches:
157
+ print(f"🚨 Mismatches Detected: {len(mismatches)}")
158
+
159
+ if mismatches or missing:
160
+ sys.exit(1)
161
+ else:
162
+ print("🛡️ Integrity Check Passed. No unauthorized modifications detected.")
163
+ sys.exit(0)
164
+
94
165
  def main():
95
166
  if len(sys.argv) > 1 and sys.argv[1] == "init":
96
167
  parser = argparse.ArgumentParser(description="Initialize RCF Protocol in the current directory")
@@ -110,6 +181,15 @@ def main():
110
181
  audit_project(args)
111
182
  return
112
183
 
184
+ if len(sys.argv) > 1 and sys.argv[1] == "verify":
185
+ parser = argparse.ArgumentParser(description="Verify project integrity against an RCF Audit Report")
186
+ parser.add_argument("verify", help="Verify command")
187
+ parser.add_argument("path", nargs="?", default=".", help="Path to verify")
188
+ parser.add_argument("--summary", action="store_true", help="Show summary only")
189
+ args = parser.parse_args()
190
+ verify_audit(args)
191
+ return
192
+
113
193
  parser = argparse.ArgumentParser(description="RCF Protocol Compliance Checker")
114
194
  parser.add_argument("path", nargs="?", default=".", help="Path to scan (default: current directory)")
115
195
  parser.add_argument("--format", choices=["text", "json"], default="text", help="Output format")
@@ -1,4 +1,4 @@
1
- # NOTICE: This file is protected under RCF-PL v1.2.6
1
+ # NOTICE: This file is protected under RCF-PL v1.2.8
2
2
  import os
3
3
  import re
4
4
  from pathlib import Path
@@ -8,7 +8,7 @@ class RCFScanner:
8
8
  """Scans files and directories for RCF protocol markers."""
9
9
 
10
10
  MARKER_PATTERN = re.compile(r'\[RCF:(PUBLIC|PROTECTED|RESTRICTED|NOTICE)\]')
11
- HEADER_PATTERN = re.compile(r'NOTICE: This file is protected under RCF-PL v1.2.6')
11
+ HEADER_PATTERN = re.compile(r'NOTICE: This file is protected under RCF-PL v1.2.8')
12
12
 
13
13
  def __init__(self, root_path, ignore_list=None):
14
14
  self.root_path = Path(root_path)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rcf-cli
3
- Version: 1.2.6
3
+ Version: 1.2.8
4
4
  Summary: A command-line tool for RCF protocol compliance verification.
5
5
  Author-email: Aladdin Aliyev <aladdin@aliyev.site>
6
6
  License: RCF-PL 1.1.1
@@ -31,6 +31,7 @@ pip install rcf-cli
31
31
  - **Automated Scanning**: Quickly scan projects for RCF compliance and extract markers.
32
32
  - **Header Validation**: Ensure files have the required `NOTICE: This file is protected under RCF-PL v1.1` header.
33
33
  - **RCF-Audit (Premium)**: Generate cryptographically signed compliance reports for enterprise auditing.
34
+ - **Integrity Verification**: Compare current file hashes against an audit report to detect unauthorized modifications or tampering.
34
35
 
35
36
 
36
37
  ## CLI Usage
@@ -65,6 +66,17 @@ rcf-cli audit . --license-key RCF-AUDIT-XXXX-XXXX
65
66
  export RCF_LICENSE_KEY=RCF-AUDIT-XXXX-XXXX
66
67
  rcf-cli audit .
67
68
  ```
69
+
70
+ ### 4. Verify Project Integrity
71
+
72
+ Compare current files with the latest audit report:
73
+
74
+ ```bash
75
+ rcf-cli verify .
76
+
77
+ # Show summary only
78
+ rcf-cli verify . --summary
79
+ ```
68
80
  ```
69
81
 
70
82
  ## Markers Reference
@@ -8,7 +8,7 @@ def temp_workspace(tmp_path):
8
8
  # Create a temporary file with RCF markers
9
9
  protected_file = tmp_path / "protected_code.py"
10
10
  protected_file.write_text(
11
- "# NOTICE: This file is protected under RCF-PL v1.2.6\n"
11
+ "# NOTICE: This file is protected under RCF-PL v1.2.7\n"
12
12
  "# [RCF:RESTRICTED]\n"
13
13
  "def secret(): pass"
14
14
  )
File without changes
File without changes
File without changes