Domain 1Recon & ReportingCORE

Social Media Reconnaissance

Comprehensive guide to social media reconnaissance techniques for OSCP, covering platform-specific intelligence gathering on LinkedIn, GitHub, Twitter/X, and other platforms, username enumeration tools, employee information harvesting, and legal/ethical boundaries.

Domain: Domain 1: Reconnaissance & Reporting•Updated: 2026-09-01
#social-media#github#linkedin#username-enumeration

Social Media Reconnaissance

Attack Chain Position

graph LR
    A[Target Identification] --> B[OSINT Collection]
    B --> C[Social Media Recon]
    C --> D[Employee Intelligence]
    D --> E[Technical Discovery]
    E --> F[Attack Planning]
    C --> G[Username Enumeration]
    G --> D
    C --> H[GitHub Recon]
    H --> E
    style C fill:#f9d56e,stroke:#333,stroke-width:2px

Social media reconnaissance is a critical component of modern OSINT (Open Source Intelligence) gathering. It provides access to:

  • Employee information — Names, roles, relationships, and technical skills
  • Technical disclosures — Stack information, project details, and configurations
  • Organizational structure — Reporting lines, departments, and team compositions
  • Security posture indicators — Security awareness, training, and practices
  • Social engineering material — Personal details for crafting targeted attacks

Table of Contents

  1. Social Media Platforms for Recon
  2. GitHub Reconnaissance Deep Dive
  3. Username Enumeration
  4. LinkedIn Reconnaissance Techniques
  5. Twitter/X Intelligence Gathering
  6. Employee Information Harvesting
  7. Tech Stack Discovery from Social Media
  8. Social Engineering Preparation
  9. Legal and Ethical Boundaries
  10. Social Media Recon in OSCP Context
  11. Automating Social Media Recon

1. Social Media Platforms for Recon

Platform Overview and Value Assessment

Platform Primary Value Data Types Access Level OSCP Relevance
LinkedIn Employee intelligence Names, roles, skills, connections Public profiles High
GitHub Technical intelligence Code, configs, credentials, repos Public repos Very High
Twitter/X Real-time intelligence Posts, threads, retweets, lists Public tweets Medium
Facebook Personal intelligence Photos, friends, interests, groups Varies by privacy Low
Instagram Visual intelligence Photos, stories, location tags Varies by privacy Low
YouTube Training/content intel Videos, comments, channel info Public Low
Reddit Community intelligence Posts, comments, subreddits Public Medium
Glassdoor Company intelligence Reviews, salaries, interviews Public Medium

LinkedIn Reconnaissance

What You Can Find

  • Employee names and titles — Full organizational chart
  • Skills and certifications — Technical capabilities of staff
  • Education and experience — Background information
  • Connections — Network relationships and influence
  • Posts and activity — Interests, opinions, and technical discussions
  • Company pages — Employee count, growth, and technology stack

Manual LinkedIn Techniques

Step 1: Search for the company
- Navigate to linkedin.com/company/[company-name]
- Note employee count and growth trends
- Check "People" tab for employee listings

Step 2: Filter employees by role
- Use filters: "People" → "[Company Name]" → "Current"
- Filter by keywords: "engineer", "developer", "admin", "security"
- Sort by "Most relevant" or "Recent"

Step 3: Analyze individual profiles
- Check skills section for technologies used
- Review experience timeline for role changes
- Note certifications (security-related especially)
- Check posts for technical discussions

Step 4: Map organizational structure
- Identify reporting relationships
- Note department heads and team leads
- Track career progression patterns

LinkedIn Search Operators

Operator Syntax Example
Company filter company:"Company Name" Find employees at specific company
Title filter title:"Security Engineer" Find specific roles
Location filter location:"New York" Filter by geography
School filter school:"MIT" Filter by education
Keyword search keywords:"pentest" Search profile content

LinkedIn URL Patterns

# Company page
https://www.linkedin.com/company/[company-name]/

# People search
https://www.linkedin.com/search/results/people/?keywords=[query]&company=[company-id]

# Specific person
https://www.linkedin.com/in/[username]/

# Company employees
https://www.linkedin.com/search/results/people/?currentCompany=[company-id]

# Company posts
https://www.linkedin.com/feed/?searchParam=%7B%22entityKey%22%3A%22company%3A[company-id]%22%7D

Twitter/X Reconnaissance

What You Can Find

  • Employee tweets — Technical opinions, project updates, complaints
  • Company accounts — Announcements, hiring posts, tech stack mentions
  • Hashtag monitoring — Industry events, conferences, challenges
  • Lists — Curated lists of security researchers, developers
  • Thread analysis — Deep technical discussions and tutorials

Twitter Search Techniques

# Search for employees tweeting about work
from:[employee_handle] work project

# Search for company mentions
@[company_handle]

# Search for technical disclosures
@[company_handle] API key token password

# Search for conference attendance
[company_name] DEFCON BlackHat BSides

# Search for hiring posts
@[company_handle] hiring engineer developer

# Search for complaints (potential security issues)
@[company_handle] down outage broken error

Twitter Advanced Search Operators

Operator Description Example
from: Tweets from specific user from:twitterhandle
to: Tweets directed to user to:twitterhandle
@ Mentions of user @twitterhandle
# Hashtag #pentest
url: Tweets with links url:github.com
filter:links Only tweets with links company filter:links
filter:videos Only tweets with videos company filter:videos
since: / until: Date range since:2024-01-01 until:2024-12-31
min_faves: Minimum favorites min_faves:100
lang: Language filter lang:en

Facebook Reconnaissance

What You Can Find

  • Personal information — Hometown, education, relationship status
  • Photos and tags — Location data, events, colleagues
  • Groups — Professional and interest-based communities
  • Pages — Company pages with employee connections
  • Events — Conference attendance, company events

