Chagu
ChainGuard
graph TD
subgraph Users and Entities
A[User]:::userColor
B[Entity]:::userColor
end
subgraph Data Request and Transfer
C[Data Requested]:::dataColor
D[Data Sent]:::dataColor
E[Data Received]:::dataColor
end
subgraph Secure Transmission
F[AES Encryption]:::encryptionColor
G[Secure Data Transfer]:::encryptionColor
end
subgraph Anomaly Detection
H[Anomaly Detection Model]:::anomalyColor
end
subgraph Blockchain and Traceability
I[Blockchain Transaction]:::blockchainColor
J[Blockchain Ledger]:::blockchainColor
K[Neo4j Trace]:::traceColor
end
%% Flow of Data
A -->|Requests Data| C
C -->|Encrypted with AES| F
F -->|Transfers Data Securely| G
G -->|Data Sent| D
D -->|Logs Transaction| I
I -->|Recorded in Ledger| J
I -->|Creates Trace| K
D -->|Receives Data| E
E -->|Analyzes Data| H
H -->|Flags Anomalies| K
B -->|Receives Data| E
%% Highlight Flow Arrows
classDef flowColor stroke:#FF5733,stroke-width:4px;
class C,F,G,D,I,J,K flowColor;
%% Define Colors
classDef userColor fill:#FFDDC1,stroke:#333,stroke-width:2px,color:#333;
classDef dataColor fill:#C1E1C5,stroke:#333,stroke-width:2px,color:#333;
classDef encryptionColor fill:#FADBD8,stroke:#333,stroke-width:2px,color:#333;
classDef anomalyColor fill:#F9EBEA,stroke:#333,stroke-width:2px,color:#333;
classDef blockchainColor fill:#D4E6F1,stroke:#333,stroke-width:2px,color:#333;
classDef traceColor fill:#FCF3CF,stroke:#333,stroke-width:2px,color:#333;
Nodes:
Network Traffic Data: Represents the source of data that is analyzed by the anomaly detection model. Anomaly Detection Model: Scans network traffic data to flag anomalies. Anomaly Node in Neo4j: Represents flagged anomalies stored as nodes in the Neo4j database. Blockchain Transaction: Represents a transaction recorded in the blockchain. Blockchain Node in Neo4j: Represents a blockchain transaction stored as a node in Neo4j. Secure Data Transfer: Represents the secure transfer of data between nodes. AES Encryption: The method used to encrypt and decrypt the data during transfer. Blockchain Network: The network where transactions are recorded. Anomaly Detection Results: Results of anomaly detection stored in Neo4j.
Relationships:
Scanned by: Indicates the process of scanning network traffic data by the anomaly detection model. Flags anomalies: Shows that the model flags anomalies and creates corresponding nodes in Neo4j. DETECTED_IN: Relationship between an anomaly and a blockchain transaction where the anomaly was detected. Sends encrypted data: Indicates the data transfer process using AES encryption. Receives encrypted data: Represents the reception of encrypted data. Records Transactions: Indicates that the blockchain network records transactions in the blockchain. Stored in: Represents the storage of anomaly detection results in the Neo4j graph database. Interaction: Shows the interaction between secure data transfer and the anomaly detection model. ChainGuard is a custom protocol designed for secure data transformation using blockchain technology. It leverages AES encryption for confidentiality and plans to integrate blockchain for data integrity and traceability.
https://pypi.org/project/chagu/
pip install chainguard
Features
- AES Encryption and Decryption
- (Planned) Blockchain Integration
- Unit and Integration Tests
Installation
pip install -r requirements.txt
usage
from chainguard.encryption import AESCipher
password = "yourpassword"
cipher = AESCipher(password)
# Encrypt and Decrypt
plaintext = "Hello, World!"
encrypted = cipher.encrypt(plaintext)
decrypted = cipher.decrypt(encrypted)
print(f"Encrypted: {encrypted}")
print(f"Decrypted: {decrypted}")
Data Transfer Protocol
ChainGuard now includes a secure data transfer protocol to securely send and receive data between nodes.
Example Usage
from chainguard.data_transfer import SecureDataTransfer
# Initialize SecureDataTransfer with a shared password
transfer = SecureDataTransfer(password="securepassword")
# On the sending side
transfer.send_data("This is a secure message")
# On the receiving side
transfer.receive_data()
Blockchain Integration
ChainGuard includes a custom blockchain to securely log and verify each data transfer. This ensures transparency, immutability, and traceability of all transactions.
Example Usage
from chainguard.data_transfer import SecureDataTransfer
# Initialize SecureDataTransfer with a shared password
transfer = SecureDataTransfer(password="securepassword")
# On the sending side
transfer.send_data("This is a secure message")
# On the receiving side
transfer.receive_data()
# Validate blockchain
is_valid = transfer.validate_blockchain()
print(f"Blockchain valid: {is_valid}")
Anomaly Detection Model , based on shodan scanner
Overview
This repository contains a Python class AnomalyDetectionModel built using TensorFlow and Keras for detecting anomalies in network traffic data. The class encapsulates the creation, training, and evaluation of a neural network model designed to classify network data as either normal or anomalous.
Why Use a Sequential Model?
The Sequential model in Keras is a simple, linear stack of layers. It is ideal for building feedforward neural networks where the model progresses through each layer sequentially, without any branching or complex topologies.
Key Reasons for Using Sequential:
Simplicity: The Sequential API is straightforward and easy to use. It is perfect for beginners and for models that involve a single input and output with layers stacked one after the other.
Linear Stack: For the task of anomaly detection, the architecture typically involves a simple forward pass through several dense layers, making the Sequential model a natural fit.
Flexibility: While simple, the Sequential model is flexible enough to allow for customization through the addition of various types of layers, activation functions, and regularization techniques.
Example Usage
# Initialize the model with the input shape
anomaly_model = AnomalyDetectionModel(X_train.shape[1])
# Train the model
history = anomaly_model.train(X_train, y_train)
# Evaluate the model on the test data
loss, accuracy = anomaly_model.evaluate(X_test, y_test)
print(f'Test Accuracy: {accuracy:.4f}')
Dependencies Python 3.x TensorFlow Keras (included with TensorFlow) Scikit-learn Pandas Installation Install the required packages using pip:
Conclusion The Sequential model is a great choice for this anomaly detection task due to its simplicity, ease of use, and the linear nature of the problem. This approach ensures that the model is easy to build, understand, and maintain while still providing robust performance for binary classification tasks such as anomaly detection.
Metadata
Release files for chagu 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chagu-0.1.3.tar.gz | 11.9 kB | Without provenance | Details for chagu-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chagu-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for chagu-0.1.3-py3-none-any.whl |
Total release size: 27.5 kB
Release files / chagu-0.1.3.tar.gz
| Download URL | chagu-0.1.3.tar.gz |
|---|---|
| Size | 11.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8929db60e550777e41807b6257a2a55b2dd4fdf29b94ff1e313b6688a93c3a9c
|
|
BLAKE2b-256 checksum How to use checksums |
7208a31d3389c9b7294c6a2bbc7691c76e15b555a731de4b334491761eba1b1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.0
|
Release files / chagu-0.1.3-py3-none-any.whl
| Download URL | chagu-0.1.3-py3-none-any.whl |
|---|---|
| Size | 15.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ecbedf1ddc4c2212886d17937faa00aa8b623162a1a8e29f6d0ec07b8dd4e62
|
|
BLAKE2b-256 checksum How to use checksums |
48d126734fd4e8152bfb5e935e128b83c09bfbd04637ce3b86b1879146c3e599
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.8.0
|
Security for chagu 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.