India Post Captcha bypass consignment search and autofill consignment from URL
Home ▶ Tampermonkey ▶ Helpful Tampermonkey Scripts
Install latest with possible future updates OR Install fixed script with no updates
// ==UserScript==
// @name India Post Captcha bypass consignment search and autofill consignment from URL
// @version 0.1
// @description Tracks the consignment or money order or complaint without any captcha solution. Also autofills the consignment number using the con parameter in the URL.
// @author https://github.com/z-aki
// @namespace https://github.com/z-aki
// @match https://www.indiapost.gov.in/*
// @icon https://external-content.duckduckgo.com/ip3/www.indiapost.gov.in.ico
// @grant none
// @require https://github.com/adamhotep/nofus.js/raw/refs/heads/main/nofus.js
Warning
Malicious scripts can violate your privacy and act on your behalf!
You should only install scripts from sources that you trust.
All scripts in this repo are provided in two versions: updates and no updates
controlled by the @downloadURL
tag in the script header.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The trademarks and logos are property of their respective owners (mostly available in the @match
directive or @icon
directive (except when it's loaded from DuckDuckGo)) and no affiliation, association or endorsement is intended, implied or given by the author.
// ==UserScript==
// @name India Post Captcha bypass consignment search and autofill consignment from URL
// @version 0.1
// @description Tracks the consignment or money order or complaint without any captcha solution. Also autofills the consignment number using the con parameter in the URL.
// @author https://github.com/z-aki
// @namespace https://github.com/z-aki
// @match https://www.indiapost.gov.in/*
// @icon https://external-content.duckduckgo.com/ip3/www.indiapost.gov.in.ico
// @grant none
// @require https://github.com/adamhotep/nofus.js/raw/refs/heads/main/nofus.js
// @require https://cdn.jsdelivr.net/npm/crypto-js@4.2.0/crypto-js.min.js
// @downloadURL none
// ==/UserScript==
function encrypted(input) {
const currentTime = Date.now();
// Validate the consignment number format
const encryptedData = CryptoJS.AES.encrypt(
`${input}_${currentTime}`,
"fbds23894b234u2348923h4"
).toString();
const encryptedUrl = `${encodeURIComponent(encryptedData)}`;
return encryptedUrl;
}
function red(URL) {
window.location.href = URL;
}
function redirect(URL, input) {
const encryptedUrl = URL + encrypted(input);
red(encryptedUrl); // Redirect to the encrypted URL
}
function fix(topDiv) {
console.log("blahfoo");
const searchButton = topDiv.querySelector("button.searchButton");
searchButton.removeAttribute("disabled");
searchButton.addEventListener("click", function () {
const activeTab = topDiv.querySelector(
"div.trackandtraceview_tabs button.active"
);
console.log(activeTab.innerText);
const inner = activeTab.innerText.toLowerCase();
const input = document.getElementById("moNumber").value.trim();
if (inner.includes("consignment")) {
red("/track-result/article-number/" + encrypted(input) + "?con=" + input);
} else if (inner.includes("money")) {
red("/track-result/moneyorder/" + encrypted(input) + "?con=" + input);
} else if (inner.includes("complaint")) {
red("/track-result/complaints/" + encrypted(input) + "?con=" + input);
}
console.log("unknown tab");
});
autofill(topDiv);
}
function fixOffice(topDiv) {
console.log("blahfoo office");
const searchButton = topDiv.querySelector("button.searchButton");
searchButton.removeAttribute("disabled");
searchButton.addEventListener("click", function () {
const input = topDiv.querySelector("div.p-4.px-2 input");
const activeTab = topDiv.querySelector(
"div.locatepostOffice_tabs button:not(.border-transparent)"
);
console.log(activeTab.innerText);
const inner = activeTab.innerText.toLowerCase();
if (inner.includes("pincode")) {
redirect("locate-postoffice?pincode=", input.value);
} else if (inner.includes("state")) {
red(
"locate-postoffice?state=" +
encrypted(topDiv.querySelectorAll("select")[0].value) +
"&district=" +
encrypted(topDiv.querySelectorAll("select")[1].value)
);
} else if (inner.includes("office")) {
redirect("locate-postoffice?officeName=", input.value);
}
console.log("unknown tab");
});
}
function autofill(elem) {
console.log("blahfoo filling");
const urlParams = new URLSearchParams(window.location.search);
const con = urlParams.get("con");
if (con) {
setTimeout(() => {
moNumber.value = con;
}, 3000);
}
}
nf.wait$("div#trackandtraceview", fix);
nf.wait$("div#LocatePostOfficeHome", fixOffice);