Octagon group releases Synonymizer anonymity tool.

Hello, now we have release a tool that will replace words typed with similar words of the same meaning. The source code is all here for all systems and browser extensions. enjoy freedom from stylometric tracking.

Synonymizer
backup -- https://gitea.com/sinominous
To run this code in Windows command line environment, follow these steps:
Install Python on your system if you haven't already done so. You can download it from the official Python website (https://www.python.org/downloads/).
Open Command Prompt by typing "cmd" in the Windows search bar and selecting the Command Prompt app.
Navigate to the directory where the Python script is saved using the cd command.
Type python filename.py (replace "filename" with the actual name of your Python script) to run the program.
Enter the text you want to synonymize when prompted and press Enter.
The program will output the synonymized text in the command line.
To further avoid stylometric tracking, we can add some additional modifications to the code:
Randomly select synonyms from the list of synonyms for each word, instead of always using the first one.
Use a thesaurus that includes less common or obscure words, to make the text less predictable.
Replace common words with more rare or unusual synonyms to further increase the uniqueness of the text.
To run the code on Windows command line, save the code as a .py file (e.g., "synonymizer.py") and then navigate to the directory where the file is saved in the command prompt. Type "python" followed by the name of the file (without quotes) to run the program, e.g.: C:\Users\Username\Documents> python synonymizer.py
Then follow the prompts to enter the text you want to synonymize
WINDOWS V1
######################
import nltk
from nltk.corpus import wordnet
import random
def synonymize_text(text):
words = nltk.word_tokenize(text)
new_words = []
for word in words:
synonyms = []
for syn in wordnet.synsets(word):
for lemma in syn.lemmas():
synonyms.append(lemma.name())
if synonyms:
new_word = random.choice(synonyms)
else:
new_word = word
new_words.append(new_word)
return " ".join(new_words)
# example usage
text = input("Enter text to synonymize: ")
synonymized_text = synonymize_text(text)
print(synonymized_text)
Linux
##################
import nltk
import random
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')
from nltk.corpus import wordnet
from nltk.tokenize import word_tokenize
def get_synonyms(word):
synonyms = []
for syn in wordnet.synsets(word):
for lemma in syn.lemmas():
synonyms.append(lemma.name())
return synonyms
def get_word_pos(word):
pos = nltk.pos_tag([word])[0][1]
if pos.startswith('NN'):
return wordnet.NOUN
elif pos.startswith('VB'):
return wordnet.VERB
elif pos.startswith('JJ'):
return wordnet.ADJ
elif pos.startswith('RB'):
return wordnet.ADV
else:
return None
def synonymize_text(text):
words = word_tokenize(text)
new_words = []
for word in words:
pos = get_word_pos(word)
if pos:
synonyms = get_synonyms(word)
if synonyms:
new_word = random.choice(synonyms)
else:
new_word = word
new_words.append(new_word)
else:
new_words.append(word)
return " ".join(new_words)
# example usage
text = "This is a sample text that we will synonymize."
synonymized_text = synonymize_text(text)
print(synonymized_text)
############################
Firefox extension
a Mozilla Firefox extension that utilizes the code you provided to synonymize text and further avoid stylometric tracking. Here are the steps to do so:
Create a new directory on your computer and name it "synonymizer_extension". Within that directory, create a new file called "manifest.json". This file will contain metadata for the extension and tell Firefox how to load the extension.
Open the "manifest.json" file in a text editor and add the following code:
json
{
"manifest_version": 2,
"name": "Synonymizer Extension",
"version": "1.0",
"description": "This extension replaces words with synonyms to avoid stylometric tracking.",
"icons": {
"48": "icon.png"
},
"permissions": ["activeTab", "webNavigation", "webRequest", "webRequestBlocking", "storage"],
"browser_action": {
"default_icon": {
"48": "icon.png"
},
"default_title": "Synonymize Text",
"default_popup": "popup.html"
},
"background": {
"scripts": ["background.js"],
"persistent": false
}
}
This code sets up the basic metadata for the extension and specifies the files that Firefox needs to load.
Create a new file called "popup.html". This file will contain the HTML for the extension's popup window.
Open the "popup.html" file in a text editor and add the following code:
php

