• Stars
    star
    115
  • Rank 305,916 (Top 7 %)
  • Language
    Python
  • Created over 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Minimal set of tools to conduct stealthy scraping.

Stealthy Scraping Tools

Do not use puppeteer and playwright for scraping. Or any other browser automation framework for that matter. Why?

We only use the CDP to obtain the page source and to get the absolute coordinates for an arbitrary CSS selector. That's all what is needed for efficient scraping.

  1. To obtain the page source of the browser's current page. Implemented in page_source.js
  2. To get the absolute coordinates for an arbitrary CSS selector. Implemented in coords.js

Mouse movements and typing is handled by pyautogui or other means, but not with JavaScript or with the CDP! Reason: Browser based mouse and keyboard emulation is very easy detectable!

Theory

  1. Analyzing key strokes: TypeNet: Deep Learning Keystroke Biometrics
  2. Research how to mimic human mouse movements: BeCAPTCHA-Mouse: Synthetic Mouse Trajectories and Improved Bot Detection

Full Example

The bot challenge that can be found here bot.incolumitas.com/#botChallenge will be solved in the following quick tutorial.

The example code can be found in example.py.

I am using an Ubuntu 18.04 system with Python3 (with pipenv) and a recent Node version.

The browser google-chrome must be installed.

Clone the repo:

git clone https://github.com/NikolaiT/stealthy-scraping-tools
cd stealthy-scraping-tools

Activate an environment with:

pew new -p python3 sst

pew workon sst

Then install pyautogui:

pip install pyautogui

Install node modules:

npm install chrome-remote-interface

And then run the bot with:

python example.py

Docker

The Dockerfile is based on Ubuntu 20.04.

The Dockerfile uses xvfb from the python module PyVirtualDisplay.

I use pyautogui for mouse and keyboard automation.

I use fluxbox as a tiny window manager and x11vnc (Virtual Network Computing server program) as a means to inspect the docker image and see what is going on.

Build the Dockerfile:

docker build -t sst:0.0.1 .

Hint: Avoid chrome in docker crashing: stephen-fox/chrome-docker#8

1. Option 1: Run chrome with --disable-dev-shm-usage
2. Option 2: Set /dev/shm size to a reasonable amount `docker run -it --shm-size=1g` replacing 1g with whatever amount you want.

The docker option --shm-size=2g is really important:

docker run --cap-add=NET_ADMIN --network="host" --shm-size=2g sst:0.0.1

TODO

  • Look at Kernel/OS level mouse/keyboard control commands (Ditch pyautogui)
  • Use the math from ghost-cursor
  • Create a set of typign recordings and use it to derive rules for bot writing

More Repositories

1

GoogleScraper

A Python module to scrape several search engines (like Google, Yandex, Bing, Duckduckgo, ...). Including asynchronous networking support.
HTML
2,527
star
2

se-scraper

Javascript scraping module based on puppeteer for many different search engines...
HTML
518
star
3

Crawling-Infrastructure

Distributed crawling infrastructure running on top of severless computation, cloud storage (such as S3) and sophisticated queues.
TypeScript
373
star
4

zardaxt

Passive TCP/IP Fingerprinting Tool. Run this on your server and find out what Operating Systems your clients are *really* using.
Python
198
star
5

uncaptcha3

Update of uncaptcha2 from 2019
Python
158
star
6

struktur

Module that extracts structured information from a rendered html site and outputs JSON. HTML to JSON.
JavaScript
64
star
7

scrapeulous

Cloud crawler functions for scrapeulous
JavaScript
43
star
8

IP-Address-API

Datacenter / Hosting IP Address API - Find out if an IP address belongs to a hosting provider such as AWS, Azure or Digitalocean
37
star
9

adblock-detect-javascript-only

Detecting uBlock Origin and Adblock Plus with JavaScript only
JavaScript
33
star
10

SVG-Captcha

A SVG Captcha library written in PHP with stunning Performance and independence of any third party software!
PHP
22
star
11

incolumitas

my static site blog using pelican
JavaScript
17
star
12

youtube-scraping

A Node library that scrapes YouTube video data
JavaScript
16
star
13

Dragonfly-SAE

Implementation of rfc7664 dragonfly key exchange using ECC
Python
13
star
14

dynamically-changing-puppeteer-proxies

The chrome browser controlled via puppeteer does not support switching proxies without restarting the browser. In this tutorial I show how to implement this functionality with the help of a third party module.
JavaScript
11
star
15

scraping-amazon-reviews

Scraping Amazon reviews using headless chrome and selenium
Python
10
star
16

aws-scraper-example

JavaScript
9
star
17

lichess_cheat

Cheating with stockfish engine for lichess. Works on Windows, Linux and Mac.
Python
8
star
18

Large-Primes-for-RSA

Finding large prime numbers for RSA
Python
8
star
19

chess-com-cheat

Library that hooks into PR_Write() and PR_Read() in firefox processes and manipulates WebSocket Messages to cheat on chess.com
C
8
star
20

Scripts

All my programming(scripting) work which doesn't make it to a standalone project but might be useful for the future...
PHP
7
star
21

db.js

In-Memory Key-Value Database with Persistent File Storage
JavaScript
7
star
22

dragonfuzz

Fuzz the WPA3 SAE authentication. We will fuzz the Auth-Commit frame and the Auth-Confirm frame.
Python
4
star
23

clearcontent

A basic but mighty wordpress theme built on underscore and bootstrap 3
PHP
3
star
24

detecting-brightdata

detecting-brightdata
HTML
3
star
25

proxychecker

Checks the status of an proxy server.
Python
2
star
26

fuzz_sae_hostap

Fuzzing of the sae handshake in hostapd via libFuzzer
C
2
star
27

CunningCaptcha

A simple, but complete (down to vector graphics) captcha implementation class. Wordpress plugin. In the beginning of development. September 2013.
PHP
2
star
28

lichess-bot

Bot playing hyper bullet on lichess
JavaScript
2
star
29

TraversingGraphs

Shows in Python how to traverse graphs with Depth-First-Search and Breadth-First-Search
Python
1
star
30

3proxy-docker

Dockerfile for 3proxy setup
Shell
1
star
31

ChatServer

Chat server in java for uni project
Java
1
star
32

probabilistic-sketches

Various implementations for probabilistic sketches
Python
1
star