### Anonimatron Configuration Example
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/documentation/README.md
Shows how to generate a configuration example using the -configexample command. This example details supported drivers and provides a demo XML structure for setup.
```bash
./anonimatron.sh -configexample
```
```batch
anonimatron.bat -configexample
```
--------------------------------
### Running Anonimatron
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
This snippet shows the command to execute Anonimatron with a configuration file and a synonyms file. It also provides an example of the expected output during the anonymization process, including progress indicators and completion messages.
```bash
$ ./anonimatron.sh -config config.xml -synonyms synonyms.xml
Anonymization process started
Jdbc url : jdbc:mysql://localhost:3306/mydb
Database user : mydata
To do : 2 tables.
Anonymizing table 'lastnames', total progress [100%, ETA 11:36:56 PM]
Anonymization process completed.
Writing Synonyms to synonyms.xml ...[done].
```
--------------------------------
### Anonimatron XML Configuration Example
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
An example XML configuration file for Anonimatron, specifying database connection details and anonymization rules for table columns.
```xml
```
--------------------------------
### MySQL Database Setup and Data Insertion
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
SQL statements to create a MySQL database named 'mydb', a user 'myuser', grant privileges, create 'userdata' and 'lastnames' tables, and insert sample data into 'userdata'.
```SQL
create database mydb;
create user 'myuser'@'%' identified by 'mypassword';
grant all on *.* to 'myuser'@'%';
flush privileges;
create table mydb.userdata (
id int not null auto_increment primary key,
firstname varchar(20),
lastname varchar(20),
creditcardnr varchar(20)
);
create table mydb.lastnames (
id int not null auto_increment primary key,
lastname varchar(20)
);
insert into mydb.userdata
(firstname,lastname, creditcardnr)
values ('Homer', 'Simpson','1234'),
('Marge', 'Simpson','5678'),
('Ned', 'Flanders','3456'),
('Charles', 'Burns','3456');
insert into mydb.lastnames (lastname)
values ('Simpson'), ('Flanders'), ('Burns');
```
--------------------------------
### Anonimatron Configuration Example
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/anonymizers/README.md
An example XML configuration file for Anonimatron, demonstrating how to register custom anonymizers and apply them to table columns.
```xml
my.package.ToLowerAnonymizer
my.package.FixedValueAnonymizer
```
--------------------------------
### Start MySQL Docker Container
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/integration/mysql/README.md
Starts a MySQL Docker container named 'anonimatron-mysql' and maps port 3306. Sets the root password to 'anonimatron'.
```shell
docker run --name anonimatron-mysql \
-p3306:3306 \
-e MYSQL_ROOT_PASSWORD=anonimatron \
-d mysql:8
```
--------------------------------
### Docker Commands for MS-SQL Server
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/integration/mssql/README.md
Commands to pull the MS-SQL Server Docker image, start the container with specified credentials and port mapping, and execute the sqlcmd command-line tool within the container.
```shell
docker pull mcr.microsoft.com/mssql/server:2017-latest
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=Anon!matron' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-latest
docker exec -it /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P 'Anon!matron'
```
--------------------------------
### Running Anonimatron
Source: https://github.com/realrolfje/anonimatron/blob/develop/README.md
Instructions on how to execute the Anonimatron tool. This involves downloading, unzipping, and running the provided shell scripts.
```shell
anonimatron.sh
```
```shell
anonimatron.bat
```
--------------------------------
### Running Anonimatron
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/documentation/README.md
Demonstrates how to execute Anonimatron from the command line on different operating systems. This is the primary way to interact with the tool.
```bash
./anonimatron.sh
```
```batch
anonimatron.bat
```
--------------------------------
### Project Navigation and Metadata
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/_layouts/default.html
This section displays the project title, description, and links to GitHub repository, download options, and documentation. It utilizes Liquid templating for dynamic content generation.
```html
{{ site.title | default: site.github.repository_name }}
{{ page.description | default: site.description | default: site.github.project_tagline }}
{% if site.github.is_project_page %} View on GitHub {% endif %} {% if site.show_downloads %} Download .zip {% endif %} {% if site.github.is_project_page %} Documentation {% endif %}
```
--------------------------------
### Anonimatron Command Line Usage
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
Demonstrates how to run the Anonimatron command-line tool and lists its available options. This is useful for understanding how to configure and execute data anonymization tasks.
```Shell
$ ./anonimatron.sh
This is Anonimatron 1.10, a command line tool to consistently
replace live data in your database with data data which
can not be traced back to the original data.
You can use this tool to transform a dump from a production
database into a large representative dataset you can
share with your development and test team.
Use the -configexample command line option to get an idea of
what your configuration file needs to look like.
usage: java -jar anonimatron.jar
-config The XML Configuration file describing what to
anonymize.
-configexample Prints out a demo/template configuration file.
-dryrun Do not make changes to the database.
-jdbcurl The JDBC URL to connect to. If provided, overrides the
value in the config file.
-userid The user id for the database connection. If provided,
overrides the value in the config file.
-password The password for the database connection. If provided,
overrides the value in the config file.
-synonyms The XML file to read/write synonyms to. If the file
does not exist it will be created.
```
--------------------------------
### Supported Database URL Formats
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
Displays supported JDBC URL formats and their corresponding database drivers, aiding in the creation of connection strings for Anonimatron.
```bash
$ ./anonimatron.sh -configexample
Supported Database URL formats:
Jdbc URL format By Driver
jdbc:oracle:oci8:@[SID] oracle.jdbc.driver.OracleDriver
jdbc:oracle:thin:@[HOST]:[PORT]:[SID] oracle.jdbc.driver.OracleDriver
jdbc:oracle:oci:@[SID] oracle.jdbc.driver.OracleDriver
jdbc:postgresql://[HOST]:[PORT]/[DB] org.postgresql.Driver
jdbc:mysql://[HOST]:[PORT]/[DB] org.gjt.mm.mysql.Driver
Anonimatron will try to autodetect drivers which are
stored in the lib directory. Add you driver there.
...
```
--------------------------------
### Anonimatron CLI Options
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
Details the command-line arguments for the Anonimatron tool, explaining their purpose in configuring and executing data anonymization processes.
```APIDOC
Anonimatron CLI:
usage: java -jar anonimatron.jar [options]
Options:
-config Specifies the XML configuration file for anonymization.
-configexample Prints a template configuration file to standard output.
-dryrun Performs a dry run without making any changes to the database.
-jdbcurl Overrides the JDBC URL specified in the configuration file.
-userid Overrides the user ID for database connection.
-password Overrides the password for database connection.
-synonyms Specifies an XML file for reading/writing synonyms. If the file
does not exist, it will be created.
```
--------------------------------
### MS-SQL Database and Table Creation
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/integration/mssql/README.md
SQL script to configure contained database authentication, create a new database with partial containment, create a user with password and grants, and create two tables: one in the default schema and another in a custom schema.
```sql
EXEC sp_configure 'CONTAINED DATABASE AUTHENTICATION'
go
EXEC sp_configure 'CONTAINED DATABASE AUTHENTICATION', 1
create database mydb containment = partial
go
use mydb
go
CREATE USER test WITH PASSWORD = 'Test.1234'
GRANT SELECT to test
grant update to test
go
CREATE TABLE TABLE1 (ID int primary key IDENTITY(1,1) NOT NULL, COL1 VARCHAR(200))
CREATE SCHEMA SCHEMA2
CREATE TABLE SCHEMA2.TABLE2 (ID int primary key IDENTITY(1,1) NOT NULL, COL1 VARCHAR(200))
go
INSERT INTO table1 (col1) VALUES ('testmail@example.com');
INSERT INTO schema2.table1 (col1) VALUES ('testmail@example.com');
go
```
--------------------------------
### Querying MySQL Database
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
SQL statements to select all data from the 'userdata' and 'lastnames' tables in the 'mydb' database.
```SQL
select * from mydb.userdata;
select * from mydb.lastnames;
```
--------------------------------
### Project Maintenance Information
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/_layouts/default.html
This snippet provides information about the project's maintenance, including the repository owner and a link to their profile. It also credits GitHub Pages as the platform for generating the page.
```html
{% if site.github.is_project_page %} {{ site.github.repository_name }} is maintained by {{ site.github.owner_name }}. {% endif %} This page was generated by GitHub Pages.
```
--------------------------------
### Google Analytics Integration
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/_layouts/default.html
This snippet demonstrates how to integrate Google Analytics into the website. It initializes the dataLayer and configures the gtag function with the provided analytics ID.
```javascript
window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '{{ site.google_analytics }}');
```
--------------------------------
### Synonyms XML File Structure
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
This snippet displays the structure of the synonyms.xml file generated by Anonimatron. It shows how original data ('from') is mapped to anonymized data ('to') using Base64 encoding for various data types like ELVEN_NAME, ROMAN_NAME, and RANDOMDIGITS.
```xml
```
--------------------------------
### Access MySQL Command Line
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/integration/mysql/README.md
Executes the MySQL command-line tool within the running 'anonimatron-mysql' container. Requires the root password 'anonimatron'.
```shell
docker exec -it anonimatron-mysql mysql -uroot -p
```
--------------------------------
### Querying User Data
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
This SQL snippet demonstrates how to query the 'userdata' table to view the anonymized data. It shows the table structure with anonymized first names, last names, and credit card numbers.
```sql
select * from mydb.userdata;
```
--------------------------------
### Querying Last Names Table
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/index.md
This SQL snippet shows how to query the 'lastnames' table to verify data consistency with the 'userdata' table. It confirms that the anonymized last names are applied consistently across different tables.
```sql
select * from mydb.lastnames;
```
--------------------------------
### Maven Dependency
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/index.md
You can include Anonimatron in your Java project by adding the following dependency to your Maven `pom.xml` file.
```Java
com.rolfje.anonimatron
anonimatron
LATEST_VERSION
```
--------------------------------
### Database and File Support
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/index.md
Anonimatron supports a wide range of databases and file formats for data anonymization. It leverages SQL92 standards and can autodetect various JDBC drivers.
```SQL
-- Supported Databases:
-- Oracle, PostgreSQL, MySQL, DB2, MsSQL, Cloudscape, Pointbase, Firebird, IDS, Informix, Enhydra, Interbase, Hypersonic, jTurbo, SQLServer, Sybase
-- Supported File Formats:
-- CSV, XML
```
--------------------------------
### Anonimatron Anonymizer Types
Source: https://github.com/realrolfje/anonimatron/blob/develop/docs/documentation/anonymizerlist.md
This section details the available anonymizer types in Anonimatron. Each anonymizer has a specific type, input requirement, and output format.
```APIDOC
CharacterStringAnonymizer:
Type: RANDOMCHARACTERS
Input: Any string
Output: A-Z, same length
CharacterStringPrefetchAnonymizer:
Type: RANDOMCHARACTERS
Input: Any string
Output: Characters from all input data, same length
CountryCodeAnonymizer:
Type: COUNTRY_CODE
Input: Any string
Output: ISO 3166-1 alpha 2 or alpha 3 code
DateAnonymizer:
Type: DATE
Input: Valid date
Output: Date between 31 days before and 32 days after the input date
DigitStringAnonymizer:
Type: RANDOMDIGITS
Input: Any string
Output: 0-9, same length, optional mask
DutchBankAccountAnononymizer:
Type: DUTCHBANKACCOUNT
Input: Any string
Output: 11 proof number, minimal 9 digits
DutchBSNAnononymizer:
Type: BURGERSERVICENUMMER
Input: Number or string
Output: Valid Dutch "Burger Service Nummer" or "SOFI Nummer" as number or string
DutchZipCodeAnonymizer:
Type: DUTCH_ZIP_CODE
Input: Any string
Output: Valid Dutch zip/postal code
ElvenNameGenerator:
Type: ELVEN_NAME
Input: Any string
Output: Pronounceable elven name, 2 to 5 syllables
EmailAddressAnonymizer:
Type: EMAIL_ADDRESS
Input: Any string
Output: Valid email address in the domain "@example.com"
IbanAnonymizer:
Type: IBAN
Input: Any string
Output: Valid International Bank Account Number
RomanNameGenerator:
Type: ROMAN_NAME
Input: Any string
Output: Pronounceable Roman name, 2 to 5 syllables
StringAnonymizer:
Type: STRING
Input: Any string
Output: Random hexadecimal string
UkPostCodeAnonymizer:
Type: UK_POST_CODE
Input: Any string
Output: Valid Uk Post code
UUIDAnonymizer:
Type: UUID
Input: Any string
Output: A random UUID
```
--------------------------------
### Java Anonymizer: ToLowerAnonymizer
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/anonymizers/README.md
A custom Java anonymizer that converts input strings to lowercase. It implements the Anonymizer interface and returns a StringSynonym.
```java
package my.package;
import com.rolfje.anonimatron.synonyms.StringSynonym;
import com.rolfje.anonimatron.synonyms.Synonym;
import com.rolfje.anonimatron.anonymizer.Anonymizer;
public class ToLowerAnonymizer implements Anonymizer {
@Override
public String getType() {
return "TO_LOWER_CASE";
}
@Override
public Synonym anonymize(Object from, int size) {
StringSynonym s = new StringSynonym();
s.setFrom(from);
s.setTo(((String)from).toLowerCase());
return s;
}
}
```
--------------------------------
### Java Anonymizer: FixedValueAnonymizer with Parameters
Source: https://github.com/realrolfje/anonimatron/blob/develop/resources/anonymizers/README.md
A custom Java anonymizer that replaces input with a fixed value provided as a parameter. It handles parameter retrieval and throws an exception if the 'value' parameter is missing.
```java
package my.packager;
import java.util.HashMap;
import java.util.Map;
import com.rolfje.anonimatron.synonyms.StringSynonym;
import com.rolfje.anonimatron.synonyms.Synonym;
import com.rolfje.anonimatron.anonymizer.Anonymizer;
public class FixedValueAnonymizer implements Anonymizer {
@Override
public Synonym anonymize(Object from, int size, boolean shortlived) {
return anonymize(from, size, shortlived, new HashMap<>());
}
@Override
public Synonym anonymize(Object from, int size, boolean shortlived, Map parameters) {
if (parameters == null || !parameters.containsKey("value")) {
throw new UnsupportedOperationException("no value");
}
return new StringSynonym(getType(),
(String) from,
parameters.get("value"),
shortlived);
}
@Override
public String getType() {
return "FIXED";
}
}
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.