<html>
<head>
<title>Synonymize Text</title>
<link rel="stylesheet" type="text/css" href="popup.css">
</head>
<body>
<div class="container">
<div class="form-group">
<textarea id="text" placeholder="Type text here..."></textarea>
</div>
<div class="form-group">
<button id="synonymize-btn">Synonymize</button>
</div>
<div class="form-group">
<textarea id="synonymized-text" readonly></textarea>
</div>
</div>
<script src="popup.js"></script>
</body>
</html>
This code creates a simple form with a textarea for the user to enter text and a button to trigger the synonymization process. It also includes a second textarea to display the synonymized text.
Create a new file called "popup.css". This file will contain the CSS styles for the popup window.
Open the "popup.css" file in a text editor and add the following code:
css
.container {
width: 300px;
margin: 20px auto;
}
.form-group {
margin-bottom: 10px;
}
textarea {
width: 100%;
height: 100px;
padding: 5px;
border: 1px solid #ccc;
border-radius: 5px;
resize: none;
}
button {
background-color: #337ab7;
color: #fff;
border: none;
border-radius: 5px;
padding: 10px 20px;
cursor: pointer;
}
button:hover {
background-color: #286090;
}
#synonymized-text {
color: #555;
}
This code styles the form elements and button.
Create a new file called "background.js". This file will contain the logic for the extension.
Open the "background.js" file in a text editor and add the following code:
vbnet
function synonymizeText(text
##############################
Chrome extension
To create a Chrome extension from the existing code, you can follow these steps:
Create a new directory for your extension and navigate into it:
bash
mkdir chrome-extension
cd chrome-extension
Create a new file named manifest.json in the directory with the following content:
json
{
"manifest_version": 2,
"name": "Synonymizer",
"version": "1.0",
"description": "Replace words with their synonyms to avoid stylometric tracking.",
"icons": {
"16": "icon16.png",
"48": "icon48.png",
"128": "icon128.png"
},
"browser_action": {
"default_icon": "icon48.png",
"default_popup": "popup.html"
},
"permissions": [
"activeTab"
]
}
Download the icons you want to use for your extension (icon16.png, icon48.png, and icon128.png) and place them in the directory.
Create a new file named popup.html in the directory with the following content:
php

<html>
<head>
<title>Synonymizer</title>
<script src="popup.js"></script>
</head>
<body>
<h1>Synonymizer</h1>
<p>Replace words with their synonyms to avoid stylometric tracking.</p>
<textarea id="text"></textarea>
<button id="synonymize">Synonymize</button>
</body>
</html>
Create a new file named popup.js in the directory with the following content:
javascript
function synonymize_text(text) {
return new Promise((resolve, reject) => {
chrome.runtime.sendMessage({ text: text }, function(response) {
if (chrome.runtime.lastError) {
reject(chrome.runtime.lastError);
} else {
resolve(response.synonymized_text);
}
});
});
}
document.addEventListener("DOMContentLoaded", function(event) {
document.getElementById("synonymize").addEventListener("click", async function() {
const text = document.getElementById("text").value;
const synonymized_text = await synonymize_text(text);
document.getElementById("text").value = synonymized_text;
});
});
Load the extension into Chrome:
Open Chrome and navigate to chrome://extensions.
Turn on "Developer mode" in the top right corner.
Click "Load unpacked" in the top left corner and select the directory containing your extension.
Test the extension:
Navigate to a webpage.
Click on the extension icon in the top right corner.
Enter some text in the textarea and click the "Synonymize" button.
The text should be replaced with its synonymized version.
############################
Safari web app extension
here's how you can turn the code into a Safari app extension:
Open Xcode and create a new project. Choose "Application" as the project type and "Safari App Extension" as the template.
Name the project and choose a team for code signing.
In the project navigator, expand the "Safari Extension" group and open the "Info.plist" file.
Add the following keys to the file:
NSExtensionPrincipalClass: Set this to the name of your principal class, which you will create in the next step.
NSExtensionPointIdentifier: Set this to com.apple.Safari.extension.
Create a new Swift file and name it something like "Synonymizer.swift".
Add the following code to the file:
swift
import Foundation
import SafariServices
import NaturalLanguage
class Synonymizer: SFSafariExtensionHandler {
override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) {
if messageName == "synonymizeText" {
if let text = userInfo?["text"] as? String {
let newWords = synonymizeText(text: text)
page.dispatchMessageToScript(withName: "synonymizedText", userInfo: ["text": newWords])
}
}
}

func synonymizeText(text: String) -> String {
var newWords = [String]()
let tagger = NLTagger(tagSchemes: [.lexicalClass])
tagger.string = text
let options: NLTagger.Options = [.omitPunctuation, .omitWhitespace]
tagger.enumerateTags(in: text.startIndex..<text.endIndex, unit: .word, scheme: .lexicalClass, options: options) { (tag, range) in
guard let word = tag?.rawValue else {
newWords.append(String(text[range]))
return true
}
let synonyms = word.synonyms
if synonyms.count > 0 {
newWords.append(synonyms.first!)
} else {
newWords.append(word)
}
return true
}
return newWords.joined(separator: " ")
}
}
extension String {
var synonyms: [String] {
let word = self.lowercased()
let wordNet = NLWordNet()
let synsets = wordNet.synsets(for: word, language: .english)
var synonyms = [String]()
for synset in synsets {
let lemma = synset.lemmas.first!
let syn = lemma.baseForm
if syn != word {
synonyms.append(syn)
}
}
return synonyms
}
}
In the "Info.plist" file, add the following key:
NSExtensionPrincipalClass: Set this to the name of your Synonymizer class.
Build and run the project. This will open Safari with the extension installed.
Navigate to a webpage and click the toolbar button for the extension. This will open the popover, where you can enter some text to be synonymized.
Click the "Synonymize" button to see the synonymized text.
That's it! Now you have a Safari app extension that can synonymize text on webpages.