Facebook Search Techniques

# Search for company employees
- Go to Facebook search
- Type "[Company Name]" → Filter by "People"
- Check "Work" section for company affiliation

# Search for groups
- Search "[Company Name] employees"
- Search "[Industry] professionals [City]"
- Look for alumni groups from target's universities

# Photo analysis
- Check tagged photos for location data
- Look for badge photos at conferences
- Check event photos for colleague identification

Instagram Reconnaissance

What You Can Find

  • Location tags — Physical locations of employees
  • Photos — Office environments, equipment, screens
  • Stories — Real-time activity and location
  • Followers/Following — Social connections and influence

Instagram Search Techniques

# Search by location
- Use location search for office addresses
- Check geotagged photos near target locations

# Search by hashtag
- #[companyname]
- #[companyname]life
- #[industry] #[city]

# Profile analysis
- Check bio for job title and company
- Review followers for colleagues
- Check tagged photos for context

YouTube Reconnaissance

What You Can Find

  • Training videos — Internal tools and processes
  • Conference talks — Technical presentations by employees
  • Product demos — Software and infrastructure details
  • Channel descriptions — Company information and links

YouTube Search Techniques

# Search for company presentations
youtube-dl --flat-search "site:youtube.com [company name] presentation"

# Search for technical talks
youtube-dl --flat-search "site:youtube.com [company name] tech talk"

# Search for employee channels
youtube-dl --flat-search "site:youtube.com [employee name]"

# Extract video descriptions for links
youtube-dl --dump-json "VIDEO_ID" | python3 -m json.tool

Reddit Reconnaissance

What You Can Find

  • Employee posts — Work-related discussions and complaints
  • Technical questions — Stack information and troubleshooting
  • Company subreddits — Employee communities
  • Industry subreddits — Technical discussions and opinions

Reddit Search Techniques

# Search for company mentions
site:reddit.com [company name]

# Search for employee posts
site:reddit.com user:[username]

# Search for technical discussions
site:reddit.com/r/netsec [company name]
site:reddit.com/r/cybersecurity [company name]

# Search for specific subreddits
reddit.com/r/[companyname]
reddit.com/r/[industry][city]

Glassdoor Reconnaissance

What You Can Find

  • Employee reviews — Company culture, management, security practices
  • Interview questions — Technical requirements and expectations
  • Salary information — Compensation data for roles
  • CEO approval ratings — Leadership sentiment

Glassdoor Search Techniques

# Company overview
glassdoor.com/Overview/[Company-Name]

# Employee reviews
glassdoor.com/Reviews/[Company-Name]

# Interview experiences
glassdoor.com/Interview/[Company-Name]

# Salaries
glassdoor.com/Salaries/[Company-Name]

# CEO approval
glassdoor.com/CeoApprovalRatings/[Company-Name]

2. GitHub Reconnaissance Deep Dive

Why GitHub is Critical for Recon

GitHub is arguably the most valuable social media platform for technical reconnaissance because:

  1. Code exposure — Source code may contain credentials, configurations, and logic
  2. Infrastructure as Code — Terraform, Ansible, and Docker files reveal architecture
  3. Documentation — READMEs and wikis describe systems and processes
  4. Issue tracking — Bug reports reveal vulnerabilities and weaknesses
  5. Pull requests — Code changes show development patterns and tools
  6. Actions/Workflows — CI/CD pipelines may contain secrets

GitHub Search Operators

Basic Search Operators

Operator Description Example
user: Search by username user:targetorg
org: Search by organization org:targetorg
repo: Search by repository repo:targetorg/repo-name
filename: Search by filename filename:.env
extension: Search by file extension extension:py
language: Search by programming language language:Python
path: Search in specific path path:config
in: Search in specific area in:file,path,readme
created: Filter by creation date created:>2024-01-01
pushed: Filter by last push pushed:>2024-01-01
stars: Filter by star count stars:>100
forks: Filter by fork count forks:>10

Advanced Search Queries

# Search for potential credentials
org:targetorg (password OR secret OR token OR api_key OR access_key)

# Search for configuration files
org:targetorg (filename:.env OR filename:config.yml OR filename:settings.py)

