Open edus2024 opened 1 day ago
manifest.json
{
"version": "1.0.0",
"manifest_version": 3,
"description": "Configure your browser with socks5 proxy",
"homepage_url": "http://localhost",
"name": "Proxy",
"permissions": [
"activeTab",
"tabs",
"proxy",
"webRequest",
"webRequestAuthProvider",
"storage",
"unlimitedStorage",
"notifications"
],
"host_permissions": [
"http://*/*",
"https://*/*",
"<all_urls>"
],
"background": {
//"scripts": ["background.js"]
"service_worker": "background.js"
},
"minimum_chrome_version":"22.0.0"
}
backgroud.js
var config = {
mode: "fixed_servers",
rules: {
singleProxy: {
scheme: "socks5",
host: "127.0.0.1",
port: parseInt(10808)
},
bypassList: ["localhost"]
}
};
chrome.proxy.settings.set({value: config,scope: 'regular'}, function() {
if (chrome.runtime.lastError) {
console.log(`Error: ${chrome.runtime.lastError.message}`);
} else {
console.log('Proxy enabled',"Proxy settings set successfully.");
}
});
function callbackFn(details) {
return {
authCredentials: {
username: "root",
password: "12345"
}
};
}
chrome.webRequest.onAuthRequired.addListener(
callbackFn,
{urls: ["<all_urls>"]},
['blocking']
);
console.log("Proxy and webRequest listeners configured.");
The browser cannot access the network. Using other proxy tools can indeed access the network.
As stated in the title