Extension Manifest Configuration
{
"manifest_version": 2,
"name": "Social Profile Analyzer (Educational)",
"version": "1.0.0",
"description": "Educational demo for analyzing public social media profiles",
"permissions": [
"activeTab",
"storage"
],
"content_scripts": [{
"matches": ["*://*.facebook.com/*", "*://*.twitter.com/*", "*://*.instagram.com/*"],
"js": ["content.js"]
}],
"browser_action": {
"default_popup": "popup.html",
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"]
}
}
Content Script - Public Data Extraction Only
// Educational: Extract only PUBLICLY visible information
class PublicProfileAnalyzer {
analyzeProfile() {
const data = {
platform: this.detectPlatform(),
publicInfo: this.extractPublicInfo(),
timestamp: new Date().toISOString()
};
// Only extract what's already visible on the page
return data;
}
detectPlatform() {
const hostname = window.location.hostname;
if (hostname.includes('facebook')) return 'Facebook';
if (hostname.includes('twitter')) return 'Twitter';
if (hostname.includes('instagram')) return 'Instagram';
return 'Unknown';
}
extractPublicInfo() {
// Example: Get profile name from public elements
const nameElement = document.querySelector('h1, [data-testid="UserName"]');
const bioElement = document.querySelector('[data-testid="UserDescription"], .bio');
const followersElement = document.querySelector('[data-testid="UserFollowers"]');
return {
displayName: nameElement?.textContent || 'Not found',
bio: bioElement?.textContent?.substring(0, 100) || 'Not found',
followers: followersElement?.textContent || 'Not found'
};
}
}
// Initialize when page loads
window.addEventListener('load', () => {
const analyzer = new PublicProfileAnalyzer();
console.log('Educational: Analyzing public profile data only');
});
Background Script - Service Worker
// background.js - Extension background service
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.action === 'analyzePublicProfile') {
// Log for educational purposes only
console.log('Educational: Processing public profile request');
// Store data locally with user consent
chrome.storage.local.set({
lastAnalysis: {
...request.data,
timestamp: Date.now(),
source: 'educational_demo'
}
});
sendResponse({status: 'success', data: request.data});
}
if (request.action === 'checkPermissions') {
chrome.permissions.contains({
permissions: ['activeTab']
}, (hasPermission) => {
sendResponse({allowed: hasPermission});
});
}
return true;
});
// Handle extension installation
chrome.runtime.onInstalled.addListener(() => {
console.log('Educational Extension Installed');
chrome.storage.local.set({
educationalMode: true,
privacyNoticeShown: false
});
});