# Search for database connections
org:targetorg (mysql:// OR postgresql:// OR mongodb:// OR redis://)

# Search for AWS credentials
org:targetorg (AKIA[0-9A-Z]{16} OR aws_secret_access_key)

# Search for private keys
org:targetorg (BEGIN RSA PRIVATE KEY OR BEGIN OPENSSH PRIVATE KEY)

# Search for hardcoded URLs
org:targetorg (http://10. OR http://192.168. OR http://172.)

# Search for Docker files
org:targetorg filename:Dockerfile

# Search for Terraform files
org:targetorg extension:tf

# Search for Ansible playbooks
org:targetorg extension:yml path:ansible

# Search for Kubernetes manifests
org:targetorg (extension:yml OR extension:yaml) (kind:Deployment OR kind:Service)

GitHub Organization Reconnaissance

Finding Organization Repositories

# List all public repositories for an organization
curl -s "https://api.github.com/orgs/targetorg/repos?per_page=100" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for repo in data:
    print(f'{repo[\"name\"]:30s} | Stars: {repo[\"stargazers_count\"]:5d} | Language: {repo.get(\"language\", \"N/A\"):15s} | Updated: {repo[\"pushed_at\"][:10]}')
"

# Get organization details
curl -s "https://api.github.com/orgs/targetorg" | python3 -m json.tool

# Get organization members
curl -s "https://api.github.com/orgs/targetorg/members?per_page=100" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for member in data:
    print(f'{member[\"login\"]:30s} | Type: {member[\"type\"]} | URL: {member[\"html_url\"]}')
"

# Get organization teams
curl -s "https://api.github.com/orgs/targetorg/teams?per_page=100" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for team in data:
    print(f'{team[\"name\"]:30s} | Privacy: {team[\"privacy\"]:10s} | Members: {team[\"members_count\"]}')
"

Repository Analysis

# Get repository details
curl -s "https://api.github.com/repos/targetorg/repo-name" | python3 -m json.tool

# Get repository languages
curl -s "https://api.github.com/repos/targetorg/repo-name/languages" | python3 -m json.tool

# Get recent commits
curl -s "https://api.github.com/repos/targetorg/repo-name/commits?per_page=30" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for commit in data:
    print(f'{commit[\"sha\"][:8]} | {commit[\"commit\"][\"author\"][\"date\"][:10]} | {commit[\"commit\"][\"message\"][:60]}')
"

# Get issues
curl -s "https://api.github.com/repos/targetorg/repo-name/issues?state=all&per_page=100" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for issue in data:
    print(f'#{issue[\"number\"]:5d} | {issue[\"state\"]:7s} | {issue[\"title\"][:60]}')
"

# Get pull requests
curl -s "https://api.github.com/repos/targetorg/repo-name/pulls?state=all&per_page=100" | \
  python3 -c "
import sys, json
data = json.load(sys.stdin)
for pr in data:
    print(f'#{pr[\"number\"]:5d} | {pr[\"state\"]:7s} | {pr[\"title\"][:60]}')
"

Searching for Leaked Credentials

Common Credential Patterns

# API Keys and Tokens
API_KEY=
API_SECRET=
ACCESS_KEY=
SECRET_KEY=
TOKEN=
BEARER=
Authorization: Bearer

# Database Connections
mysql://
postgresql://
postgres://
mongodb://
redis://
mongodb+srv://

# AWS Credentials
AKIA[0-9A-Z]{16}
aws_access_key_id
aws_secret_access_key

# Private Keys
-----BEGIN RSA PRIVATE KEY-----
-----BEGIN OPENSSH PRIVATE KEY-----
-----BEGIN EC PRIVATE KEY-----
-----BEGIN DSA PRIVATE KEY-----

# Cloud Provider Keys
GOOGLE_API_KEY=
AZURE_TENANT=
CLOUDFLARE_API_KEY=

# Service Tokens
SLACK_TOKEN=
TWILIO_AUTH_TOKEN=
SENDGRID_API_KEY=
STRIPE_SECRET_KEY=

GitHub Search for Credentials

# Search for .env files
org:targetorg filename:.env

# Search for config files with secrets
org:targetorg (filename:config OR filename:settings) (password OR secret OR token)

# Search for AWS keys
org:targetorg AKIA[0-9A-Z]{16}

# Search for private keys
org:targetorg "BEGIN PRIVATE KEY"

# Search for database URLs
org:targetorg (mysql:// OR postgresql:// OR mongodb://)

# Search for hardcoded passwords
org:targetorg (password = OR password: OR pwd =)

GitLeaks and TruffleHog

GitLeaks

GitLeaks scans Git repositories for secrets using a comprehensive rule set.

# Install GitLeaks
# Download from: https://github.com/zricethezav/gitleaks/releases

# Clone and scan a repository
git clone https://github.com/targetorg/repo-name.git
cd repo-name
gitleaks detect --report-format json --report-path gitleaks_report.json

# Scan without cloning (using GitHub API)
gitleaks detect --source https://github.com/targetorg/repo-name --report-format json

# Scan with verbose output
gitleaks detect --source https://github.com/targetorg/repo-name -v

# Scan specific rules
gitleaks detect --source https://github.com/targetorg/repo-name --rules rules/gitleaks.toml

# View results
cat gitleaks_report.json | python3 -m json.tool

TruffleHog

TruffleHog searches through Git repositories for high entropy strings and secrets.

# Install TruffleHog
pip3 install trufflehog

# Scan a Git repository
trufflehog git file:///path/to/cloned/repo --json --output trufflehog_report.json

# Scan a GitHub repository
trufflehog git https://github.com/targetorg/repo-name --json --output trufflehog_report.json

# Scan with context
trufflehog git https://github.com/targetorg/repo-name --max_depth 20 --entropy=False

# Scan only recent commits
trufflehog git https://github.com/targetorg/repo-name --since 2024-01-01

# Scan for specific patterns
trufflehog git https://github.com/targetorg/repo-name --regex "AKIA[0-9A-Z]{16}"

# View results
cat trufflehog_report.json | python3 -m json.tool

Comparing GitLeaks vs TruffleHog

Feature GitLeaks TruffleHog
Detection Method Rule-based patterns Entropy + regex
Speed Fast Slower (entropy calculation)
False Positives Lower Higher
Custom Rules Yes (TOML) Yes (regex)
Git History Full history Full history
GitHub API Limited Full support
Best For Quick scanning Deep analysis

GitHub API Rate Limits

Authentication Rate Limit Window
Unauthenticated 60 requests Per hour
Authenticated 5,000 requests Per hour
GitHub App 5,000 requests Per hour
# Check remaining API calls
curl -s "https://api.github.com/rate_limit" | python3 -c "
import sys, json
data = json.load(sys.stdin)
core = data['resources']['core']
print(f'Remaining: {core[\"remaining\"]}/{core[\"limit\"]}')
print(f'Resets at: {core[\"reset\"]}')
"

# Use authentication for higher limits
curl -s "https://api.github.com/rate_limit" \
  -H "Authorization: token YOUR_GITHUB_TOKEN" | python3 -m json.tool

GitHub Archive and Alternatives

# GitHub Archive (bigquery)
# Historical data of all GitHub events
# https://www.githubarchive.org/

# Grep.app (GitHub code search alternative)
# https://grep.app/search?q=password&repo=targetorg/repo

# CodeSearch (alternative search engine)
# https://codesearch.dev/

# Searchcode
# https://searchcode.com/

3. Username Enumeration

What is Username Enumeration?

Username enumeration is the process of discovering valid usernames across multiple platforms. Valid usernames can be used for:

  • Credential stuffing attacks — Try known passwords across platforms
  • Password spraying — Try common passwords against discovered usernames
  • Social engineering — Craft targeted attacks using known identities
  • Account takeover — Exploit weak passwords or recovery mechanisms

Sherlock

Sherlock is the most popular tool for username enumeration across social media platforms.

# Install Sherlock
git clone https://github.com/sherlock-project/sherlock.git
cd sherlock
pip3 install -r requirements.txt

# Basic usage
python3 sherlock username123

# Output to file
python3 sherlock username123 -o results.json

# Verbose output
python3 sherlock username123 -v

# All platforms (including less common ones)
python3 sherlock username123 --all

# Specific platforms
python3 sherlock username123 -f LinkedIn,GitHub,Twitter

# Multiple usernames from file
python3 sherlock -f usernames.txt

# Output formats
python3 sherlock username123 -oJ results.json    # JSON
python3 sherlock username123 -oC results.csv      # CSV
python3 sherlock username123 -oT results.tsv      # TSV

# Proxy support
python3 sherlock username123 -p http://127.0.0.1:8080

# Tor support
python3 sherlock username123 --tor

# Verify results (reduces false positives)
python3 sherlock username123 --verify

Sherlock Output Interpretation

[+] Checking username username123 on:

LinkedIn:
[+] LinkedIn: https://www.linkedin.com/in/username123 (200)

GitHub:
[-] GitHub: Not found on this website. (404)

Twitter:
[+] Twitter: https://twitter.com/username123 (200)

Summary:
[+] Username found on 2 site(s):
    - LinkedIn: https://www.linkedin.com/in/username123
    - Twitter: https://twitter.com/username123

Sherlock Platform Coverage

Sherlock supports 300+ platforms including:

Category Platforms
Social LinkedIn, Twitter, Facebook, Instagram, Reddit, TikTok
Developer GitHub, GitLab, Bitbucket, StackOverflow, DeviantArt
Gaming Steam, Xbox, PlayStation, Nintendo, Twitch
Forums Various forum platforms and communities
Marketplace Etsy, eBay, Amazon Seller
Audio/Video YouTube, SoundCloud, Spotify, Vimeo
Professional Medium, Substack, Behance, Dribbble

UserRecon

UserRecon is another username enumeration tool with additional features.

# Install UserRecon
git clone https://github.com/thelinuxchoice/userrecon
cd userrecon

# Basic usage
python3 userrecon.py username123

# Features:
# - Username search across platforms
# - Email enumeration from usernames
# - Phone number lookup
# - IP address lookup (if associated)

WhatsMyName

WhatsMyName is a fast username enumeration tool.

# Install WhatsMyName
git clone https://github.com/WebBreacher/WhatsMyName
cd WhatsMyName
npm install

# Basic usage
node index.js -s username123

# Multiple usernames
node index.js -s username123,username456

# From file
node index.js -f usernames.txt

# Output to file
node index.js -s username123 -o results.json

# Verbose mode
node index.js -s username123 -v

Username Enumeration Workflow

graph TD
    A[Target Company] --> B[Collect Names from LinkedIn]
    B --> C[Generate Username Variations]
    C --> D[Run Sherlock/UserRecon]
    D --> E[Validate Results]
    E --> F[Map Usernames to Platforms]
    F --> G[Identify Attack Vectors]
    C --> H[Common Patterns]
    H --> D

Username Pattern Generation

#!/usr/bin/env python3
"""
Generate username variations from a full name.
"""

def generate_usernames(first_name, last_name):
    """Generate common username patterns from a name."""
    first = first_name.lower().strip()
    last = last_name.lower().strip()
    
    patterns = [
        f"{first}{last}",           # johnsmith
        f"{first[0]}{last}",        # jsmith
        f"{first}.{last}",          # john.smith
        f"{first}_{last}",          # john_smith
        f"{last}{first}",           # smithjohn
        f"{last}{first[0]}",        # smithj
        f"{first}{last[0]}",        # johns
        f"{first}{last}1",          # johnsmith1
        f"{first}{last}2024",       # johnsmith2024
        f"{first}.{last}@",         # john.smith@
        f"{first}_{last}_",         # john_smith_
        f"{last}{first[0]}.",       # smithj.
        f"{first}{last[0]}.",       # johns.
        f"{first}{last}_",          # johnsmith_
        f"_{first}{last}",          # _johnsmith
        f"{first}{last}_",          # johnsmith_
        f"{first}{last}01",         # johnsmith01
        f"{first}{last}99",         # johnsmith99
    ]
    
    return list(set(patterns))

# Example usage
if __name__ == "__main__":
    usernames = generate_usernames("John", "Smith")
    for u in usernames:
        print(u)

Common Username Patterns by Platform

Platform Common Pattern Example
GitHub firstname_lastname john_smith
LinkedIn firstname-lastname john-smith
Twitter @firstname_lastname @john_smith
Email first.last@company.com john.smith@company.com
Email firstlast@company.com johnsmith@company.com
Email f.last@company.com j.smith@company.com
Email first_initiallastname@company.com jsmith@company.com

4. LinkedIn Reconnaissance Techniques

Boolean Search Operators

# AND operator (implicit in LinkedIn)
"Security Engineer" "Cloud" "AWS"

# OR operator
"Security Engineer" OR "Penetration Tester" OR "Pentester"

# NOT operator (using -)
"Engineer" -"Software" -"Mechanical"

# Exact phrase
"Penetration Testing"

# Grouping
("Security" OR "Cybersecurity") AND ("Engineer" OR "Analyst")

LinkedIn Sales Navigator (if available)

# Advanced filters
- Company size
- Industry
- Seniority level
- Function
- Years at company
- Years in title
- Groups
- Skills

LinkedIn Profile Analysis

Information to Extract

Field Value Use Case
Full Name Identity confirmation Social engineering
Headline Current role and skills Target identification
About Background and expertise Attack vector planning
Experience Career history Organizational mapping
Skills Technical capabilities Vulnerability targeting
Certifications Security credentials Skill assessment
Education University and degree Alumni connections
Recommendations Colleague relationships Social graph mapping
Activity Posts and comments Interest and opinion analysis

LinkedIn Automation Tools

linkedin-api (Python)

# Install linkedin-api
pip3 install linkedin-api

# Example usage
from linkedin_api import Linkedin

api = Linkedin('email', 'password')

# Search for people
people = api.search_people(
    keywords="Security Engineer",
    companies=["Target Company"],
    limit=100
)

for person in people:
    print(f"{person.get('firstName')} {person.get('lastName')} - {person.get('headline')}")

# Get company info
company = api.get_company("target-company")
print(f"Employees: {company.get('employeeCount')}")

linkedin-recruiter (Python)

# Install
pip3 install linkedin-recruiter

# Example usage
from linkedin_recruiter import Recruiter

recruiter = Recruiter('email', 'password')

# Search for employees
results = recruiter.search(
    company="Target Company",
    title="Engineer",
    location="United States"
)

for result in results:
    print(f"{result['name']} - {result['title']}")

LinkedIn Data Export

#!/usr/bin/env python3
"""
Export LinkedIn search results to CSV.
"""
import csv
import json

def export_to_csv(data, filename):
    """Export LinkedIn data to CSV."""
    if not data:
        print("No data to export")
        return
    
    # Get all unique keys
    keys = set()
    for item in data:
        keys.update(item.keys())
    
    with open(filename, 'w', newline='', encoding='utf-8') as f:
        writer = csv.DictWriter(f, fieldnames=sorted(keys))
        writer.writeheader()
        for item in data:
            writer.writerow(item)
    
    print(f"Exported {len(data)} records to {filename}")

# Example usage
if __name__ == "__main__":
    # Sample data structure
    sample_data = [
        {
            "name": "John Smith",
            "title": "Security Engineer",
            "company": "Target Corp",
            "location": "New York, NY",
            "profile_url": "https://linkedin.com/in/johnsmith"
        }
    ]
    export_to_csv(sample_data, "linkedin_results.csv")

5. Twitter/X Intelligence Gathering

Twitter Intelligence Techniques

Monitoring Company Accounts

# Use Twitter API (requires developer account)
# Or use nitter instances for anonymous browsing

# Nitter instances
https://nitter.net/[username]
https://nitter.poast.org/[username]
https://nitter.privacydev.net/[username]

# Search for company tweets
https://nitter.net/search?q=from:companyhandle&f=tweets

# Search for mentions
https://nitter.net/search?q=@companyhandle&f=tweets

Twitter List Analysis

# Find relevant lists
- Search for lists containing target employees
- Check "Security Researchers" lists
- Check "Infosec" lists
- Check industry-specific lists

# Create your own lists
- Add target employees to a list
- Monitor list activity
- Track new members

Twitter Advanced Search URL

# Basic search
https://twitter.com/search?q=[query]&src=typed_query

# Advanced search
https://twitter.com/search-advanced

# Date range search
https://twitter.com/search?q=[query]&f=live

# Media search
https://twitter.com/search?q=[query]&f=media

Twitter API Usage

#!/usr/bin/env python3
"""
Twitter API example for intelligence gathering.
"""
import tweepy

# Authentication
API_KEY = "YOUR_API_KEY"
API_SECRET = "YOUR_API_SECRET"
ACCESS_TOKEN = "YOUR_ACCESS_TOKEN"
ACCESS_SECRET = "YOUR_ACCESS_SECRET"

auth = tweepy.OAuth1UserHandler(API_KEY, API_SECRET, ACCESS_TOKEN, ACCESS_SECRET)
api = tweepy.API(auth)

# Search for tweets
def search_tweets(query, count=100):
    tweets = tweepy.Cursor(api.search_tweets, q=query, lang="en", tweet_mode="extended").items(count)
    results = []
    for tweet in tweets:
        results.append({
            "id": tweet.id,
            "text": tweet.full_text,
            "user": tweet.user.screen_name,
            "created_at": str(tweet.created_at),
            "retweets": tweet.retweet_count,
            "likes": tweet.favorite_count
        })
    return results

# Get user timeline
def get_user_timeline(username, count=200):
    tweets = tweepy.Cursor(api.user_timeline, screen_name=username, tweet_mode="extended").items(count)
    results = []
    for tweet in tweets:
        results.append({
            "id": tweet.id,
            "text": tweet.full_text,
            "created_at": str(tweet.created_at),
            "retweets": tweet.retweet_count,
            "likes": tweet.favorite_count
        })
    return results

# Example usage
if __name__ == "__main__":
    # Search for company mentions
    results = search_tweets("from:companyhandle OR @companyhandle", count=50)
    for r in results[:10]:
        print(f"@{r['user']}: {r['text'][:100]}")

6. Employee Information Harvesting

Systematic Employee Discovery

Step 1: LinkedIn Employee List

# Manual process:
# 1. Go to LinkedIn company page
# 2. Click "People" tab
# 3. Export or manually collect:
#    - Name
#    - Title
#    - Location
#    - Profile URL

Step 2: Website “About Us” and “Team” Pages

# Common pages to check
https://target.com/about
https://target.com/team
https://target.com/people
https://target.com/staff
https://target.com/leadership
https://target.com/contact

# Use Google Dorking
site:target.com "about us"
site:target.com "meet the team"
site:target.com "our people"
site:target.com "leadership team"

Step 3: Press Releases and News

# Search for employee mentions in news
site:prnewswire.com "target company"
site:businesswire.com "target company"

# Search for conference speakers
site:target.com "speaker"
site:target.com "presenting at"

Step 4: Professional Directories

# Common directory pages
https://target.com/directory
https://target.com/staff-directory
https://target.com/employee-directory

# Check for exposed directories
https://target.com/employees/
https://target.com/users/
https://target.com/profile/

Employee Information Matrix

Source Data Available Reliability Effort
LinkedIn Name, title, skills, connections High Medium
Company Website Name, title, bio, photo High Low
Press Releases Name, title, quotes High Low
GitHub Username, commits, repos Medium Medium
Twitter Username, opinions, activity Medium Medium
Conference Sites Name, title, bio, photo High Medium
Professional Directories Name, title, contact info High Low
Email Signatures Name, title, phone, email High Medium

Building an Employee Database

#!/usr/bin/env python3
"""
Build a comprehensive employee database from multiple sources.
"""
import csv
import json
from collections import defaultdict

class EmployeeDatabase:
    def __init__(self):
        self.employees = {}
    
    def add_employee(self, name, data=None):
        """Add or update employee record."""
        if name not in self.employees:
            self.employees[name] = {
                "name": name,
                "title": "",
                "email": "",
                "linkedin": "",
                "github": "",
                "twitter": "",
                "phone": "",
                "location": "",
                "skills": [],
                "sources": []
            }
        
        if data:
            for key, value in data.items():
                if key in self.employees[name]:
                    if isinstance(self.employees[name][key], list):
                        if value and value not in self.employees[name][key]:
                            self.employees[name][key].append(value)
                    elif not self.employees[name][key] and value:
                        self.employees[name][key] = value
    
    def export_csv(self, filename):
        """Export database to CSV."""
        if not self.employees:
            return
        
        keys = list(self.employees[list(self.employees.keys())[0]].keys())
        
        with open(filename, 'w', newline='', encoding='utf-8') as f:
            writer = csv.DictWriter(f, fieldnames=keys)
            writer.writeheader()
            for emp in self.employees.values():
                row = emp.copy()
                # Convert lists to strings for CSV
                for key in row:
                    if isinstance(row[key], list):
                        row[key] = ", ".join(row[key])
                writer.writerow(row)
    
    def export_json(self, filename):
        """Export database to JSON."""
        with open(filename, 'w', encoding='utf-8') as f:
            json.dump(list(self.employees.values()), f, indent=2, ensure_ascii=False)

# Example usage
if __name__ == "__main__":
    db = EmployeeDatabase()
    
    # Add employees from various sources
    db.add_employee("John Smith", {
        "title": "Security Engineer",
        "linkedin": "linkedin.com/in/johnsmith",
        "github": "johnsmith",
        "email": "john.smith@target.com",
        "skills": ["Python", "AWS", "Penetration Testing"]
    })
    
    db.export_csv("employees.csv")
    db.export_json("employees.json")

7. Tech Stack Discovery from Social Media

Discovering Technology Stack

From GitHub

# Check repository languages
curl -s "https://api.github.com/repos/targetorg/repo-name/languages" | python3 -m json.tool

# Check dependencies
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/package.json" | python3 -m json.tool
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/requirements.txt"
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/Gemfile"
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/composer.json"

# Check CI/CD configuration
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/.github/workflows/main.yml"
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/Jenkinsfile"
curl -s "https://raw.githubusercontent.com/targetorg/repo-name/main/.travis.yml"

From LinkedIn

# Check employee skills sections
# Look for:
# - Programming languages
# - Frameworks
# - Databases
# - Cloud platforms
# - DevOps tools
# - Security tools

From Twitter

# Search for tech stack mentions
from:companyhandle OR @companyhandle (tech stack OR technology OR using OR built with)

# Search for conference talks
from:companyhandle (conference OR talk OR presentation OR demo)

Technology Stack Matrix

Technology Category What to Look For Where to Find
Languages Python, Java, JavaScript, Go, Rust GitHub, LinkedIn skills
Frameworks React, Django, Spring, Express GitHub repos, job postings
Databases PostgreSQL, MongoDB, Redis GitHub configs, LinkedIn
Cloud AWS, Azure, GCP GitHub IaC, LinkedIn
DevOps Docker, Kubernetes, Jenkins GitHub workflows, LinkedIn
Security WAF, SIEM, EDR Job postings, LinkedIn
Monitoring Datadog, Prometheus, Grafana GitHub configs, job postings

8. Social Engineering Preparation

Using Social Media for Social Engineering

Information to Collect

Information Type Source Use Case
Full Name LinkedIn, Twitter Personalization
Job Title LinkedIn, Company Website Authority exploitation
Reporting Structure LinkedIn, Org charts Chain of command
Interests/Hobbies Twitter, Facebook, Instagram Rapport building
Education LinkedIn, University pages Alumni connections
Family Facebook, Instagram Emotional manipulation
Location Twitter, Instagram, LinkedIn Physical proximity
Travel Plans Twitter, Facebook Timing attacks
Tech Preferences GitHub, Twitter Technical pretext
Complaints Twitter, Glassdoor Exploiting frustration

Pretext Development

Step 1: Research the target
- Collect all available information
- Map relationships and connections
- Identify interests and pain points

Step 2: Develop the pretext
- Choose a believable scenario
- Align with target's role and responsibilities
- Use collected information for personalization

Step 3: Craft the message
- Use the target's name and title
- Reference mutual connections or interests
- Create urgency or relevance
- Include a clear call to action

Step 4: Test and refine
- Check for consistency
- Verify all details are accurate
- Ensure the pretext is believable

Social Engineering Attack Vectors

Vector Social Media Source Example
Phishing LinkedIn, Twitter “Hi John, I saw your post about…”
Spear Phishing All platforms Highly personalized using collected intel
Whaling LinkedIn (executives) Targeting C-level executives
Baiting Twitter, Reddit “Check out this tool for [their tech stack]”
Tailgating Instagram, Facebook “I work with [colleague’s name]”
Pretexting LinkedIn, Company Website “I’m from [vendor] about your [service]”

Activity Legal Status Notes
Viewing public profiles Generally legal Public information is fair game
Scraping public data Gray area Check ToS and local laws
Creating fake accounts Potentially illegal Violates ToS, may violate CFAA
Accessing private data Illegal Never access non-public information
Credential stuffing Illegal Unauthorized access attempt
Social engineering Illegal (if unauthorized) Requires explicit authorization

Ethical Guidelines

  1. Only use publicly available information — Never hack or bypass access controls
  2. Respect privacy settings — Don’t try to access private profiles
  3. Follow terms of service — Be aware of platform restrictions
  4. Get proper authorization — Only conduct recon on authorized targets
  5. Document your methods — Keep records of what you found and how
  6. Don’t harass targets — Reconnaissance should not involve harassment
  7. Respect rate limits — Don’t overwhelm platforms with requests
  8. Be transparent — In authorized engagements, disclose your methods

OSCP-Specific Ethics

  • OSCP labs are authorized targets — You have permission to enumerate
  • Stay within scope — Only target assigned machines and domains
  • Don’t abuse social media — The labs don’t use real social media
  • Focus on technical recon — Social media recon is supplementary in OSCP

10. Social Media Recon in OSCP Context

OSCP Relevance Assessment

Technique OSCP Relevance Notes
GitHub Recon High Labs may have GitHub-like repos
Username Enumeration Medium Useful for web app testing
LinkedIn Recon Low Not applicable to lab environments
Twitter Recon Low Not applicable to lab environments
Employee Discovery Medium May apply to web applications
Tech Stack Discovery High Helps identify vulnerabilities

OSCP-Social Media Recon Workflow

graph TD
    A[Target Domain] --> B[Check for GitHub Repos]
    B --> C[Search for Leaked Credentials]
    C --> D[Analyze Code for Vulnerabilities]
    A --> E[Check for Employee Pages]
    E --> F[Discover Usernames]
    F --> G[Test for Weak Passwords]
    A --> H[Check for Social Media Links]
    H --> I[Extract Technical Info]
    I --> D

Practical OSCP Commands

# Search for target on GitHub
curl -s "https://api.github.com/search/repositories?q=org:targetorg" | python3 -m json.tool

# Search for leaked credentials in repos
curl -s "https://api.github.com/search/code?q=org:targetorg+filename:.env" | python3 -m json.tool

# Check for exposed directories
gobuster dir -u https://target.com -w /usr/share/wordlists/dirb/common.txt | grep -i "github\|git\|social"

# Search for social media links on the website
curl -s https://target.com | grep -ioE "https?://[a-zA-Z0-9.-]+/(linkedin|twitter|github|facebook|instagram)[a-zA-Z0-9/._-]*"

# Check footer for social media links
curl -s https://target.com | grep -A5 -i "footer\|social\|follow us"

Time Allocation for OSCP

Activity Recommended Time Priority
GitHub recon 15-30 minutes High
Username enumeration 10-20 minutes Medium
Social media link discovery 5-10 minutes Medium
Tech stack analysis 10-15 minutes High
Total 40-75 minutes —

11. Automating Social Media Recon

Comprehensive Recon Script

#!/usr/bin/env python3
"""
Automated social media reconnaissance tool.
"""
import subprocess
import json
import csv
import sys
import time
from datetime import datetime

class SocialMediaRecon:
    def __init__(self, target):
        self.target = target
        self.results = {
            "target": target,
            "timestamp": datetime.now().isoformat(),
            "github": {},
            "usernames": {},
            "social_links": {}
        }
    
    def github_recon(self, org_name):
        """Perform GitHub reconnaissance."""
        print(f"[+] Performing GitHub recon for: {org_name}")
        
        # Get organization info
        try:
            result = subprocess.run(
                ['curl', '-s', f'https://api.github.com/orgs/{org_name}'],
                capture_output=True, text=True, timeout=30
            )
            if result.returncode == 0:
                data = json.loads(result.stdout)
                self.results["github"]["org_info"] = {
                    "name": data.get("name"),
                    "bio": data.get("bio"),
                    "location": data.get("location"),
                    "public_repos": data.get("public_repos"),
                    "public_gists": data.get("public_gists"),
                    "followers": data.get("followers"),
                    "following": data.get("following")
                }
        except Exception as e:
            print(f"[-] GitHub org error: {e}")
        
        # Get repositories
        try:
            result = subprocess.run(
                ['curl', '-s', f'https://api.github.com/orgs/{org_name}/repos?per_page=100'],
                capture_output=True, text=True, timeout=30
            )
            if result.returncode == 0:
                repos = json.loads(result.stdout)
                self.results["github"]["repos"] = []
                for repo in repos:
                    self.results["github"]["repos"].append({
                        "name": repo.get("name"),
                        "language": repo.get("language"),
                        "stars": repo.get("stargazers_count"),
                        "forks": repo.get("forks_count"),
                        "updated": repo.get("pushed_at", "")[:10],
                        "url": repo.get("html_url")
                    })
        except Exception as e:
            print(f"[-] GitHub repos error: {e}")
    
    def username_enum(self, username):
        """Perform username enumeration using Sherlock."""
        print(f"[+] Running Sherlock for: {username}")
        
        try:
            result = subprocess.run(
                ['python3', '/opt/sherlock/sherlock', username, '-oJ', '/tmp/sherlock_results.json'],
                capture_output=True, text=True, timeout=120
            )
            
            if result.returncode == 0:
                try:
                    with open('/tmp/sherlock_results.json', 'r') as f:
                        data = json.load(f)
                        self.results["usernames"][username] = data
                except Exception:
                    pass
        except Exception as e:
            print(f"[-] Sherlock error: {e}")
    
    def find_social_links(self, url):
        """Find social media links on a website."""
        print(f"[+] Scanning {url} for social media links")
        
        social_patterns = [
            'linkedin.com', 'twitter.com', 'github.com',
            'facebook.com', 'instagram.com', 'youtube.com',
            'reddit.com', 'tiktok.com', 'medium.com'
        ]
        
        try:
            result = subprocess.run(
                ['curl', '-s', url],
                capture_output=True, text=True, timeout=30
            )
            
            if result.returncode == 0:
                content = result.stdout
                found = {}
                for pattern in social_patterns:
                    if pattern in content.lower():
                        found[pattern] = True
                self.results["social_links"][url] = found
        except Exception as e:
            print(f"[-] Social link scan error: {e}")
    
    def export_results(self, filename):
        """Export results to JSON."""
        with open(filename, 'w', encoding='utf-8') as f:
            json.dump(self.results, f, indent=2, ensure_ascii=False)
        print(f"[+] Results exported to {filename}")
    
    def run_all(self, org_name=None, usernames=None, urls=None):
        """Run all reconnaissance tasks."""
        if org_name:
            self.github_recon(org_name)
        
        if usernames:
            for username in usernames:
                self.username_enum(username)
                time.sleep(1)  # Rate limiting
        
        if urls:
            for url in urls:
                self.find_social_links(url)
                time.sleep(1)  # Rate limiting
        
        return self.results

# Example usage
if __name__ == "__main__":
    recon = SocialMediaRecon("target.com")
    
    results = recon.run_all(
        org_name="targetorg",
        usernames=["admin", "johnsmith", "jsmith"],
        urls=["https://target.com", "https://www.target.com"]
    )
    
    recon.export_results("social_recon_results.json")

Integration with Other Tools

# Combine social media recon with other OSINT tools

# Step 1: Run theHarvester for emails and subdomains
theHarvester -d target.com -b github,linkedin,twitter -f /tmp/harvester_results

# Step 2: Run Sherlock on discovered usernames
cat /tmp/usernames.txt | while read username; do
    python3 /opt/sherlock/sherlock "$username" -oJ "/tmp/sherlock_${username}.json"
done

# Step 3: Run GitHub recon
curl -s "https://api.github.com/orgs/targetorg/repos?per_page=100" > /tmp/github_repos.json

# Step 4: Combine all results
python3 combine_results.py \
    --harvester /tmp/harvester_results \
    --sherlock /tmp/sherlock_*.json \
    --github /tmp/github_repos.json \
    --output /tmp/final_recon.json

Quick Reference Cheat Sheet

Essential Commands

# GitHub Recon
curl -s "https://api.github.com/orgs/[org]/repos?per_page=100"
curl -s "https://api.github.com/orgs/[org]/members"
shodan search "org:\"Organization Name\""

# Username Enumeration
python3 sherlock [username]
python3 sherlock [username] --verify
node whatsmyname/index.js -s [username]

# LinkedIn Search
# Use browser: linkedin.com/search/results/people/?keywords=[query]

# Twitter Search
# Use browser: twitter.com/search?q=from:[handle]

# Social Media Link Discovery
curl -s https://target.com | grep -ioE "https?://[a-zA-Z0-9.-]+/(linkedin|twitter|github|facebook|instagram)"

# GitLeaks
gitleaks detect --source https://github.com/org/repo

# TruffleHog
trufflehog git https://github.com/org/repo --json

Useful One-Liners

# Find all GitHub repos with potential secrets
curl -s "https://api.github.com/search/code?q=org:targetorg+(password+OR+secret+OR+token)+language:python" | python3 -c "import sys,json; data=json.load(sys.stdin); [print(m['repository']['full_name']) for m in data.get('items',[])]"

# Extract emails from GitHub commits
git log --format='%ae' | sort -u

# Find social media links in HTML
curl -s https://target.com | grep -oP 'href="https?://(linkedin|twitter|github|facebook|instagram)\.com/[^"]*"' | sort -u

# Quick username check across platforms
for platform in github twitter linkedin; do
    curl -s "https://$platform.com/username" | grep -q "not found" && echo "$platform: NOT FOUND" || echo "$platform: FOUND"
done

Summary

Social media reconnaissance is a powerful OSINT technique that provides valuable intelligence for penetration testing. Key takeaways:

  1. LinkedIn is the primary source for employee intelligence and organizational mapping
  2. GitHub is the most valuable platform for technical intelligence and credential discovery
  3. Username enumeration tools like Sherlock help discover accounts across platforms
  4. Twitter/X provides real-time intelligence and technical disclosures
  5. Employee information harvesting combines multiple sources for comprehensive profiles
  6. Tech stack discovery from social media helps identify potential vulnerabilities
  7. Social engineering preparation uses collected intelligence for targeted attacks
  8. Legal and ethical boundaries must always be respected
  9. In OSCP, focus on GitHub recon and username enumeration as primary techniques
  10. Automation tools can streamline the reconnaissance process

Master these techniques to build comprehensive intelligence profiles that inform your attack strategy and increase your chances of successful engagement.