Ajouter des scripts + rédaction du readme
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/.idea
|
||||
36
eclypseV1.js
Normal file
36
eclypseV1.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// ==UserScript==
|
||||
// @name Eclypse V1
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2024-11-05
|
||||
// @author Charles-Arthur DAVID
|
||||
// @description Auto-login on Eclypse V1
|
||||
// @match https://IP-EclypseV1-1/login*
|
||||
// @match https://IP-EclypseV1-2/login*
|
||||
// @match https://IP-EclypseV1-3/login*
|
||||
// @match https://IP-EclypseV1-4/login*
|
||||
// ==/UserScript==
|
||||
|
||||
// N'oubliez pas de configurer l'url de l'automate ci-dessus avec les paramètres @match
|
||||
// Don't forget to configure the url of the automaton above with the @match parameters
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Changez le nom d'utilisateur. N'utilisez pas admin pour des raisons de sécurité.
|
||||
const username = 'admin'; // Change the username. Don't use admin for security reasons.
|
||||
|
||||
// Changer le mot de passe /!\ qui est en claire dans le script /!\
|
||||
const password = 'YourPassword'; // Change the password /!\ which is clear in the script /!\
|
||||
|
||||
// Récupère le protocole et le domaine
|
||||
const currentUrl = window.location;
|
||||
const protocol = currentUrl.protocol;
|
||||
const domain = currentUrl.hostname;
|
||||
|
||||
// Définir la page de redirection
|
||||
const newPath = "/j_security_check?j_username=" + username + "&j_password=" + password; // Page cible
|
||||
const redirectUrl = `${protocol}//${domain}${newPath}`;
|
||||
|
||||
// Effectuer la redirection
|
||||
window.location.href = redirectUrl;
|
||||
})();
|
||||
50
eclypseV2.js
Normal file
50
eclypseV2.js
Normal file
@@ -0,0 +1,50 @@
|
||||
// ==UserScript==
|
||||
// @name Eclypse V2
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2024-11-05
|
||||
// @author Charles-Arthur DAVID
|
||||
// @description Auto-login on Eclypse V2
|
||||
// @match https://IP-EclypseV2-1/login*
|
||||
// @match https://IP-EclypseV2-2/login*
|
||||
// @match https://IP-EclypseV2-3/login*
|
||||
// @match https://IP-EclypseV2-4/login*
|
||||
// ==/UserScript==
|
||||
|
||||
// N'oubliez pas de configurer l'url de l'automate ci-dessus avec les paramètres @match
|
||||
// Don't forget to configure the url of the automaton above with the @match parameters
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Changez le nom d'utilisateur. N'utilisez pas admin pour des raisons de sécurité.
|
||||
const username = 'admin'; // Change the username. Don't use admin for security reasons.
|
||||
|
||||
// Changer le mot de passe /!\ qui est en claire dans le script /!\
|
||||
const password = 'YourPassword'; // Change the password /!\ which is clear in the script /!\
|
||||
|
||||
// Fonction pour insérer du texte en simulant une insertion utilisateur
|
||||
function insertText(input, text, callback) {
|
||||
input.focus();
|
||||
for (let i = 0; i < text.length; i++) {
|
||||
document.execCommand('insertText', false, text[i]);
|
||||
}
|
||||
input.dispatchEvent(new Event('input', { bubbles: true }));
|
||||
callback();
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
const loginField = document.querySelector("input[name='username']");
|
||||
const passwordField = document.querySelector("input[name='password']");
|
||||
const loginButtonParent = document.querySelector("div[class*='SubmitButton']");
|
||||
const loginButton = loginButtonParent ? loginButtonParent.querySelector("button") : null;
|
||||
|
||||
if (loginField && passwordField && loginButton) {
|
||||
// Insérer le nom d'utilisateur et le mot de passe, puis cliquer sur le bouton
|
||||
insertText(loginField, username, () => {
|
||||
insertText(passwordField, password, () => {
|
||||
loginButton.click(); // Cliquer sur le bouton de connexion
|
||||
});
|
||||
});
|
||||
}
|
||||
}, 1000); // Délai initial de 3 secondes pour laisser la page se charger complètement
|
||||
})();
|
||||
36
niagaraV4.js
Normal file
36
niagaraV4.js
Normal file
@@ -0,0 +1,36 @@
|
||||
// ==UserScript==
|
||||
// @name Niagara V4
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 2024-11-04
|
||||
// @author Charles-Arthur DAVID
|
||||
// @description Auto-login on Niagara V4
|
||||
// @match https://localhost/login*
|
||||
// @match https://IP-NiagaraV4-1/login*
|
||||
// @match https://IP-NiagaraV4-2/login*
|
||||
// @match https://IP-EclypseV4-3/login*
|
||||
// @match https://IP-EclypseV4-4/login*
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// Changez le nom d'utilisateur. N'utilisez pas admin pour des raisons de sécurité.
|
||||
const username = 'admin'; // Change the username. Don't use admin for security reasons.
|
||||
|
||||
// Changer le mot de passe /!\ qui est en claire dans le script /!\
|
||||
const password = 'YourPassword'; // Change the password /!\ which is clear in the script /!\
|
||||
|
||||
// Localisez les champs de saisie de l'utilisateur et du mot de passe
|
||||
const usernameField = document.querySelector("input[name='j_username']");
|
||||
const passwordField = document.querySelector("input[name='j_password']");
|
||||
const loginButton = document.querySelector("input[type='submit']");
|
||||
|
||||
// Remplissez les champs de connexion
|
||||
if (usernameField && passwordField && loginButton) {
|
||||
usernameField.value = username;
|
||||
passwordField.value = password;
|
||||
|
||||
// Soumet automatiquement le formulaire après avoir rempli les informations
|
||||
loginButton.click();
|
||||
}
|
||||
})();
|
||||
154
readme.md
Normal file
154
readme.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# Auto-Login avec/with Tampermonkey
|
||||
|
||||
English below
|
||||
|
||||
## Description
|
||||
|
||||
Ce dépôt contient des scripts JavaScript pour automatiser les connexions (auto-login) sur des équipements Eclypse ou Niagara via l'extension **Tampermonkey**.
|
||||
|
||||
⚠️ **Attention :**
|
||||
- Nous ne sommes pas responsables de l’extension Tampermonkey ni de son utilisation.
|
||||
- Les identifiants (login et mot de passe) seront en clair dans le script. Utilisez ces scripts avec prudence et à vos propres risques.
|
||||
|
||||
---
|
||||
|
||||
## Installation de Tampermonkey
|
||||
|
||||
### Google Chrome
|
||||
1. Ouvrez Google Chrome.
|
||||
2. Accédez au **Chrome Web Store** à l'adresse suivante :
|
||||
[https://chrome.google.com/webstore](https://chrome.google.com/webstore).
|
||||
3. Recherchez **Tampermonkey** dans la barre de recherche.
|
||||
4. Cliquez sur **Ajouter à Chrome** puis confirmez en sélectionnant **Ajouter l'extension**.
|
||||
5. L'icône Tampermonkey s’affiche désormais dans la barre d’outils.
|
||||
|
||||
### Activer le Mode Développeur (Google Chrome)
|
||||
|
||||
Sur Chrome, il faut autoriser l'extension à modifier la page en activant le mode développeur. Pour l'activer :
|
||||
|
||||
1. Ouvrez Chrome et cliquez sur le menu principal (les trois points verticaux en haut à droite).
|
||||
2. Accédez à **Plus d'outils** > **Extensions**.
|
||||
3. Activez le **Mode développeur** en haut à droit de la page des extensions.
|
||||
|
||||
---
|
||||
|
||||
### Mozilla Firefox
|
||||
1. Ouvrez Mozilla Firefox.
|
||||
2. Accédez au **Firefox Add-ons Store** à l'adresse suivante :
|
||||
[https://addons.mozilla.org](https://addons.mozilla.org).
|
||||
3. Recherchez **Tampermonkey** dans la barre de recherche.
|
||||
4. Cliquez sur **Ajouter à Firefox** puis confirmez en sélectionnant **Ajouter**.
|
||||
5. L'icône Tampermonkey s’affiche désormais dans la barre d’outils.
|
||||
|
||||
---
|
||||
|
||||
## Ajouter un Script à une URL avec Tampermonkey
|
||||
|
||||
1. Cliquez sur l'icône Tampermonkey dans la barre d'outils.
|
||||
2. Sélectionnez Créer un nouveau script....
|
||||
3. Dans l'éditeur de script, remplacez le code par défaut par votre script.
|
||||
4. Pour spécifier l'URL où le script doit s'exécuter, modifiez le bloc de métadonnées @match. Par exemple :
|
||||
```js
|
||||
// ==UserScript==
|
||||
// @name Script d'Auto-Login
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description Auto-login
|
||||
// @author Vous
|
||||
// @match http://192.168.1.10/login*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
```
|
||||
5. Enregistrez le script en cliquant sur Fichier > Enregistrer ou en appuyant sur Ctrl+S.
|
||||
Le script s'exécutera automatiquement lorsque vous visiterez l'URL spécifiée.
|
||||
|
||||
## Notes Importantes
|
||||
|
||||
- Les identifiants (login et mot de passe) dans ces scripts sont stockés en clair dans le code JavaScript. Assurez-vous que votre environnement est sécurisé avant d'utiliser ces scripts.
|
||||
- Tampermonkey est une extension tierce. Nous ne garantissons ni sa fiabilité ni sa sécurité.
|
||||
- Vérifiez régulièrement les mises à jour de Tampermonkey et désactivez-le si vous soupçonnez un comportement anormal.
|
||||
|
||||
---
|
||||
|
||||
## Contribuer
|
||||
Si vous souhaitez contribuer ou signaler un problème, n'hésitez pas à ouvrir une issue ou une pull request dans ce dépôt.
|
||||
|
||||
**Responsabilité** : L'utilisation de ces scripts est sous votre entière responsabilité. Utilisez-les uniquement dans des environnements sécurisés et dans le respect des règles d’accès de vos équipements.
|
||||
|
||||
Voici la traduction en anglais de votre README :
|
||||
|
||||
---
|
||||
|
||||
# English Version
|
||||
|
||||
## Description
|
||||
|
||||
This repository contains JavaScript scripts to automate logins (auto-login) on professional equipment using the **Tampermonkey** extension.
|
||||
|
||||
⚠️ **Warning:**
|
||||
- We are not responsible for the Tampermonkey extension or its use.
|
||||
- The login credentials (username and password) will be stored in plain text in the script. Use these scripts with caution and at your own risk.
|
||||
|
||||
---
|
||||
|
||||
## Installing Tampermonkey
|
||||
|
||||
### Google Chrome
|
||||
1. Open Google Chrome.
|
||||
2. Go to the **Chrome Web Store** at the following address:
|
||||
[https://chrome.google.com/webstore](https://chrome.google.com/webstore).
|
||||
3. Search for **Tampermonkey** in the search bar.
|
||||
4. Click on **Add to Chrome** and confirm by selecting **Add extension**.
|
||||
5. The Tampermonkey icon will now appear in the toolbar.
|
||||
|
||||
### Enabling Developer Mode (Google Chrome)
|
||||
|
||||
On Chrome, you must authorize the extension to modify the page by activating developer mode. To enable it:
|
||||
1. Open Chrome and click on the main menu (the three vertical dots in the top right corner).
|
||||
2. Go to **More tools** > **Extensions**.
|
||||
3. Enable **Developer mode** at the top right of the extensions page.
|
||||
|
||||
---
|
||||
|
||||
### Mozilla Firefox
|
||||
1. Open Mozilla Firefox.
|
||||
2. Go to the **Firefox Add-ons Store** at the following address:
|
||||
[https://addons.mozilla.org](https://addons.mozilla.org).
|
||||
3. Search for **Tampermonkey** in the search bar.
|
||||
4. Click on **Add to Firefox** and confirm by selecting **Add**.
|
||||
5. The Tampermonkey icon will now appear in the toolbar.
|
||||
|
||||
---
|
||||
|
||||
## Ajouter un Script à une URL avec Tampermonkey
|
||||
|
||||
1. Click on the Tampermonkey icon in the toolbar.
|
||||
2. Select Create a new script....
|
||||
3. In the script editor, replace the default code with your script.
|
||||
4. To specify the URL where the script should run, modify the @match or @include metadata block at the top of the script. For example:
|
||||
```js
|
||||
// ==UserScript==
|
||||
// @name Auto-Login Script
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.1
|
||||
// @description Auto-login
|
||||
// @author You
|
||||
// @match http://192.168.1.10/login*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
```
|
||||
5. Save the script by clicking on File > Save or by pressing Ctrl+S.
|
||||
The script will now run automatically when you visit the specified URL.
|
||||
|
||||
## Important Notes
|
||||
|
||||
- The login credentials (username and password) in these scripts are stored in plain text in the JavaScript code. Ensure your environment is secure before using these scripts.
|
||||
- Tampermonkey is a third-party extension. We do not guarantee its reliability or security.
|
||||
- Regularly check for updates to Tampermonkey and disable it if you suspect any abnormal behavior.
|
||||
|
||||
---
|
||||
|
||||
## Contributing
|
||||
If you wish to contribute or report an issue, feel free to open an issue or a pull request in this repository.
|
||||
|
||||
**Responsibility**: The use of these scripts is entirely at your own risk. Use them only in secure environments and in compliance with the access rules of your equipment.
|
||||
Reference in New Issue
Block a user