Add Google Ads, Microsoft Advertising detection

main
Elbert Alias 4 years ago
parent ee2d7f275a
commit f7171c836c

@ -98,7 +98,7 @@ Patterns (regular expressions) are kept in [`src/technologies.json`](https://git
"url": ".+\\.example\\.com", "url": ".+\\.example\\.com",
"oss": true, "oss": true,
"saas": true, "saas": true,
"pricing": ["low", "medium", "high", "freemium", "onetime", "recurring", "poa"], "pricing": ["medium", "freemium", "recurring"],
"website": "https://example.com", "website": "https://example.com",
} }
``` ```

@ -0,0 +1,5 @@
<svg width="2443" height="2443" viewBox="0 0 2443 2443" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M50.4 1721.6L862.5 314.9L1566.2 721.2L754.2 2127.9L50.4 1721.6Z" fill="#FBBC04"/>
<path d="M2385.1 1716.7L1572.5 309.5C1467.6 111.1 1221.8 35.2999 1023.4 140.2C825 245.1 749.3 490.9 854.1 689.3C858.7 698 863.6 706.5 868.8 714.9L1681.4 2122.1C1791 2317.9 2038.6 2387.8 2234.4 2278.2C2430.2 2168.6 2500.1 1921 2390.5 1725.2C2388.7 1722 2386.9 1718.9 2385.1 1715.8V1716.7Z" fill="#4285F4"/>
<path d="M406.3 2327.9C630.693 2327.9 812.6 2145.99 812.6 1921.6C812.6 1697.21 630.693 1515.3 406.3 1515.3C181.907 1515.3 0 1697.21 0 1921.6C0 2145.99 181.907 2327.9 406.3 2327.9Z" fill="#34A853"/>
</svg>

After

Width:  |  Height:  |  Size: 706 B

@ -231,6 +231,29 @@ const Content = {
return technologies return technologies
}, []) }, [])
// Detect Google Ads
if (/^(www\.)?google(\.[a-z]{2,3}){1,2}$/.test(location.hostname)) {
const ads = document.querySelectorAll('#tads [data-text-ad] a[data-pcu]')
for (const ad of ads) {
Content.driver('detectTechnology', [ad.href, 'Google Ads'])
}
}
// Detect Microsoft Ads
if (/^(www\.)?bing\.com$/.test(location.hostname)) {
const ads = document.querySelectorAll('.b_ad .b_adurl cite')
for (const ad of ads) {
const url = ad.textContent.split(' ')[0].trim()
Content.driver('detectTechnology', [
url.startsWith('http') ? url : `http://${url}`,
'Microsoft Advertising',
])
}
}
Content.driver('analyzeDom', [location.href, dom]) Content.driver('analyzeDom', [location.href, dom])
}, },
} }

@ -8,6 +8,7 @@ const {
analyze, analyze,
analyzeManyToMany, analyzeManyToMany,
resolve, resolve,
getTechnology,
} = Wappalyzer } = Wappalyzer
const { agent, promisify, getOption, setOption, open } = Utils const { agent, promisify, getOption, setOption, open } = Utils
@ -79,10 +80,10 @@ const Driver = {
'https://www.wappalyzer.com/installed/?utm_source=installed&utm_medium=extension&utm_campaign=wappalyzer' 'https://www.wappalyzer.com/installed/?utm_source=installed&utm_medium=extension&utm_campaign=wappalyzer'
) )
} else if (version !== previous && upgradeMessage) { } else if (version !== previous && upgradeMessage) {
// open( open(
// `https://www.wappalyzer.com/upgraded/?utm_source=upgraded&utm_medium=extension&utm_campaign=wappalyzer`, `https://www.wappalyzer.com/upgraded/?utm_source=upgraded&utm_medium=extension&utm_campaign=wappalyzer`,
// false false
// ) )
} }
await setOption('version', version) await setOption('version', version)
@ -211,6 +212,19 @@ const Driver = {
) )
}, },
/**
* Force a technology detection by URL and technology name
* @param {String} url
* @param {String} name
*/
detectTechnology(url, name) {
const technology = getTechnology(name)
return Driver.onDetect(url, [
{ technology, pattern: { regex: '', confidence: 100 }, version: '' },
])
},
/** /**
* Enable scripts to call Driver functions through messaging * Enable scripts to call Driver functions through messaging
* @param {Object} message * @param {Object} message
@ -411,7 +425,13 @@ const Driver = {
await Driver.setIcon(url, resolved) await Driver.setIcon(url, resolved)
if (url) { if (url) {
const tabs = await promisify(chrome.tabs, 'query', { url }) let tabs = []
try {
tabs = await promisify(chrome.tabs, 'query', { url })
} catch (error) {
// Continue
}
tabs.forEach(({ id }) => (Driver.cache.tabs[id] = resolved)) tabs.forEach(({ id }) => (Driver.cache.tabs[id] = resolved))
} }
@ -454,34 +474,38 @@ const Driver = {
return return
} }
;(await promisify(chrome.tabs, 'query', { url })).forEach( let tabs = []
({ id: tabId }) => {
chrome.browserAction.setBadgeText(
{
tabId,
text:
badge && technologies.length
? technologies.length.toString()
: '',
},
() => {}
)
chrome.browserAction.setIcon( try {
{ tabs = await promisify(chrome.tabs, 'query', { url })
tabId, } catch (error) {
path: chrome.extension.getURL( // Continue
`../images/icons/${ }
/\.svg$/i.test(icon)
? `converted/${icon.replace(/\.svg$/, '.png')}` tabs.forEach(({ id: tabId }) => {
: icon chrome.browserAction.setBadgeText(
}` {
), tabId,
}, text:
() => {} badge && technologies.length ? technologies.length.toString() : '',
) },
} () => {}
) )
chrome.browserAction.setIcon(
{
tabId,
path: chrome.extension.getURL(
`../images/icons/${
/\.svg$/i.test(icon)
? `converted/${icon.replace(/\.svg$/, '.png')}`
: icon
}`
),
},
() => {}
)
})
}, },
/** /**

@ -3,11 +3,11 @@
;(function () { ;(function () {
try { try {
const onMessage = ({ data }) => { const onMessage = ({ data }) => {
if (!data.wappalyzer) { if (!data.wappalyzer || !data.wappalyzer.technologies) {
return return
} }
const { technologies } = data.wappalyzer || {} const { technologies } = data.wappalyzer
removeEventListener('message', onMessage) removeEventListener('message', onMessage)

@ -6997,6 +6997,26 @@
"scripts": "js/gogs\\.js", "scripts": "js/gogs\\.js",
"website": "http://gogs.io" "website": "http://gogs.io"
}, },
"Microsoft Advertising": {
"cats": [
36
],
"description": "Microsoft Advertising is an online advertising platform developed by Microsoft.",
"icon": "Microsoft.svg",
"saas": true,
"pricing": ["payg"],
"website": "https://ads.microsoft.com"
},
"Google Ads": {
"cats": [
36
],
"description": "Google Ads is an online advertising platform developed by Google.",
"icon": "Google Ads.svg",
"saas": true,
"pricing": ["payg"],
"website": "https://ads.google.com"
},
"Google AdSense": { "Google AdSense": {
"cats": [ "cats": [
36 36
@ -21094,4 +21114,4 @@
"website": "https://www.xt-commerce.com" "website": "https://www.xt-commerce.com"
} }
} }
} }